Model Context Protocol (MCP) is an open standard that defines how AI models connect to external tools and data sources. Think of it as USB for AI — a universal connector that lets any AI model plug into any compatible tool without custom integration work for each combination. MCP was introduced by Anthropic in late 2024 and is now supported by Claude, Cursor, and a growing ecosystem of tools and platforms. If Cartara flagged this in your diff, you're likely configuring an MCP server connection, building a tool server, or using an MCP-compatible host like Claude Desktop or Cursor.
The Problem MCP Solves
Before MCP, connecting an LLM to an external tool required writing a custom tool definition for that LLM's API format, writing the integration code, and rebuilding this for every LLM you wanted to support. N models × M tools = N×M custom integrations.
MCP introduces a common protocol so a tool built once as an MCP server works with any MCP-compatible model — and any MCP-compatible model can use any MCP server. Write once, use anywhere.
How MCP Works
MCP has three components:
MCP Host — the AI application that wants to use tools (Claude Desktop, Cursor, a custom agent).
MCP Client — lives inside the host; manages communication with MCP servers.
MCP Server — a process that exposes tools, resources, and prompts to the model via the MCP protocol.
Your AI App (MCP Host)
↕ (via MCP Client)
MCP Server A (e.g., GitHub)
MCP Server B (e.g., Postgres database)
MCP Server C (e.g., Slack)What MCP Servers Can Expose
Tools — functions the model can call. "Search the database", "Create a GitHub issue", "Send a Slack message". The model sees the tool name, description, and parameter schema; decides when to call it; receives the result.
Resources — data the model can read. Files, database tables, API responses. Read-only access to information.
Prompts — pre-built prompt templates the model can invoke. Structured workflows the host can offer as one-click actions.
Transport
MCP servers communicate via:
- Standard I/O (stdio) — for local servers running on the same machine
- Server-Sent Events (SSE) over HTTP — for remote servers accessible over the network
What You'll See in Your Code
A minimal MCP server in TypeScript:
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
const server = new Server({ name: "my-tool-server", version: "1.0.0" });
server.setRequestHandler("tools/list", async () => ({
tools: [{
name: "get_weather",
description: "Get current weather for a city",
inputSchema: {
type: "object",
properties: {
city: { type: "string", description: "City name" }
},
required: ["city"]
}
}]
}));
server.setRequestHandler("tools/call", async (request) => {
if (request.params.name === "get_weather") {
const city = request.params.arguments.city;
return { content: [{ type: "text", text: `Weather in ${city}: 22°C, sunny` }] };
}
});
const transport = new StdioServerTransport();
await server.connect(transport);Configuring an MCP server in Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"my-tool-server": {
"command": "node",
"args": ["/path/to/server.js"]
}
}
}The MCP Ecosystem Today
A large and growing library of pre-built MCP servers is available:
- Dev tools: GitHub, GitLab, Jira, Linear, Sentry
- Databases: PostgreSQL, MySQL, SQLite, BigQuery, Snowflake
- Productivity: Google Drive, Notion, Confluence
- Communication: Slack, email, Discord
- Web: Browser automation, web search, URL fetching
- Cloud: AWS, GCP, Cloudflare
The MCP registry and Smithery list thousands of available servers.
MCP-compatible hosts: Claude Desktop, Claude Code, Cursor, Cline/Roo (VS Code extensions), LibreChat, Open WebUI, and any custom agent built with the MCP SDK.
MCP vs. Direct Function Calling
MCP and LLM function calling (OpenAI/Anthropic tool use APIs) serve similar purposes:
| Direct Function Calling | MCP | |
|---|---|---|
| Portability | Model-specific format | Model-agnostic standard |
| Runtime | In-process | Separate server process |
| Discovery | Defined at prompt time | Servers expose tool lists dynamically |
| Reusability | Per-app, per-model | Write once, use anywhere |
| Ecosystem | No shared registry | Growing public registry |
For a single-app, single-model use case, direct function calling is simpler. For multi-model, multi-app, or ecosystem-facing use cases, MCP is the right choice.
Key Design Principles for MCP Tools
Write excellent tool descriptions. The model decides when to call your tool based on the description. Be specific about what the tool does, when it should be used, and when it shouldn't.
Use strict input schemas. JSON Schema with required fields, enum values, and clear descriptions prevents malformed arguments.
Return structured, informative responses. Structured JSON is easier for the model to reason about than prose. Include enough context for the model to understand the result.
Fail informatively. Return clear error messages that tell the model what went wrong and how to correct it. Silent failures cause the model to hallucinate.
Remote MCP Servers
MCP servers can run anywhere and expose the same protocol over HTTP/SSE. Remote MCP servers enable SaaS MCP integrations, shared team servers, and marketplace integrations. Remote servers require authentication — OAuth 2.0 is the standard mechanism.
Getting Started
As a user: Install Claude Desktop, enable MCP in settings, and add a pre-built server (start with a filesystem server or GitHub server).
As a builder (using existing servers): Browse the MCP registry for servers relevant to your use case. Use the MCP SDK to connect your agent as a host.
As a server builder: Start with the TypeScript or Python SDK, define 2–3 well-described tools, and test locally with Claude Desktop before publishing.
Related Concepts
- Prompting Best Practices
- Structured Outputs
- RAG - Retrieval-Augmented Generation
- Voice AI and Real-Time Audio