Skip to content

Model Context Protocol (MCP)

Model Context Protocol is an open standard that lets AI models (like Claude) connect to external tools, databases, and APIs through a unified interface.

Think of it as a USB standard for AI — any MCP-compatible client can talk to any MCP server.

Claude (MCP Client)
↕ MCP Protocol
MCP Server
Your Tools / APIs / Databases
TypeDescriptionExample
ToolsFunctions the AI can callRun SQL query, send email
ResourcesData the AI can readFile contents, DB records
PromptsReusable prompt templatesSummarize document
from mcp.server import Server
from mcp.server.stdio import stdio_server
from mcp import types
app = Server("my-server")
@app.list_tools()
async def list_tools():
return [
types.Tool(
name="get_weather",
description="Get current weather for a city",
inputSchema={
"type": "object",
"properties": {
"city": {"type": "string"}
},
"required": ["city"]
}
)
]
@app.call_tool()
async def call_tool(name: str, arguments: dict):
if name == "get_weather":
city = arguments["city"]
# call your weather API here
return [types.TextContent(type="text", text=f"Sunny in {city}, 28°C")]
async def main():
async with stdio_server() as (read, write):
await app.run(read, write, app.create_initialization_options())

Add to ~/.claude/settings.json:

{
"mcpServers": {
"my-server": {
"command": "python",
"args": ["/path/to/server.py"]
}
}
}
  • filesystem — read/write local files
  • postgres — query PostgreSQL databases
  • github — interact with GitHub repos
  • fetch — fetch web pages
  • sqlite — query SQLite databases