How to Use Claude Code: MCP (Model Context Protocol) Setup Guide

5 min read

MCP servers extend Claude Code's capabilities by providing additional tools and integrations. This guide will show you how to use Claude Code effectively with MCP servers, and why many developers prefer Claude Code vs Cursor for AI-assisted development.

Overview

When comparing Claude Code vs Cursor, one of Claude Code's standout features is its extensibility through MCP servers. These servers allow you to add custom tools and integrations, making Claude Code a powerful choice for developers who need specialized capabilities.

Configuration Location

To use Claude Code with MCP servers, you'll need to configure them in:

/root/.claude/claude_mcp_config.json

Adding MCP Servers

Method 1: CLI (Recommended)

The easiest way to use Claude Code with MCP servers is through the CLI:

claude mcp add <server-name> -s user -e ENV_VAR=$VALUE -- <command> <args>

Example:

# Example with dummy key
claude mcp add my-server -s user -e API_KEY=DUMMY_API_KEY_123456 -- python /opt/my-server/main.py

Method 2: Direct Configuration File

For those learning how to use Claude Code, you can also edit the configuration file directly:

{
  "mcpServers": {
    "perplexity": {
      "command": "node",
      "args": ["/path/to/perplexity-server/build/index.js"],
      "env": {
        "PERPLEXITY_API_KEY": "YOUR_API_KEY_HERE"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

Configuration Options

  • command – Executable used to launch the server (e.g. node, python, npx)
  • args – Array of arguments passed to the command
  • env – Environment variables exported for the server
  • disabledtrue deactivates the server without deleting the entry
  • autoApprove – List of tool patterns that are auto-approved

Managing MCP Servers

Once you know how to use Claude Code with MCP servers, managing them is straightforward:

List configured servers:

claude mcp list

Remove a server:

claude mcp remove <server-name>

Popular MCP Servers

Here are some popular MCP servers that showcase why developers choose Claude Code vs Cursor:

  • mcp-server-fetch – Web fetching capabilities
  • mcp-server-github – GitHub integration
  • mcp-server-filesystem – Enhanced file operations
  • perplexity-mcp – AI-powered search and research

Visit modelcontextprotocol.io for more servers and detailed documentation on how to use Claude Code effectively.

The Bottom Line

MCP servers make Claude Code incredibly extensible. Whether you're comparing Claude Code vs Cursor or just learning how to use Claude Code, mastering MCP configuration will significantly enhance your AI-assisted development workflow.