What MCP Actually Does
Model Context Protocol is an open standard that lets AI assistants call external tools, read files, and hit APIs – all through a single, consistent interface. Instead of every AI client inventing its own plugin system, MCP gives you one protocol that works across Claude Desktop, VS Code, Cursor, ChatGPT, and others.
MCP servers expose three types of capabilities:
- Tools – functions the model can call (with user approval), like querying a database or calling an API
- Resources – read-only data the model can pull in, like file contents or API responses
- Prompts – pre-built templates that guide the model through specific tasks
The protocol uses JSON-RPC over stdio or HTTP. Your server is just a process that reads JSON-RPC messages and responds. The Python SDK (v1.x stable, v2 in pre-alpha) and TypeScript SDK (v1.26.0) handle all the protocol plumbing.
Build a Python MCP Server in 5 Minutes
You need Python 3.10+ and uv (Astral’s fast package manager). If you don’t have uv:
| |
Set up the project:
| |
Now create server.py. This server exposes a tool that fetches the top Hacker News stories:
| |
The FastMCP class reads your type hints and docstrings to auto-generate the tool schemas that clients need. No manual JSON Schema definitions required.
Run it to verify there are no import errors:
| |
The process will sit there waiting for JSON-RPC input on stdin. That’s correct – kill it with Ctrl+C.
Connect It to Claude Desktop
Open your Claude Desktop config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Create the file if it doesn’t exist, and add your server:
| |
Two things to get right here: the path must be absolute, and the command might need to be the full path to uv (run which uv to find it).
Quit Claude Desktop completely (Cmd+Q on macOS, not just closing the window) and reopen it. You should see a connector icon indicating available MCP tools.
Ask Claude: “What are the top stories on Hacker News right now?” It will call your top_stories tool and return real results.
Add Resources for Static Data
Tools are for actions. Resources are for data you want Claude to be able to read. Here’s how to expose a local config file as a resource:
| |
Resources use URI schemes. When a client requests config://app-settings, your function runs and returns the data. This is useful for giving Claude access to project configuration, database schemas, or documentation without the model needing to call a tool.
Debugging with MCP Inspector
The MCP Inspector is a standalone tool for testing servers without launching a full client. Install and run it:
| |
This opens a web UI where you can list available tools, call them with test inputs, and see the raw JSON-RPC messages. It’s the fastest way to iterate when you’re building a server.
Common Errors and Fixes
“Could not attach to MCP server” in Claude Desktop. This almost always means Claude can’t find or execute the command. Check these in order:
- Is the path in
claude_desktop_config.jsonabsolute? Relative paths silently fail. - Can Claude find
uv? Runwhich uvand use that full path as thecommandvalue. - Is your JSON valid? A trailing comma or missing quote will break the entire config. Run it through
python3 -m json.tool claude_desktop_config.jsonto validate.
spawn uv ENOENT in the logs.
Claude Desktop can’t find the uv binary. Your shell PATH isn’t inherited by the desktop app. Fix it by using the absolute path:
| |
Server starts but tools don’t appear.
Your server is probably writing to stdout accidentally. In MCP stdio servers, stdout is reserved for JSON-RPC messages. Any stray print() call corrupts the protocol stream. Use print(..., file=sys.stderr) or the logging module (which defaults to stderr).
“Connection timeout” or tools hang. Check that your tool functions actually return. If an HTTP request inside a tool hangs, the whole server stalls. Always set explicit timeouts on network calls:
| |
Check the logs. Claude Desktop writes MCP logs to ~/Library/Logs/Claude/ on macOS. Look at mcp.log for connection issues and mcp-server-hackernews.log for your server’s stderr output.
MCP Apps: Interactive UIs in Chat
The newest MCP feature (January 2026) is MCP Apps – an official extension that lets tools return interactive UI components. Instead of dumping raw text, your tool can render dashboards, forms, and visualizations directly in the conversation.
Tools include a _meta.ui.resourceUri field pointing to an HTML resource served via the ui:// scheme. The host renders it in a sandboxed iframe with bidirectional JSON-RPC communication. This works today in Claude, VS Code Insiders, and Goose.
This is still early, but the practical upshot: tools that return data (like database queries or monitoring dashboards) can now show interactive tables, charts, and filters instead of making the user ask follow-up questions to drill down.
Where MCP Is Headed
The protocol spec (currently version 2025-11-25) is actively evolving. The team is working on async operation support for long-running tasks, stateless scaling for enterprise deployments, and .well-known URLs for server discovery. SDK downloads hit 97 million per month, with over 10,000 active servers in the ecosystem.
The important thing: MCP is the standard now. Claude, ChatGPT, Gemini, Copilot, and VS Code all support it. If you’re building any kind of AI integration, building an MCP server is the way to make it work everywhere.