xavier collantes

Connecting to MCP Servers

By Xavier Collantes

8/24/2025


Claude logo MCP logo
The Model Context Protocol (MCP) enables LLM clients to connect to external tools and data sources. This guide covers the technical details of setting up MCP connections for Claude Desktop and Cursor.
Related Article

For background on why and when to use MCPs, see my intro blog on MCPs.

Claude Desktop Setup (Chatbot UI)

Desktop Extensions (.dxt) provide one-click installation for supported MCP servers.
Steps:
  1. Open Claude Desktop
  2. Navigate to Settings > Extensions
  3. Browse available extensions and click Install
  4. Extensions auto-update by default

Desktop Extensions include a built-in Node.js environment, eliminating the need for manual Node.js installation.

Method 2: Manual Configuration

For custom servers or advanced setups, use the configuration file method.
Prerequisites:

Verify Node.js installation (LTS version recommended).

Bash
1node --version
2npm --version
3
Verify Node.js installation (LTS version recommended). hosted withby Xavier
Configuration Steps:
  1. Open Claude Desktop
  2. Go to File > Settings > Developer
  3. Click Edit Config to open claude_desktop_config.json
  4. Add your MCP server configuration
Example Configuration:
JSON
1{
2  "mcpServers": {
3    "github": {
4      "command": "npx",
5      "args": ["-y", "@modelcontextprotocol/server-github"],
6      "env": {
7        "GITHUB_PERSONAL_ACCESS_TOKEN": "your_token_here"
8      }
9    },
10    "filesystem": {
11      "command": "npx",
12      "args": [
13        "-y",
14        "@modelcontextprotocol/server-filesystem",
15        "/path/to/allowed/directory"
16      ],
17      "env": {}
18    }
19  }
20}
21
snippet hosted withby Xavier
Verification:
  1. Completely quit and restart Claude Desktop
  2. Look for the MCP server indicator in the chat input
  3. Click the tools icon to see available MCP tools

Configuration changes require a complete restart of Claude Desktop. Simply refreshing the conversation will not load new servers.

Cursor Setup

Method 1: One-Click Installation (2025)

Cursor now supports pre-configured MCP servers with OAuth authentication.
Steps:
  1. Open Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
  2. Search for "Cursor Settings"
  3. Navigate to MCP Servers and enable the feature
  4. Browse and install available servers with one-click

Method 2: Configuration Files

Create MCP configuration files for custom setups.
Global Configuration (applies to all workspaces):

Create global MCP config.

Bash
1mkdir -p ~/.cursor
2touch ~/.cursor/mcp.json
3
Create global MCP config. hosted withby Xavier
Project-Specific Configuration:

Create project-specific config.

Bash
1mkdir -p .cursor
2touch .cursor/mcp.json
3
Create project-specific config. hosted withby Xavier
Example MCP Configuration:
JSON
1{
2  "mcpServers": {
3    "web-search": {
4      "command": "npx",
5      "args": ["-y", "@modelcontextprotocol/server-brave-search"],
6      "env": {
7        "BRAVE_API_KEY": "your_api_key_here"
8      }
9    },
10    "database": {
11      "command": "npx",
12      "args": ["-y", "@modelcontextprotocol/server-postgres"],
13      "env": {
14        "POSTGRES_CONNECTION_STRING": "postgresql://user:password@localhost:5432/dbname"
15      }
16    }
17  }
18}
19
snippet hosted withby Xavier
Transport Types:
Cursor supports three transport mechanisms:
  1. stdio (Standard Input/Output) - Default, simpler for local development
  2. SSE (Server-Sent Events) - HTTP-based, better for distributed teams
  3. WebSocket - Real-time bidirectional communication
Example With SSE Transport:
JSON
1{
2  "mcpServers": {
3    "remote-server": {
4      "url": "https://your-mcp-server.com/sse",
5      "transport": "sse",
6      "headers": {
7        "Authorization": "Bearer your_token"
8      }
9    }
10  }
11}
12
snippet hosted withby Xavier

Project-specific configurations override global ones. Use project configs for tools specific to a codebase.

Authentication And Environment Variables

Both clients support secure credential management through environment variables.
Secure Token Storage:
JSON
1{
2  "mcpServers": {
3    "slack": {
4      "command": "npx",
5      "args": ["-y", "@modelcontextprotocol/server-slack"],
6      "env": {
7        "SLACK_BOT_TOKEN": "${SLACK_BOT_TOKEN}",
8        "SLACK_TEAM_ID": "${SLACK_TEAM_ID}"
9      }
10    }
11  }
12}
13
snippet hosted withby Xavier
Environment Setup:

Add to ~/.bashrc or ~/.zshrc.

Bash
1export SLACK_BOT_TOKEN="xoxb-your-token-here"
2export SLACK_TEAM_ID="T1234567890"
3
Add to ~/.bashrc or ~/.zshrc. hosted withby Xavier

Never hardcode API keys in configuration files. Always use environment variables or OAuth when available.

Development Tools

  • GitHub: Repository management, issue tracking
  • GitLab: CI/CD pipeline integration

Data Sources

  • PostgreSQL: Database queries and schema inspection
  • SQLite: Local database operations
  • Google Drive: File management and search

Web Services

  • Slack: Channel management and messaging
  • Notion: Page creation and content management
  • Brave Search: Real-time web search capabilities

See More

Related Article

See my blog on MCP popular servers.

Installation Example:
Bash
1# Using Composio for quick setup
2npx @composio/mcp@latest setup "https://mcp.composio.dev/github" --client cursor
3
snippet hosted withby Xavier

Common Pitfalls

.claude.json Scope
Field may not exist in the .claude.json file but use the outer most mcpServers field for user scoped servers.
Claude Desktop:
  • Server not appearing: Ensure complete restart after config changes
  • Permission errors: Check file paths and environment variables
  • Node.js issues: Verify LTS version installation

Claude Code and Claude Desktop use different MCP server configurations. You will need to configure both if you want to use an MCP for each.

Cursor:
  • MCP option missing: Update to latest Cursor version
  • OAuth failures: Clear browser cache and re-authenticate
  • Transport errors: Verify network connectivity for remote servers

Debugging Commands

Check MCP server installation.

Bash
1npx @modelcontextprotocol/server-github --version
2
3# Validate JSON configuration.
4cat ~/.cursor/mcp.json | json_pp
5
6# Test environment variables.
7echo $GITHUB_PERSONAL_ACCESS_TOKEN
8
Check MCP server installation. hosted withby Xavier

MCP servers are still in active development. Check server documentation for the latest setup instructions and supported features.

Log Analysis

Claude Desktop logs (macOS):
Bash
1tail -f ~/Library/Logs/Claude/claude.log
2
snippet hosted withby Xavier
Cursor logs:
Bash
1# Access through Command Palette > "Developer: Show Logs"
2
snippet hosted withby Xavier

Security Considerations

  • Use environment variables for sensitive credentials
  • Limit filesystem access to specific directories only
  • Regularly rotate API keys and tokens
  • Use project-specific configs for sensitive projects

MCP servers can access your local filesystem and external APIs. Only install servers from trusted sources and review their permissions carefully.

Further Reading

Related Articles

Related by topics:

llm
ai
ml
machine-learning
How I Built My Own MCP Server

MCP server for embedding free stock images in Claude Code.

By Xavier Collantes8/24/2025
thingsIBuilt
llm
ai
+7

HomeFeedback