← ClaudeAtlas

mcp-patternslisted

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.
aiskillstore/marketplace · ★ 329 · AI & Automation · score 85
Install: claude install-skill aiskillstore/marketplace
# MCP Patterns Model Context Protocol (MCP) server patterns for building integrations with Claude Code. ## Basic MCP Server (Python) ```python from 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()) ``` ## Project Layout ``` my-mcp-server/ ├── src/ │ └── my_server/ │ ├── __init__.py │ ├── server.py # Main server logic │ ├── tools.py # Tool handlers │ └── resources.py # Resource handlers ├── pyproject.toml └── README.md ``` ## Claude Desktop Configuration ### Basic Configuration ```json { "mcpSe