MCP Server Setup Guide
The Model Context Protocol (MCP) is an open protocol that enables AI applications to connect to external tools and data sources. This guide walks you through installing and configuring MCP servers.
Prerequisites
Verify installations:
node -v
python --version
git --version
What Is MCP?
MCP provides a standardized way for AI models and agents to interact with external systems through:
- Tools — Executable functions (e.g., file read/write, API calls, database queries)
- Resources — Readable data sources (e.g., files, API responses, documents)
- Prompts — Pre-defined prompt templates
Installation Methods
Method 1: npm (Node.js Servers)
Install MCP servers published to npm:
npx -y @modelcontextprotocol/server-git
npx -y @modelcontextprotocol/server-puppeteer
Method 2: pip (Python Servers)
Install MCP servers published to PyPI:
pip install mcp-server-git
pip install mcp-server-puppeteer
Method 3: From Source
Clone and build an MCP server from its repository:
git clone https://github.com/modelcontextprotocol/servers.git
cd servers
npm install
npm run build
Running an MCP Server
Standalone (stdio transport)
Most MCP servers communicate over stdin/stdout:
npx -y @modelcontextprotocol/server-git
HTTP/SSE Transport
Some servers support remote connections:
npx -y @modelcontextprotocol/server-everything --port 3001
Then connect to http://localhost:3001.
Configuring MCP Clients
Claude Desktop
Add MCP servers to your Claude Desktop config file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
Mac: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/directory"]
},
"git": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-git"]
}
}
}
Restart Claude Desktop after editing the config.
Cursor IDE
Add MCP servers to your Cursor settings:
- Open Settings > Features > MCP
- Click Add new MCP server
- Provide a name and command with arguments
Or edit settings.json directly:
{
"mcp": {
"servers": {
"my-server": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
}
}
}
}
VS Code (with MCP extension)
- Install the MCP for VS Code extension
- Open Command Palette (
Ctrl+Shift+P) > MCP: Configure Servers - Add your server configuration
OpenCode
OpenCode has built-in MCP support. Configure via your project's or global opencode config (opencode.json):
{
"mcpServers": {
"example-server": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-example"]
}
}
}
Popular MCP Servers
| Server | Description | Install Command |
|---|---|---|
server-filesystem | Read/write files on disk | npx -y @modelcontextprotocol/server-filesystem |
server-git | Git operations (status, log, diff) | npx -y @modelcontextprotocol/server-git |
server-puppeteer | Browser automation via Puppeteer | npx -y @modelcontextprotocol/server-puppeteer |
server-sqlite | Query SQLite databases | pip install mcp-server-sqlite |
server-fetch | HTTP requests to URLs | npx -y @modelcontextprotocol/server-fetch |
server-brave-search | Brave web search | npx -y @modelcontextprotocol/server-brave-search |
server-slack | Slack workspace integration | npx -y @modelcontextprotocol/server-slack |
server-sequentialthinking | Structured reasoning chains | npx -y @modelcontextprotocol/server-sequentialthinking |
Environment Variables
Some MCP servers require API keys or configuration via environment variables.
Example: Brave Search
{
"mcpServers": {
"brave-search": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-brave-search"],
"env": {
"BRAVE_API_KEY": "your-brave-api-key"
}
}
}
}
Example: Slack
{
"mcpServers": {
"slack": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-slack"],
"env": {
"SLACK_BOT_TOKEN": "xoxb-your-bot-token",
"SLACK_TEAM_ID": "T01234567"
}
}
}
}
Set environment variables in your shell for persistent configuration:
Windows (PowerShell):
$env:BRAVE_API_KEY = "your-key"
macOS/Linux:
export BRAVE_API_KEY="your-key"
Debugging
Enable Debug Logging
Set the DEBUG environment variable to see MCP traffic:
DEBUG=mcp:* npx -y @modelcontextprotocol/server-git
Common Issues
| Problem | Solution |
|---|---|
| Server won't start | Verify Node.js/Python version meets requirements |
| Permission denied | Check file/directory permissions for filesystem servers |
| API key errors | Confirm env values in your client config |
| Connection timeout | Ensure the server command runs without blocking |
| Module not found | Run npm install in the server directory first |
Inspect Server Capabilities
Use the MCP Inspector to test servers interactively:
npx @modelcontextprotocol/inspector
Follow the prompts to connect to a local MCP server and explore its tools, resources, and prompts.
Security Considerations
- Filesystem access — Restrict filesystem servers to specific directories, never expose your entire disk
- API keys — Never commit API keys to version control; use environment variables or secret managers
- Network exposure — Avoid exposing MCP servers over public networks; use local connections or authenticated transports
- Tool permissions — Review which tools each server exposes and limit access based on your threat model