{/ This page is auto-generated from the skill's SKILL.md by website/scripts/generate-skill-docs.py. Edit the source SKILL.md, not this page. /}

Fastmcp

Build, test, inspect, install, and deploy MCP servers with FastMCP in Python. Use when creating a new MCP server, wrapping an API or database as MCP tools, exposing resources or prompts, or preparing a FastMCP server for Claude Code, Cursor, or HTTP deployment.

Skill metadata

Source Optional — install with hermes skills install official/mcp/fastmcp
Path optional-skills/mcp/fastmcp
Version 1.0.0
Author Hermes Agent
License MIT
Tags MCP, FastMCP, Python, Tools, Resources, Prompts, Deployment
Related skills native-mcp, mcporter

Reference: full SKILL.md

ℹ️ Info

The following is the complete skill definition that Hermes loads when this skill is triggered. This is what the agent sees as instructions when the skill is active.

FastMCP

Build MCP servers in Python with FastMCP, validate them locally, install them into MCP clients, and deploy them as HTTP endpoints.

When to Use

Use this skill when the task is to:

Use native-mcp when the server already exists and only needs to be connected to Hermes. Use mcporter when the goal is ad-hoc CLI access to an existing MCP server instead of building one.

Prerequisites

Install FastMCP in the working environment first:

pip install fastmcp
fastmcp version

For the API template, install httpx if it is not already present:

pip install httpx

Included Files

Templates

Scripts

References

Workflow

1. Pick the Smallest Viable Server Shape

Choose the narrowest useful surface area first:

Prefer a thin server with good names, docstrings, and schemas over a large server with vague tools.

2. Scaffold from a Template

Copy a template directly or use the scaffold helper:

python ~/.hermes/skills/mcp/fastmcp/scripts/scaffold_fastmcp.py \
  --template api_wrapper \
  --name "Acme API" \
  --output ./acme_server.py

Available templates:

python ~/.hermes/skills/mcp/fastmcp/scripts/scaffold_fastmcp.py --list

If copying manually, replace __SERVER_NAME__ with a real server name.

3. Implement Tools First

Start with @mcp.tool functions before adding resources or prompts.

Rules for tool design:

Good tool examples:

Weak tool examples:

4. Add Resources and Prompts Only When They Help

Add @mcp.resource when the client benefits from fetching stable read-only content such as schemas, policy docs, or generated reports.

Add @mcp.prompt when the server should provide a reusable prompt template for a known workflow.

Do not turn every document into a prompt. Prefer:

5. Test the Server Before Integrating It Anywhere

Use the FastMCP CLI for local validation:

fastmcp inspect acme_server.py:mcp
fastmcp list acme_server.py --json
fastmcp call acme_server.py search_resources query=router limit=5 --json

For fast iterative debugging, run the server locally:

fastmcp run acme_server.py:mcp

To test HTTP transport locally:

fastmcp run acme_server.py:mcp --transport http --host 127.0.0.1 --port 8000
fastmcp list http://127.0.0.1:8000/mcp --json
fastmcp call http://127.0.0.1:8000/mcp search_resources query=router --json

Always run at least one real fastmcp call against each new tool before claiming the server works.

6. Install into a Client When Local Validation Passes

FastMCP can register the server with supported MCP clients:

fastmcp install claude-code acme_server.py
fastmcp install claude-desktop acme_server.py
fastmcp install cursor acme_server.py -e .

Use fastmcp discover to inspect named MCP servers already configured on the machine.

When the goal is Hermes integration, either:

7. Deploy After the Local Contract Is Stable

For managed hosting, Prefect Horizon is the path FastMCP documents most directly. Before deployment:

fastmcp inspect acme_server.py:mcp

Make sure the repo contains:

For generic HTTP hosting, validate the HTTP transport locally first, then deploy on any Python-compatible platform that can expose the server port.

Common Patterns

API Wrapper Pattern

Use when exposing a REST or HTTP API as MCP tools.

Recommended first slice:

Implementation notes:

Start from templates/api_wrapper.py.

Database Pattern

Use when exposing safe query and inspection capabilities.

Recommended first slice:

Implementation notes:

Start from templates/database_server.py.

File Processor Pattern

Use when the server needs to inspect or transform files on demand.

Recommended first slice:

Implementation notes:

Start from templates/file_processor.py.

Quality Bar

Before handing off a FastMCP server, verify all of the following:

Troubleshooting

FastMCP command missing

Install the package in the active environment:

pip install fastmcp
fastmcp version

fastmcp inspect fails

Check that:

Tool works in Python but not through CLI

Run:

fastmcp list server.py --json
fastmcp call server.py your_tool_name --json

This usually exposes naming mismatches, missing required arguments, or non-serializable return values.

Hermes cannot see the deployed server

The server-building part may be correct while the Hermes config is not. Load the native-mcp skill and configure the server in ~/.hermes/config.yaml, then restart Hermes.

References

For CLI details, install targets, and deployment checks, read references/fastmcp-cli.md.