The 2026 Model Context Protocol (MCP) Cheatsheet: Servers, SSE Transports, and Schemas
A complete developer reference for building and integrating Model Context Protocol (MCP) servers, JSON-RPC endpoints, and Server-Sent Events (SSE) transports.
Contents
- What is Model Context Protocol (MCP)?
- What are the supported MCP transport protocols?
- How do you implement a lightweight MCP server in Python?
- What is the complete MCP JSON-RPC message reference?
- FAQ
What is Model Context Protocol (MCP)?
The Model Context Protocol (MCP) is an open standard developed by Anthropic and adopted across the AI industry. It defines how AI applications (clients) discover and execute tools, resources, and prompt templates provided by external systems (servers).
flowchart LR
A[AI Client / Agent Runtime] |JSON-RPC 2.0 over stdio or SSE| B[MCP Server]
B C[(PostgreSQL Database)]
B D[Local File System]
B E[External SaaS API]What are the supported MCP transport protocols?
MCP supports two primary transport mechanisms:
| Transport | Best Suited For | Connection Lifecycle | Security Model |
|---|---|---|---|
| stdio | Local CLI tools, desktop IDEs (Claude Desktop / VS Code) | Process spawned on-demand by client | Local OS user permissions |
| SSE (Server-Sent Events) | Remote servers, shared cloud databases, microservices | Persistent HTTP connection with streaming responses | Bearer tokens / TLS certificates |
How do you implement a lightweight MCP server in Python?
Here is a complete, production-ready Python MCP server exposing database query tools:
#!/usr/bin/env python3# mcp_db_server.pyimport sysimport jsondef handle_initialize(msg_id: int): return { 'jsonrpc': '2.0', 'id': msg_id, 'result': { 'protocolVersion': '2024-11-05', 'capabilities': { 'tools': {} }, 'serverInfo': { 'name': 'zerolabs-db-mcp', 'version': '1.0.0' } } }def handle_list_tools(msg_id: int): return { 'jsonrpc': '2.0', 'id': msg_id, 'result': { 'tools': [ { 'name': 'query_blog_status', 'description': 'Returns publication status and metadata for a given blog post slug.', 'inputSchema': { 'type': 'object', 'properties': { 'slug': {'type': 'string', 'description': 'The unique article slug'} }, 'required': ['slug'] } } ] } }def main(): for line in sys.stdin: line = line.strip() if not line: continue try: req = json.loads(line) method = req.get('method') msg_id = req.get('id') if method == 'initialize': resp = handle_initialize(msg_id) elif method == 'tools/list': resp = handle_list_tools(msg_id) else: resp = {'jsonrpc': '2.0', 'id': msg_id, 'error': {'code': -32601, 'message': 'Method not found'}} sys.stdout.write(json.dumps(resp) + '\n') sys.stdout.flush() except Exception as e: sys.stderr.write(f'Error handling request: {e}\n')if __name__ == '__main__': main()What is the complete MCP JSON-RPC message reference?
1. Initialize Request
{ "jsonrpc": "2.0", "method": "initialize", "params": { "protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "openclaw", "version": "1.0"} }, "id": 1}2. Call Tool Request
{ "jsonrpc": "2.0", "method": "tools/call", "params": { "name": "query_blog_status", "arguments": { "slug": "why-non-coding-agents-fail" } }, "id": 2}3. Tool Result Response
{ "jsonrpc": "2.0", "id": 2, "result": { "content": [ { "type": "text", "text": "{\"status\": \"published\", \"zone\": \"agents\"}" } ], "isError": false }}FAQ
- What is the difference between MCP and standard REST APIs?
MCP provides a standardized protocol for tool discovery, type validation, and streaming session state, removing the need to write unique client-side integration wrappers for every distinct API.
- Can an MCP server provide resources as well as tools?
Yes. MCP servers can expose Resources (read-only context documents, logs, or database rows) and Prompts (pre-engineered prompt templates) in addition to executable Tools.
- How do I configure MCP servers in Claude Desktop or VS Code?
Add the server execution command and environment variables to
claude_desktop_config.jsonunder themcpServersconfiguration key.