Agent skill · Backend & API

fastmcp-patterns

FastMCP server patterns for building MCP servers. Use when implementing MCP tools, resources, or server configuration.

majiayu000github.com/majiayu000GitHub ↗
claude-codecan modify filesMIT
Install
npx skills add majiayu000/claude-skill-registry --skill fastmcp-patterns --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 2
SKILL.md size: 3 KB
Bundled scripts: none
Allowed tools: ReadGrepGlobEditWrite
Path: skills/ai-llm/fastmcp-patterns/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 534
Language: HTML

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# FastMCP Patterns ## Server Setup with Lifespan ```python from contextlib import asynccontextmanager from mcp.server.fastmcp import FastMCP @asynccontextmanager async def lifespan(server: FastMCP): """Initialize resources on startup, cleanup on shutdown.""" driver = create_neo4j_driver(config) driver.verify_connectivity() try: yield {"driver": driver, "config": config} finally: driver.close() mcp = FastMCP( "requirements-graphrag-mcp", lifespan=lifespan, ) ``` ## Tool Registration ### Basic Tool with Pydantic Validation ```python from pydantic import BaseModel, Field class SearchInput(BaseModel): query: str = Field(..., description="Search query text") limit: int = Field(default=10, ge=1, le=100, description="Max results") @mcp.tool() async def semantic_search(input: SearchInput) -> list[dict]: """Search articles using semantic similarity.""" driver = mcp.state["driver"] return await execute_vector_search(driver, input.query, input.limit) ``` ### Tool with Annotations ```python from mcp.server.fastmcp import Context @mcp.tool( annotations={ "readOnlyHint": True, "openWorldHint": False, } ) async def get_schema(ctx: Context) -> dict: """Get database schema. Read-only operation."""

What's inside
Steps it walks through
  1. Server Setup with Lifespan
  2. Tool Registration
  3. Basic Tool with Pydantic Validation
  4. Tool with Annotations
  5. Resource Registration
  6. Error Handling Pattern
  7. Configuration Pattern
  8. Entry Point
  9. pyproject.toml Script
Ships with 1 file
  • metadata.json
More from claude-skill-registry
All skills →
About this skill
What does the fastmcp-patterns skill do?

FastMCP server patterns for building MCP servers. Use when implementing MCP tools, resources, or server configuration.

How do I install it?

Run `npx skills add majiayu000/claude-skill-registry --skill fastmcp-patterns --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going