The MCP Anthropic Server provides tools for interacting with Anthropic's experimental prompt engineering APIs, allowing you to generate, improve, and templatize prompts. This server follows the Model Context Protocol (MCP) for standardized communication.
Navigate to the project directory:
cd mcp-anthropic
Install dependencies:
npm install
Configure API Key:
Create a .env
file in the project root and add your Anthropic API key:
ANTHROPIC_KEY=your_anthropic_api_key_here
Build the TypeScript code:
npm run build
Start the server:
npm start
The server will start and listen for MCP connections, displaying which tools are registered.
The generate_prompt
tool creates a prompt based on a task description.
Example Usage:
{
"task": "a chef for a meal prep planning service",
"target_model": "claude-3-opus-20240229"
}
The improve_prompt
tool enhances an existing prompt based on provided feedback.
Example Usage:
{
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Help me plan meals for the week."
}
]
}
],
"feedback": "Make it more detailed and include nutrition considerations",
"target_model": "claude-3-opus-20240229"
}
The templatize_prompt
tool converts a concrete prompt example into a reusable template.
Example Usage:
{
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Create a meal plan for a family of 4 with dietary restrictions including gluten-free and dairy-free options."
}
]
}
]
}
{
"type": "object",
"properties": {
"task": {
"type": "string",
"description": "A description of the task the prompt should be designed for."
},
"target_model": {
"type": "string",
"description": "The target Anthropic model identifier."
}
},
"required": ["task", "target_model"]
}
{
"type": "object",
"properties": {
"messages": {
"type": "array",
"items": {
"type": "object",
"properties": {
"role": { "type": "string" },
"content": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": { "type": "string" },
"text": { "type": "string" }
},
"required": ["type", "text"]
}
}
},
"required": ["role", "content"]
}
},
"system": {
"type": "string"
},
"feedback": {
"type": "string"
},
"target_model": {
"type": "string"
}
},
"required": ["messages", "feedback", "target_model"]
}
{
"type": "object",
"properties": {
"messages": {
"type": "array",
"items": {
"type": "object",
"properties": {
"role": { "type": "string" },
"content": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": { "type": "string" },
"text": { "type": "string" }
},
"required": ["type", "text"]
}
}
},
"required": ["role", "content"]
}
},
"system": {
"type": "string"
}
},
"required": ["messages"]
}
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "mcp-anthropic" '{"command":"npm","args":["start"],"cwd":"./mcp-anthropic"}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"mcp-anthropic": {
"command": "npm",
"args": [
"start"
],
"cwd": "./mcp-anthropic"
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"mcp-anthropic": {
"command": "npm",
"args": [
"start"
],
"cwd": "./mcp-anthropic"
}
}
}
3. Restart Claude Desktop for the changes to take effect