Skip to content

Skills

Skills are useful for reusable workflows that combine several tools or require supporting references, such as code review or document processing.

Similar to the structure defined in the Agent Skills specification, a skill can be defined with the following folder structure within the code repository.

  • package.json
  • Directorysrc/
    • Directoryskills/
      • Directoryyour_skill/
        • Directoryreferences/ # Optional: documentation
          • …
        • skill.ts
      • …

defineSkill takes a name, path, description and an instruction.

src/skills/your_skill/skill.ts
import { defineSkill } from "@mcpexpress/core";
const instructions = `# Trip expense report
Turn a list of travel expenses, possibly in several currencies, into a report totalled in
the traveller's home currency.
## Steps
1. Collect the expenses: date, description, amount and currency for each. Ask for the home
currency if the user has not given one.
2. Check the list against `references/expense-policy.md` and flag anything that breaks it.
Keep flagged items in the report.
3. For every currency other than the home currency, call `get_exchange_rates` once with the
home currency as `base` and all foreign currencies as `symbols`. Convert each amount by
dividing it by the rate for its currency.
4. Total the converted amounts with the `add_numbers` tool, adding them one at a time.
Do not add them up yourself.
5. Fill in `templates/report.md` and return it to the user.
`;
export const tripExpenseReport = defineSkill({
name: "trip-expense-report",
path: "finance",
description:
"Build a travel expense report from expenses in one or more currencies, converted and " +
"totalled in a single home currency and checked against the expense policy. Use when " +
"the user wants to total, convert or claim trip, travel or business expenses.",
instructions,
license: "MIT",
compatibility: "Needs the get_exchange_rates and add_numbers tools from this server",
metadata: { author: "mcp-express-examples", version: "1.0" },
});

Based on the above definition, MCP Express takes the skill and advertises a trip-expense-report skill. Any content defined within your skill folder is bundled together for final release and can be referenced inside them as shown in the example above.