MCP β Model Context Protocol
What is MCP?
Section titled βWhat is MCP?βModel Context Protocol (MCP) is an open standard developed by Anthropic that defines how AI models communicate with external tools, data sources, and services. It gives AI agents a standardised way to reach beyond their training data β querying live databases, reading files, calling APIs, and executing actions.
Think of MCP as USB for AI. Just as USB standardised how devices connect to computers, MCP standardises how AI agents connect to the world.
Without MCP:
Each AI tool β custom integration β each data sourceClaude Desktop needs custom code for GitHub, Jira, Slack, databases... separatelyWith MCP:
Any MCP-compatible AI tool β MCP protocol β any MCP serverOne standard. Write it once, works with Claude, Kiro, Cursor, and any future AI tool.The Problem MCP Solves
Section titled βThe Problem MCP SolvesβLLMs are powerful but isolated. Out of the box, an AI assistant only knows whatβs in its training data and the current conversation. For real-world work, it needs:
- Your database schema β to write accurate queries
- Your Jira tickets β to implement the right feature
- Your codebase β to make consistent changes
- Live APIs β to take actions, not just describe them
Before MCP, every AI tool built its own proprietary integration for each data source. The result: fragmented tooling, no reuse, constant duplication.
MCP introduces one protocol, enabling a marketplace of reusable servers that work with any compliant AI client.
Architecture
Section titled βArchitectureβMCP has three roles:
βββββββββββββββ MCP Protocol βββββββββββββββ βββββββββββββββββ MCP Host β ββββββββββββββββββββΊ β MCP Client β βββΊ β MCP Server ββ β β (embedded) β β ββ Claude β β β β GitHub ββ Kiro β β β β Jira ββ Cursor β β β β SQL Server ββββββββββββββββ βββββββββββββββ ββββββββββββββββ- MCP Host β the AI application the user interacts with (Claude Desktop, Kiro, Cursor)
- MCP Client β the protocol client built into the host, manages connections to servers
- MCP Server β a lightweight process that exposes capabilities (tools, resources, prompts) from a specific data source or API
What MCP Servers Expose
Section titled βWhat MCP Servers ExposeβFunctions the AI can call to perform actions:
{ "name": "create_issue", "description": "Create a new GitHub issue", "parameters": { "title": { "type": "string" }, "body": { "type": "string" }, "labels": { "type": "array" } }}Resources
Section titled βResourcesβData the AI can read for context:
github://repos/myorg/myrepo/contents/README.mdjira://projects/PROJ/issues/PROJ-42file:///home/user/project/schema.sqlPrompts
Section titled βPromptsβPre-built prompt templates the AI can invoke:
"code-review" β structured code review prompt"bug-report" β extract a structured bug report from a descriptionMCP Transport
Section titled βMCP TransportβMCP servers communicate via two transport mechanisms:
stdio β the host launches the server as a subprocess, communicating via stdin/stdout. Most common for local tools:
{ "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"], "env": { "GITHUB_TOKEN": "${GITHUB_TOKEN}" }}HTTP + SSE β for remote servers. The AI connects to an HTTP endpoint. Used for hosted services:
{ "url": "https://mcp.yourservice.com/sse", "headers": { "Authorization": "Bearer ${API_TOKEN}" }}Popular MCP Servers
Section titled βPopular MCP Serversβ| Server | What it provides | Package |
|---|---|---|
| GitHub | Issues, PRs, repos, files | @modelcontextprotocol/server-github |
| GitLab | MRs, pipelines, issues | @modelcontextprotocol/server-gitlab |
| Atlassian | Jira tickets, Confluence pages | @atlassian/mcp-atlassian |
| SQL Server | Database schema, queries | mcp-server-mssql |
| PostgreSQL | Database schema, queries | @modelcontextprotocol/server-postgres |
| Filesystem | Read/write local files | @modelcontextprotocol/server-filesystem |
| Fetch | Web page content | @modelcontextprotocol/server-fetch |
| Slack | Messages, channels | @modelcontextprotocol/server-slack |
| AWS KB Retrieval | AWS Bedrock knowledge bases | @modelcontextprotocol/server-aws-kb-retrieval |
MCP in Different AI Tools
Section titled βMCP in Different AI Toolsβ| Tool | MCP Support | Config location |
|---|---|---|
| Claude Desktop | β Full | ~/Library/Application Support/Claude/claude_desktop_config.json |
| AWS Kiro | β Full | .kiro/mcp.json in project |
| Cursor | β Full | .cursor/mcp.json or global settings |
| Windsurf | β Full | Settings β MCP |
| VS Code (Copilot) | β (via extensions) | settings.json |
Claude Desktop Configuration
Section titled βClaude Desktop Configurationβ{ "mcpServers": { "github": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "your_token" } }, "filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/projects"] } }}Writing Your Own MCP Server
Section titled βWriting Your Own MCP ServerβThe MCP SDK makes it straightforward to build a custom server in Python or TypeScript:
# Python β using the MCP SDKfrom mcp.server import Serverfrom mcp.server.models import InitializationOptionsimport mcp.types as types
server = Server("my-custom-server")
@server.list_tools()async def handle_list_tools() -> list[types.Tool]: return [ types.Tool( name="get_product", description="Fetch a product by ID from our internal catalog", inputSchema={ "type": "object", "properties": { "product_id": {"type": "string"} }, "required": ["product_id"] } ) ]
@server.call_tool()async def handle_call_tool(name: str, arguments: dict) -> list[types.TextContent]: if name == "get_product": product = await fetch_product(arguments["product_id"]) return [types.TextContent(type="text", text=str(product))]// TypeScriptimport { Server } from "@modelcontextprotocol/sdk/server/index.js";import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
const server = new Server({ name: "my-server", version: "1.0.0" });
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [{ name: "get_order", description: "Fetch an order from our system", inputSchema: { type: "object", properties: { orderId: { type: "string" } }, required: ["orderId"] } }]}));
const transport = new StdioServerTransport();await server.connect(transport);MCP Security Model
Section titled βMCP Security Modelβ- MCP servers run locally by default β credentials go from your machine to the target service, not through the AI providerβs servers
- Use environment variable references (
${TOKEN}) instead of hardcoding secrets in config files - Add MCP config files to
.gitignoreif they contain org-specific URLs - Scope tokens to the minimum required permissions β prefer read-only where possible
- Review third-party MCP servers before installing β they run code on your machine
MCP vs Function Calling vs RAG
Section titled βMCP vs Function Calling vs RAGβ| Approach | When to use |
|---|---|
| MCP | Standardised, reusable tool connections. Cross-tool compatibility. Best for production AI workflows. |
| Function calling | Ad-hoc tools in a single application. Simpler but proprietary to each provider. |
| RAG | Searching large document collections. Semantic search over embeddings. Complements MCP. |
MCP and RAG are complementary: an MCP server can expose a RAG pipeline as a tool, giving the AI a single interface for both structured queries and semantic search.