Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Model Context Protocol (MCP) server patterns for building integrations with Claude Code. Triggers on: mcp server, model context protocol, tool handler, mcp resource, mcp tool.
.claude/skills/aiskillstore-mcp-patterns/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-04 | ✗→✓ | ▲ Improved | 24% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 35% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 5% | 0% |
| case-10 | ✗→✓ | ▲ Improved | -23% | 0% |
| case-11 | ✗→✓ | ▲ Improved | -43% | 0% |
Model Context Protocol (MCP) server patterns for building integrations with Claude Code.
pythonfrom mcp.server import Server from mcp.server.stdio import stdio_server app = Server("my-server") @app.list_tools() async def list_tools(): return [ { "name": "my_tool", "description": "Does something useful", "inputSchema": { "type": "object", "properties": { "query": {"type": "string", "description": "Search query"} }, "required": ["query"] } } ] @app.call_tool() async def call_tool(name: str, arguments: dict): if name == "my_tool": result = await do_something(arguments["query"]) return {"content": [{"type": "text", "text": result}]} raise ValueError(f"Unknown tool: {name}") async def main(): async with stdio_server() as (read_stream, write_stream): await app.run(read_stream, write_stream, app.create_initialization_options()) if __name__ == "__main__": import asyncio asyncio.run(main())
my-mcp-server/
├── src/
│ └── my_server/
│ ├── __init__.py
│ ├── server.py # Main server logic
│ ├── tools.py # Tool handlers
│ └── resources.py # Resource handlers
├── pyproject.toml
└── README.mdjson{ "mcpServers": { "my-server": { "command": "python", "args": ["-m", "my_server"], "env": { "MY_API_KEY": "your-key-here" } } } }
json{ "mcpServers": { "my-server": { "command": "uv", "args": ["run", "--directory", "/path/to/my-server", "python", "-m", "my_server"], "env": { "MY_API_KEY": "your-key-here" } } } }
| Pattern | Use Case | Reference | |---------|----------|-----------| | Tool validation | Input sanitization with Pydantic | ./references/tool-patterns.md | | Error handling | Graceful failure responses | ./references/tool-patterns.md | | Multiple tools | CRUD-style tool registration | ./references/tool-patterns.md | | Static resources | Config/settings exposure | ./references/resource-patterns.md | | Dynamic resources | Database-backed resources | ./references/resource-patterns.md | | Environment auth | API key from env vars | ./references/auth-patterns.md | | OAuth tokens | Token refresh with TTL | ./references/auth-patterns.md | | SQLite cache | Persistent state storage | ./references/state-patterns.md | | In-memory cache | TTL-based caching | ./references/state-patterns.md | | Manual testing | Quick validation script | ./references/testing-patterns.md | | pytest async | Unit tests for tools | ./references/testing-patterns.md |
| Issue | Solution | |-------|----------| | Server not starting | Check command path, ensure dependencies installed | | Tool not appearing | Verify list_tools() returns valid schema | | Auth failures | Check env vars are set in config, not shell | | Timeout errors | Add timeout to httpx calls, use async properly | | JSON parse errors | Ensure call_tool returns proper content structure |
For detailed patterns, load:
./references/tool-patterns.md - Validation, error handling, multi-tool registration./references/resource-patterns.md - Static and dynamic resource exposure./references/auth-patterns.md - Environment variables, OAuth token refresh./references/state-patterns.md - SQLite persistence, in-memory caching./references/testing-patterns.md - Manual test scripts, pytest async patterns| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-02 | fail→fail | 14,872 | 7,942 | -47% | 1 | 1 | 0% | 2,683 | 2,643 | -1% | 0 | 0 | — |
case-24 | pass→pass | 12,517 | 7,935 | -37% | 1 | 1 | 0% | 2,337 | 2,552 | +9% | 0 | 0 | — |
case-01 | fail→fail | 8,462 | 7,600 | -10% | 1 | 1 | 0% | 1,560 | 2,595 | +66% | 0 | 0 | — |
case-03 | pass→pass | 13,782 | 9,690 | -30% | 1 | 1 | 0% | 2,784 | 2,948 | +6% | 0 | 0 | — |
case-04 | fail→pass | 9,927 | 6,821 | -31% | 1 | 1 | 0% | 1,842 | 2,283 | +24% | 0 | 0 | — |
case-05 | pass→pass | 10,402 | 6,751 | -35% | 1 | 1 | 0% | 1,938 | 2,251 | +16% | 0 | 0 | — |
case-06 | pass→pass | 9,507 | 5,453 | -43% | 1 | 1 | 0% | 1,627 | 2,096 | +29% | 0 | 0 | — |
case-07 | fail→pass | 12,919 | 8,773 | -32% | 1 | 1 | 0% | 2,004 | 2,700 | +35% | 0 | 0 | — |
case-08 | fail→pass | 14,483 | 8,707 | -40% | 1 | 1 | 0% | 2,427 | 2,546 | +5% | 0 | 0 | — |
case-09 | pass→pass | 12,529 | 7,619 | -39% | 1 | 1 | 0% | 2,077 | 2,401 | +16% | 0 | 0 | — |
case-10 | fail→pass | 11,538 | 2,130 | -82% | 1 | 1 | 0% | 1,782 | 1,380 | -23% | 0 | 0 | — |
case-11 | fail→pass | 15,218 | 1,577 | -90% | 1 | 1 | 0% | 2,275 | 1,291 | -43% | 0 | 0 | — |
case-12 | fail→pass | 6,855 | 1,295 | -81% | 1 | 1 | 0% | 1,029 | 1,256 | +22% | 0 | 0 | — |
case-13 | fail→pass | 6,711 | 1,722 | -74% | 1 | 1 | 0% | 1,089 | 1,342 | +23% | 0 | 0 | — |
case-14 | fail→pass | 10,634 | 1,469 | -86% | 1 | 1 | 0% | 1,551 | 1,309 | -16% | 0 | 0 | — |
case-15 | pass→pass | 11,942 | 7,375 | -38% | 1 | 1 | 0% | 2,026 | 2,306 | +14% | 0 | 0 | — |
case-16 | pass→pass | 14,064 | 10,676 | -24% | 1 | 1 | 0% | 2,327 | 2,774 | +19% | 0 | 0 | — |
case-17 | fail→pass | 7,291 | 2,435 | -67% | 1 | 1 | 0% | 1,150 | 1,522 | +32% | 0 | 0 | — |
case-18 | pass→pass | 15,584 | 23,239 | +49% | 1 | 1 | 0% | 2,523 | 3,547 | +41% | 0 | 0 | — |
case-19 | pass→pass | 2,340 | 1,628 | -30% | 1 | 1 | 0% | 329 | 1,313 | +299% | 0 | 0 | — |
case-20 | pass→pass | 2,943 | 1,348 | -54% | 1 | 1 | 0% | 341 | 1,221 | +258% | 0 | 0 | — |
case-21 | pass→pass | 6,984 | 3,127 | -55% | 1 | 1 | 0% | 1,248 | 1,630 | +31% | 0 | 0 | — |
case-22 | pass→pass | 14,661 | 14,630 | -0% | 1 | 1 | 0% | 2,839 | 4,049 | +43% | 0 | 0 | — |
case-23 | pass→pass | 9,687 | 8,248 | -15% | 1 | 1 | 0% | 1,486 | 2,287 | +54% | 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. 24 cases were attempted. The headline lift of +38 percentage points is the difference between those two pass rates over the 24 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.