Claude Desktop MCP Setup: Complete Tutorial for Model Context Protocol
Learn how to set up and configure MCP servers with Claude Desktop. Install your first server, explore popular options, and build custom MCP integrations.
MCP (Model Context Protocol) lets Claude Desktop connect to external tools and data sources. Configure MCP servers by editing the `claude_desktop_config.json` file in your settings, adding server entries with their command and arguments, then restarting Claude Desktop.
Understanding MCP
The Model Context Protocol (MCP) is an open standard developed by Anthropic that enables AI models to securely interact with external tools, data sources, and services. Think of it as a universal connector that lets Claude Desktop reach beyond its built-in capabilities.
How MCP Works
MCP follows a client-server architecture:
- MCP Client: Built into Claude Desktop, it manages connections to MCP servers
- MCP Server: A lightweight program that exposes tools, resources, and prompts to the client
- Transport: Communication happens via stdio (standard input/output) for local servers or HTTP/SSE for remote servers
Your First MCP Server
Prerequisites
Before setting up MCP servers, ensure you have:
- Claude Desktop installed and running
- Node.js 18+ installed (for npm-based MCP servers)
- Python 3.10+ (for Python-based MCP servers)
- A basic understanding of JSON configuration
Step 1: Locate the Configuration File
The MCP configuration file is located at:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Step 2: Add the Filesystem Server
The filesystem MCP server is the simplest way to get started. It allows Claude to read and write files on your computer.
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@anthropic-ai/mcp-server-filesystem",
"/Users/yourname/projects",
"/Users/yourname/documents"
]
}
}
}
Replace the paths with directories you want Claude to access. You can list multiple directories.
Step 3: Restart Claude Desktop
After saving the configuration file, restart Claude Desktop completely (quit and reopen). You should see a hammer icon in the bottom-right of the chat input, indicating that MCP tools are available.
Step 4: Test the Connection
Try asking Claude:
- "List the files in my projects directory"
- "Read the contents of README.md in my projects folder"
- "Create a new file called notes.txt with today's date"
Popular MCP Servers
GitHub
Interact with GitHub repositories, create issues, review pull requests, and manage code:
{
"github": {
"command": "npx",
"args": ["-y", "@anthropic-ai/mcp-server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "your_token_here"
}
}
}
PostgreSQL
Query PostgreSQL databases directly from Claude:
{
"postgres": {
"command": "npx",
"args": ["-y", "@anthropic-ai/mcp-server-postgres", "postgresql://user:pass@localhost:5432/mydb"]
}
}
Brave Search
Enable web search capabilities:
{
"brave-search": {
"command": "npx",
"args": ["-y", "@anthropic-ai/mcp-server-brave-search"],
"env": {
"BRAVE_API_KEY": "your_api_key_here"
}
}
}
Slack
Read and send Slack messages from Claude:
{
"slack": {
"command": "npx",
"args": ["-y", "@anthropic-ai/mcp-server-slack"],
"env": {
"SLACK_BOT_TOKEN": "xoxb-your-token",
"SLACK_TEAM_ID": "T-your-team-id"
}
}
}
Google Drive
Access and search Google Drive files:
{
"google-drive": {
"command": "npx",
"args": ["-y", "@anthropic-ai/mcp-server-google-drive"],
"env": {
"GOOGLE_OAUTH_CLIENT_ID": "your_client_id",
"GOOGLE_OAUTH_CLIENT_SECRET": "your_client_secret"
}
}
}
Memory
Persistent memory across conversations using a knowledge graph:
{
"memory": {
"command": "npx",
"args": ["-y", "@anthropic-ai/mcp-server-memory"]
}
}
Building Custom MCP Servers
You can create your own MCP servers to connect Claude to any tool or data source.
TypeScript/Node.js Server
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
const server = new McpServer({ name: "my-custom-server", version: "1.0.0" });
server.tool("hello", { name: z.string() }, async ({ name }) => ({
content: [{ type: "text", text: Hello, ${name}! }],
}));
const transport = new StdioServerTransport();
await server.connect(transport);
Python Server
from mcp.server import Server
from mcp.types import Tool, TextContent
server = Server("my-custom-server")
@server.list_tools()
async def list_tools():
return [Tool(name="hello", description="Say hello")]
@server.call_tool()
async def call_tool(name, arguments):
return [TextContent(type="text", text=f"Hello, {arguments['name']}!")]
Security Considerations
When using MCP servers, keep these security practices in mind:
- Principle of Least Privilege: Only grant MCP servers access to the directories and APIs they need
- Review Server Code: Before installing a third-party MCP server, review its source code for security issues
- Environment Variables: Store API keys and tokens in environment variables, not hardcoded in config
- Network Access: Be cautious with MCP servers that make network requests to external services
- Regular Updates: Keep MCP server packages updated to get security patches
- Audit Logs: Monitor what actions MCP servers perform on your behalf
Troubleshooting MCP Issues
Server not appearing:- Verify JSON syntax in your config file
- Ensure the command and args are correct
- Check that required packages are installed
- Verify file/directory permissions for filesystem server
- Check API keys and tokens are valid
- Ensure the server has network access if needed
- Check the Developer console for error messages
- Try running the server command manually in the terminal
- Ensure all dependencies are installed
Conclusion
MCP servers transform Claude Desktop from a powerful chat interface into a versatile AI assistant that can interact with your entire digital workspace. Start with the filesystem server, explore popular community servers, and gradually build your custom integrations for maximum productivity.