What is MCP?
An introduction to the Model Context Protocol and why it matters for AI applications.
The Problem MCP Solves
AI assistants like Claude are powerful, but they're isolated by default. They can't access your files, query your databases, or interact with your tools. Every integration requires custom code.
- • Custom integration for each tool
- • No standardized communication
- • Security concerns with each connection
- • Difficult to maintain and scale
- • One protocol for all integrations
- • Standardized tool/resource format
- • Built-in security model
- • Easy to extend and maintain
MCP Architecture
MCP uses a client-server architecture. Click on each layer to learn more:
What MCP Servers Can Expose
MCP servers can expose three types of capabilities:
Simple Example
Here's what a simple MCP tool looks like:
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { z } from "zod";
const server = new McpServer({
name: "my-first-server",
version: "1.0.0",
});
// Define a tool
server.tool(
"greet", // Tool name
"Say hello to someone", // Description
{ name: z.string() }, // Input schema
async ({ name }) => ({ // Handler
content: [{ type: "text", text: `Hello, ${name}!` }],
})
);Key Points: Tools have a name, description, input schema (using Zod), and a handler function that returns content.
Try It Live
Experiment with MCP server code right in your browser:
Edit the code and click 'Test Tools' to try calling the tool
Quick Quiz
Test your understanding:
Ready to build?
Now that you understand what MCP is, let's create your first MCP server!