Skip to main content

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:

  1. Open Settings > Features > MCP
  2. Click Add new MCP server
  3. 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)​

  1. Install the MCP for VS Code extension
  2. Open Command Palette (Ctrl+Shift+P) > MCP: Configure Servers
  3. 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"]
}
}
}
ServerDescriptionInstall Command
server-filesystemRead/write files on disknpx -y @modelcontextprotocol/server-filesystem
server-gitGit operations (status, log, diff)npx -y @modelcontextprotocol/server-git
server-puppeteerBrowser automation via Puppeteernpx -y @modelcontextprotocol/server-puppeteer
server-sqliteQuery SQLite databasespip install mcp-server-sqlite
server-fetchHTTP requests to URLsnpx -y @modelcontextprotocol/server-fetch
server-brave-searchBrave web searchnpx -y @modelcontextprotocol/server-brave-search
server-slackSlack workspace integrationnpx -y @modelcontextprotocol/server-slack
server-sequentialthinkingStructured reasoning chainsnpx -y @modelcontextprotocol/server-sequentialthinking

Environment Variables​

Some MCP servers require API keys or configuration via environment variables.

{
"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​

ProblemSolution
Server won't startVerify Node.js/Python version meets requirements
Permission deniedCheck file/directory permissions for filesystem servers
API key errorsConfirm env values in your client config
Connection timeoutEnsure the server command runs without blocking
Module not foundRun 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