Build Your First MCP Server in 10 Minutes
Last updated March 2026 · 10 min read
This guide walks you through creating a simple MCP server that exposes a tool to Claude Desktop. By the end, Claude will be able to call your custom tool and return results. Choose TypeScript or Python — both take about 10 minutes.
Prerequisites
- Node.js 20+ (for TypeScript) or Python 3.10+ (for Python)
- Claude Desktop installed (download here)
- A text editor
Option A: TypeScript
Step 1: Create the project
mkdir my-mcp-server && cd my-mcp-server
npm init -y
npm install @modelcontextprotocol/sdk Step 2: Write the server
Create server.ts:
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
const server = new McpServer({
name: 'my-first-server',
version: '1.0.0',
});
// Define a simple tool
server.tool(
'greet',
'Greet someone by name',
{ name: { type: 'string', description: 'Name to greet' } },
async ({ name }) => ({
content: [{ type: 'text', text: `Hello, ${name}! This response came from your MCP server.` }],
}),
);
// Start the server
const transport = new StdioServerTransport();
server.connect(transport);
console.error('MCP server running on stdio'); Step 3: Configure Claude Desktop
Open your Claude Desktop config file. Use our Config Generator to create the correct format, or add this manually:
{
"mcpServers": {
"my-first-server": {
"command": "npx",
"args": ["-y", "tsx", "/absolute/path/to/server.ts"]
}
}
} Config file locations:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Step 4: Test it
Restart Claude Desktop. In a new conversation, ask: "Use the greet tool to say hello to Alice." Claude will call your MCP server's greet tool and display the result.
Option B: Python
Step 1: Install the SDK
pip install "mcp[cli]" Step 2: Write the server
Create server.py:
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("my-first-server")
@mcp.tool()
async def greet(name: str) -> str:
"""Greet someone by name.
Args:
name: The name of the person to greet.
"""
return f"Hello, {name}! This response came from your MCP server."
if __name__ == "__main__":
mcp.run(transport="stdio") Step 3: Configure Claude Desktop
{
"mcpServers": {
"my-first-server": {
"command": "python",
"args": ["/absolute/path/to/server.py"]
}
}
} What's Next?
- Add more tools — each
server.tool()call defines a new capability Claude can use. - Validate your tool schemas to catch errors before deployment.
- Use our Server Template Generator to scaffold a full server with multiple tools.
- Browse the official MCP servers for inspiration.