Overview
Official Model Context Protocol server from Anthropic for seamless Claude integration.
Setup
Run with npx:
npx -y @anthropic-ai/mcp-serverConfiguration
ANTHROPIC_API_KEY environment variableDocumentation
Anthropic MCP
Overview
Anthropic MCP is the official Model Context Protocol server from Anthropic, enabling seamless integration between Claude and external tools, data sources, and services. It provides a standardized way for developers to extend Claude's capabilities through the MCP protocol, which is designed to be a universal interface for AI models to interact with external systems.
The Anthropic MCP server serves as both a reference implementation for the MCP protocol and a production-ready integration point for Anthropic's AI models. It demonstrates best practices for building MCP servers and provides a foundation for the growing ecosystem of MCP-compatible tools and services.
Features
- Official Anthropic Implementation: Reference MCP server from Anthropic
- Tool Integration: Connect Claude to external tools and APIs
- Resource Access: Provide Claude with access to external data sources
- Prompt Templates: Share reusable prompt templates with Claude
- Standard Protocol: Full compliance with MCP specification
- TypeScript SDK: Built with the official MCP TypeScript SDK
- Streaming Support: Real-time streaming of tool outputs
- Error Handling: Robust error handling and recovery
Installation
Using npx (Quick Start)
npx -y @anthropic-ai/mcp-server
Using npm
npm install -g @anthropic-ai/mcp-server
Configuration for Claude Desktop
Add to your Claude Desktop config file (~/Library/Application Support/Claude/claude_desktop_config.json on macOS or %APPDATA%\Claude\claude_desktop_config.json on Windows):
{
"mcpServers": {
"anthropic": {
"command": "npx",
"args": ["-y", "@anthropic-ai/mcp-server"],
"env": {
"ANTHROPIC_API_KEY": "your-api-key"
}
}
}
}
Available Tools
| Tool | Description |
|---|---|
list_tools | List all available tools |
call_tool | Execute a specific tool |
list_resources | List available data resources |
read_resource | Read a specific resource |
list_prompts | List available prompt templates |
get_prompt | Retrieve a specific prompt template |
Configuration
Environment Variables
| Variable | Description | Required |
|---|---|---|
ANTHROPIC_API_KEY | Your Anthropic API key | Yes |
ANTHROPIC_MODEL | Default model to use | No (default: claude-3-5-sonnet-latest) |
Example Configuration
{
"mcpServers": {
"anthropic": {
"command": "node",
"args": ["/path/to/@anthropic-ai/mcp-server/dist/index.js"],
"env": {
"ANTHROPIC_API_KEY": "sk-ant-...",
"ANTHROPIC_MODEL": "claude-3-5-sonnet-latest"
}
}
}
}
Usage Examples
Calling a Tool
from mcp import ClientSession, StdioClientTransport
import asyncio
async def main():
transport = StdioClientTransport(
command="npx",
args=["-y", "@anthropic-ai/mcp-server"]
)
async with ClientSession(transport) as session:
await session.initialize()
# List available tools
tools = await session.list_tools()
print(f"Available tools: {[t.name for t in tools.tools]}")
# Call a tool
result = await session.call_tool(
"call_tool",
arguments={"name": "search", "arguments": {"query": "AI agents"}}
)
print(result)
asyncio.run(main())
Using Prompt Templates
# List available prompts
prompts = await session.list_prompts()
# Get a specific prompt
prompt = await session.get_prompt(
"code-review-template",
arguments={"code": "def hello(): pass", "language": "python"}
)
print(prompt.messages)
Accessing Resources
# List available resources
resources = await session.list_resources()
# Read a resource
resource = await session.read_resource("file:///path/to/document.txt")
print(resource.contents)
Building Custom MCP Servers
The Anthropic MCP server serves as a reference for building your own:
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
const server = new Server(
{ name: "my-mcp-server", version: "1.0.0" },
{ capabilities: { tools: {} } }
);
server.setRequestHandler(ListToolsRequestSchema, async () => {
return {
tools: [{
name: "my-tool",
description: "Does something useful",
inputSchema: {
type: "object",
properties: { query: { type: "string" } },
required: ["query"]
}
}]
};
});
server.setRequestHandler(CallToolRequestSchema, async (request) => {
if (request.params.name === "my-tool") {
return { content: [{ type: "text", text: "Result" }] };
}
throw new Error("Tool not found");
});
const transport = new StdioServerTransport();
await server.connect(transport);
Pros
- ✅ Official Anthropic implementation
- ✅ Well-documented and maintained
- ✅ Full MCP specification compliance
- ✅ TypeScript SDK with excellent type safety
- ✅ Streaming support for real-time updates
- ✅ Active development and community
- ✅ Reference implementation for custom servers
Cons
- ❌ Requires Anthropic API key
- ❌ Primarily designed for Claude integration
- ❌ Limited built-in tools (focus on extensibility)
- ❌ TypeScript-focused (Python SDK in development)
When to Use
- Integrating Claude with external tools — Official Anthropic path
- Building custom MCP servers — Reference implementation
- Standardized AI tool integration — MCP protocol compliance
- Production Claude Desktop integrations — Battle-tested implementation
