This guide covers how to configure and use MCP servers with popular AI host applications. Each host has its own configuration approach, but once set up, they all communicate with MCP servers using the standardized protocol.
An MCP Host is an AI application that can connect to MCP servers to extend its capabilities. Think of it as the "front end" that users interact with, while MCP servers provide the "back end" tools and data.
flowchart LR
User[👤 User] --> Host[🖥️ MCP Host]
Host --> S1[MCP Server A]
Host --> S2[MCP Server B]
Host --> S3[MCP Server C]
subgraph "Popular Hosts"
H1[Claude Desktop]
H2[VS Code]
H3[Cursor]
H4[Cline]
H5[Windsurf]
end
- An MCP server to connect to (see Module 3.1 - First Server)
- The host application installed on your system
- Basic familiarity with JSON configuration files
Claude Desktop is Anthropic's official desktop application that natively supports MCP.
- Download Claude Desktop from claude.ai/download
- Install and sign in with your Anthropic account
Claude Desktop uses a JSON configuration file to define MCP servers.
Configuration file location:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
Example configuration:
{
"mcpServers": {
"calculator": {
"command": "python",
"args": ["-m", "mcp_calculator_server"],
"env": {
"PYTHONPATH": "/path/to/your/server"
}
},
"weather": {
"command": "node",
"args": ["/path/to/weather-server/build/index.js"]
},
"database": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {
"DATABASE_URL": "postgresql://user:pass@localhost/mydb"
}
}
}
}| Field | Description | Example |
|---|---|---|
command |
The executable to run | "python", "node", "npx" |
args |
Command line arguments | ["-m", "my_server"] |
env |
Environment variables | {"API_KEY": "xxx"} |
cwd |
Working directory | "/path/to/server" |
- Save the configuration file
- Restart Claude Desktop completely (quit and reopen)
- Open a new conversation
- Look for the 🔌 icon indicating connected servers
- Try asking Claude to use one of your tools
Server not appearing:
- Check the configuration file syntax with a JSON validator
- Ensure the command path is correct
- Check Claude Desktop logs: Help → Show Logs
Server crashes on startup:
- Test your server manually in terminal first
- Check environment variables are set correctly
- Ensure all dependencies are installed
VS Code supports MCP through GitHub Copilot Chat extensions.
- VS Code 1.99+ installed
- GitHub Copilot extension installed
- GitHub Copilot Chat extension installed
VS Code uses .vscode/mcp.json in your workspace or user settings.
Workspace configuration (.vscode/mcp.json):
{
"servers": {
"my-calculator": {
"type": "stdio",
"command": "python",
"args": ["-m", "mcp_calculator_server"]
},
"my-database": {
"type": "sse",
"url": "http://localhost:8080/sse"
}
}
}User settings (settings.json):
{
"mcp.servers": {
"global-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-memory"]
}
},
"mcp.enableLogging": true
}- Open the Copilot Chat panel (Ctrl+Shift+I / Cmd+Shift+I)
- Type
@to see available MCP tools - Use natural language to invoke tools: "Calculate 25 * 48 using the calculator"
MCP servers not loading:
- Check Output panel → "MCP" for error logs
- Reload window: Ctrl+Shift+P → "Developer: Reload Window"
- Verify the server runs standalone first
Cursor is an AI-first code editor with built-in MCP support.
- Download Cursor from cursor.sh
- Install and sign in
Cursor uses a similar configuration format to Claude Desktop.
Configuration file location:
- macOS:
~/.cursor/mcp.json - Windows:
%USERPROFILE%\.cursor\mcp.json - Linux:
~/.cursor/mcp.json
Example configuration:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/directory"]
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "ghp_your_token_here"
}
}
}
}- Open Cursor's AI chat (Ctrl+L / Cmd+L)
- MCP tools appear automatically in suggestions
- Ask the AI to perform tasks using connected servers
Cline is a terminal-based MCP client, ideal for command-line workflows.
npm install -g @anthropic/clineCline uses environment variables and command-line arguments.
Using environment variables:
export ANTHROPIC_API_KEY="your-api-key"
export MCP_SERVER_CALCULATOR="python -m mcp_calculator_server"Using command-line arguments:
cline --mcp-server "calculator:python -m mcp_calculator_server" \
--mcp-server "weather:node /path/to/weather/index.js"Configuration file (~/.clinerc):
{
"apiKey": "your-api-key",
"mcpServers": {
"calculator": {
"command": "python",
"args": ["-m", "mcp_calculator_server"]
}
}
}# Start an interactive session
cline
# Single query with MCP
cline "Calculate the square root of 144 using the calculator"
# List available tools
cline --list-toolsWindsurf is another AI-powered code editor with MCP support.
- Download Windsurf from codeium.com/windsurf
- Install and create an account
Windsurf configuration is managed through the settings UI:
- Open Settings (Ctrl+, / Cmd+,)
- Search for "MCP"
- Click "Edit in settings.json"
Example configuration:
{
"windsurf.mcp.servers": {
"my-tools": {
"command": "python",
"args": ["/path/to/server.py"],
"env": {}
}
},
"windsurf.mcp.enabled": true
}Different hosts support different transport mechanisms:
| Host | stdio | SSE/HTTP | WebSocket |
|---|---|---|---|
| Claude Desktop | ✅ | ❌ | ❌ |
| VS Code | ✅ | ✅ | ❌ |
| Cursor | ✅ | ✅ | ❌ |
| Cline | ✅ | ✅ | ❌ |
| Windsurf | ✅ | ✅ | ❌ |
stdio (standard input/output): Best for local servers started by the host SSE/HTTP: Best for remote servers or servers shared between multiple clients
-
Test the server manually first:
# For Python python -m your_server_module # For Node.js node /path/to/server/index.js
-
Check the command path:
- Use absolute paths when possible
- Ensure the executable is in your PATH
-
Verify dependencies:
# Python pip list | grep mcp # Node.js npm list @modelcontextprotocol/sdk
- Check server logs - Most hosts have logging options
- Verify tool registration - Use MCP Inspector to test
- Check permissions - Some tools need file/network access
- Some hosts sanitize environment variables
- Use the
envconfiguration field explicitly - Avoid sensitive data in config files (use secrets management)
- Never commit API keys to configuration files
- Use environment variables for sensitive data
- Limit server permissions to only what's needed
- Review server code before granting access to your system
- Use allowlists for file system and network access