Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Complete guide for building MCP servers with FastMCP 3.0 - tools, resources, authentication, providers, middleware, and deployment. Use when creating Python MCP servers or integrating AI models with external tools and data.
.claude/skills/davila7-fastmcp-server/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | -16% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 18% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 75% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 18% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 58% | 0% |
Complete reference for building production-ready MCP (Model Context Protocol) servers with FastMCP 3.0 - the fast, Pythonic framework for connecting LLMs to tools and data.
Use FastMCP Server when:
Key areas covered:
Create a server with tools:
pythonfrom fastmcp import FastMCP mcp = FastMCP("MyServer") @mcp.tool def add(a: int, b: int) -> int: """Add two numbers""" return a + b
Create a resource:
python@mcp.resource("data://config") def get_config() -> dict: """Return server configuration""" return {"version": "1.0", "debug": False}
Create a resource template:
python@mcp.resource("users://{user_id}/profile") def get_user_profile(user_id: str) -> dict: """Get a user's profile by ID""" return fetch_user(user_id)
Create a prompt:
python@mcp.prompt def review_code(code: str, language: str = "python") -> str: """Review code for best practices""" return f"Review this {language} code:\n\n{code}"
Run the server:
pythonif __name__ == "__main__": mcp.run() # Or with transport options: # mcp.run(transport="sse", host="0.0.0.0", port=8000)
pythonfrom fastmcp import FastMCP, Context mcp = FastMCP("MyServer") @mcp.tool def process_data(uri: str, ctx: Context) -> str: """Process data with logging and progress""" ctx.info(f"Processing {uri}") ctx.report_progress(0, 100) data = ctx.read_resource(uri) ctx.report_progress(100, 100) return f"Processed: {data}"
pythonfrom fastmcp import FastMCP from fastmcp.server.auth import BearerAuthProvider auth = BearerAuthProvider( jwks_uri="https://your-provider/.well-known/jwks.json", audience="your-api", issuer="https://your-provider/" ) mcp = FastMCP("SecureServer", auth=auth)
Functions exposed as executable capabilities for LLMs. Decorated with @mcp.tool. Support Pydantic validation, async, custom return types, and annotations (readOnlyHint, destructiveHint).
Static or dynamic data sources identified by URIs. Resources use fixed URIs (data://config), templates use parameterized URIs (users://{id}/profile). Support MIME types, annotations, and wildcard parameters.
The Context object provides access to MCP features within tools/resources: logging, progress reporting, resource access, LLM sampling, user elicitation, and session state.
Inject values into tool/resource functions using Depends(). Supports HTTP requests, access tokens, custom dependencies, and generator-based cleanup patterns.
Control where components come from. LocalProvider (default, decorator-based), FileSystemProvider (load from Python files on disk), SkillsProvider (packaged bundles), or custom providers.
Multiple auth patterns: token verification (JWT, JWKS), OAuth proxy, OIDC proxy, remote OAuth, and full OAuth server. Authorization via scopes on components and middleware.
Intercept and modify requests/responses. Built-in middleware for rate limiting, error handling, logging, and response size limits. Custom middleware via @mcp.middleware.
Detailed documentation is organized in the references/ folder:
v1.0.0 (February 2026)
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | pass→pass | 12,096 | 9,600 | -21% | 1 | 1 | 0% | 2,294 | 3,727 | +62% | 0 | 0 | — |
case-02 | fail→pass | 17,490 | 5,302 | -70% | 1 | 1 | 0% | 3,399 | 2,841 | -16% | 0 | 0 | — |
case-03 | fail→pass | 18,912 | 13,269 | -30% | 1 | 1 | 0% | 3,446 | 4,070 | +18% | 0 | 0 | — |
case-04 | fail→pass | 12,167 | 8,730 | -28% | 1 | 1 | 0% | 1,939 | 3,397 | +75% | 0 | 0 | — |
case-05 | pass→pass | 8,121 | 3,838 | -53% | 1 | 1 | 0% | 1,545 | 2,452 | +59% | 0 | 0 | — |
case-06 | pass→pass | 6,793 | 4,409 | -35% | 1 | 1 | 0% | 1,137 | 2,377 | +109% | 0 | 0 | — |
case-07 | pass→pass | 6,528 | 3,931 | -40% | 1 | 1 | 0% | 1,229 | 2,430 | +98% | 0 | 0 | — |
case-08 | pass→pass | 14,454 | 8,277 | -43% | 1 | 1 | 0% | 2,485 | 3,278 | +32% | 0 | 0 | — |
case-09 | fail→pass | 12,833 | 4,364 | -66% | 1 | 1 | 0% | 2,110 | 2,482 | +18% | 0 | 0 | — |
case-10 | pass→pass | 10,498 | 2,615 | -75% | 1 | 1 | 0% | 1,674 | 2,266 | +35% | 0 | 0 | — |
case-11 | fail→pass | 11,450 | 5,903 | -48% | 1 | 1 | 0% | 1,796 | 2,830 | +58% | 0 | 0 | — |
case-12 | fail→pass | 15,359 | 8,948 | -42% | 1 | 1 | 0% | 2,858 | 3,461 | +21% | 0 | 0 | — |
case-13 | pass→pass | 12,719 | 7,274 | -43% | 1 | 1 | 0% | 2,065 | 3,118 | +51% | 0 | 0 | — |
case-14 | pass→pass | 7,930 | 4,993 | -37% | 1 | 1 | 0% | 1,309 | 2,664 | +104% | 0 | 0 | — |
case-15 | pass→pass | 9,995 | 4,917 | -51% | 1 | 1 | 0% | 1,601 | 2,634 | +65% | 0 | 0 | — |
case-16 | pass→pass | 10,243 | 6,597 | -36% | 1 | 1 | 0% | 1,897 | 3,051 | +61% | 0 | 0 | — |
case-17 | pass→pass | 19,758 | 13,287 | -33% | 1 | 1 | 0% | 3,385 | 4,021 | +19% | 0 | 0 | — |
case-18 | pass→pass | 12,032 | 4,451 | -63% | 1 | 1 | 0% | 2,069 | 2,602 | +26% | 0 | 0 | — |
case-19 | pass→pass | 8,368 | 2,389 | -71% | 1 | 1 | 0% | 1,347 | 2,188 | +62% | 0 | 0 | — |
case-20 | pass→pass | 17,935 | 16,148 | -10% | 1 | 1 | 0% | 3,551 | 5,038 | +42% | 0 | 0 | — |
case-21 | pass→pass | 10,560 | 10,195 | -3% | 1 | 1 | 0% | 2,167 | 3,839 | +77% | 0 | 0 | — |
case-22 | pass→pass | 14,484 | 13,419 | -7% | 1 | 1 | 0% | 2,782 | 4,106 | +48% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +27 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.