How to Set Up MCP Servers in Claude Code and Cursor

Add MCP servers to Claude Code with one CLI command or to Cursor via mcp.json — complete 2026 setup for GitHub, filesystem, and remote HTTP servers.

Mahmudul Haque Qudrati — CEO & ML Engineer at Pristren

Mahmudul Haque Qudrati

CEO & ML Engineer

June 6, 2026
6 min read
How to Set Up MCP Servers in Claude Code and Cursor

Add MCP servers to Claude Code with claude mcp add or to Cursor by editing mcp.json — both take about five minutes for a first GitHub or filesystem server. MCP tools only appear in Cursor Agent mode; Claude Code exposes them in every session after connect.


Prerequisites

  • Node.js 18+ (most official MCP servers are TypeScript/npm packages)
  • Claude Code installed (npm i -g @anthropic-ai/claude-code) or Cursor with Agent mode enabled
  • API keys for remote services (GitHub PAT, etc.) in environment variables — never in committed config

Claude Code Setup

Claude Code has the simplest flow:

bash
# List configured servers
claude mcp list

# Add GitHub MCP (example — check official docs for current package name)
claude mcp add github -- npx -y @modelcontextprotocol/server-github

# Add project-scoped server via .mcp.json in repo root

Example .mcp.json at project root:

json
{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_PERSONAL_ACCESS_TOKEN}"
      }
    }
  }
}

Use claude mcp add when possible — it validates config. Remote HTTP servers with OAuth use --transport http and browser auth flows documented in Claude Code MCP docs.


Cursor Setup

  1. Open Cursor Settings → MCP or edit ~/.cursor/mcp.json directly
  2. Add server entries matching the MCP schema (command, args, env)
  3. Restart Cursor
  4. Open Agent mode (not regular chat) and confirm tools appear in the tool list

Project-level: .cursor/mcp.json overrides or extends global config for that repo only.


Start with low-risk, high-value servers:

  1. Filesystem — scoped read/write under project directories
  2. GitHub — issues, PRs, code search
  3. Playwright — browser automation for E2E checks
  4. Your database — read-only staging replica with tight credentials

Add one server at a time. Verify tool calls work before stacking more — each server increases context cost.


OAuth and Remote Servers

Enterprise MCP servers often run as remote HTTP endpoints with OAuth 2.0. Claude Code walks browser login; tokens stay in the client credential store. For teams, use a shared gateway with audit logging rather than personal PATs on every laptop.


Troubleshooting

SymptomFix
Tools missing in CursorSwitch to Agent mode; restart IDE
command not foundUse full path to npx/node; check Node version
Auth errorsRotate token; confirm env var names match server docs
Session feels slowToo many servers — disable unused ones

For token usage when MCP is connected, read Why Does MCP Use So Many Tokens?.


What Is MCP and Why Set It Up?

MCP (Model Context Protocol) is an open standard that lets AI assistants like Claude Code and Cursor interact with external tools and data sources. Instead of copying code manually or pasting API responses, you connect servers that provide structured tools — like reading files, querying databases, or managing GitHub issues. Setting up MCP servers turns your AI from a chat partner into an autonomous agent that can act on your codebase.

In 2026, MCP has become the default way to extend AI capabilities in development workflows. Every major IDE and CLI tool supports it. The setup is straightforward: define a server with a command and environment variables, and the AI discovers available tools automatically.


How Does MCP Work in Claude Code and Cursor?

Both tools implement the MCP specification but differ in how you configure and use servers.

Claude Code uses a global config file at ~/.claude/settings.json or a project-level .mcp.json. When you start a session, Claude Code loads all configured servers and exposes their tools in every conversation. You can add servers via CLI (claude mcp add) or by editing the JSON directly. The CLI validates your configuration before saving.

Cursor uses ~/.cursor/mcp.json for global servers and .cursor/mcp.json for project-specific ones. MCP tools are only available in Agent mode (not regular chat). After adding a server, you must restart Cursor. Agent mode shows available tools in a dropdown — you can see which functions the AI can call.

Both tools support the same MCP schema: command, args, env, and optional transport for HTTP servers. The key difference is that Claude Code is CLI-first, while Cursor is IDE-first with a visual settings panel.


Best Practices for MCP Server Setup

  1. Use environment variables for secrets — never hardcode tokens in config files. Claude Code and Cursor both support ${VAR_NAME} interpolation from your shell environment.
  2. Scope filesystem servers — restrict read/write to specific directories. A filesystem server with access to your entire home directory is a security risk.
  3. Start with one server — each server adds context tokens. Too many servers can slow down responses and increase costs.
  4. Use official packages — prefer @modelcontextprotocol/* servers from npm. Community servers may have security issues.
  5. Test tool calls — after setup, ask the AI to perform a simple action (e.g., "list files in current directory") to verify the server works.
  6. Keep Node.js updated — MCP servers rely on Node.js 18+ features. Older versions may fail silently.

Cost of MCP Servers in 2026

MCP servers themselves are free and open source. The cost comes from token usage: each tool call consumes input and output tokens. For example, a GitHub server that fetches a list of issues might use 500-1000 tokens per call. If you have 5 servers active, the AI may call multiple tools per query, multiplying token consumption.

Typical monthly costs:

  • Personal use (1-2 servers, occasional calls): $5-15 in API tokens
  • Team use (3-5 servers, daily calls): $50-200 in API tokens
  • Enterprise (10+ servers, heavy automation): $500+ in API tokens

To reduce costs, disable unused servers and use read-only replicas for databases. Some teams implement token budgets per server.


Is MCP Worth It in 2026?

Absolutely — if you use AI for development. MCP transforms AI from a text generator into an autonomous coding assistant that can read your codebase, run tests, create PRs, and manage infrastructure. The setup cost is minimal (5 minutes per server), and the productivity gains are significant.

However, MCP is not magic. It works best when:

  • You have well-defined tasks (e.g., "fix this bug" or "add a new endpoint")
  • Your codebase is modular and testable
  • You use servers that match your workflow (GitHub, filesystem, database)

For ad-hoc questions or one-off scripts, MCP adds unnecessary overhead. Use it where automation saves time.


Keep Reading


Pristren builds AI-powered software for teams. Zlyqor is our all-in-one workspace — chat, projects, time tracking, AI meeting summaries, and invoicing.

Frequently Asked Questions

What is MCP and how do I set it up in Claude Code and Cursor?

MCP (Model Context Protocol) is an open standard that allows AI assistants to interact with external tools and data sources. To set it up in Claude Code, use `claude mcp add` or edit `.mcp.json`. In Cursor, edit `~/.cursor/mcp.json` or use Settings → MCP, then restart and switch to Agent mode.

How does MCP work in Claude Code and Cursor?

Both tools load MCP servers from JSON config files. Claude Code exposes tools in every session; Cursor only in Agent mode. Servers define commands and environment variables. The AI discovers available tools automatically and calls them when needed.

What are the best practices for setting up MCP servers?

Use environment variables for secrets, scope filesystem servers to specific directories, start with one server, use official npm packages, test tool calls after setup, and keep Node.js updated.

How much does it cost to use MCP servers in 2026?

MCP servers are free. Costs come from token usage: personal use $5-15/month, team use $50-200/month, enterprise $500+/month. Disable unused servers and use read-only replicas to reduce costs.

Is MCP worth it in 2026?

Yes, for development workflows. MCP turns AI into an autonomous coding assistant. Setup is quick (5 minutes per server) and productivity gains are significant. Best for well-defined tasks; skip for ad-hoc questions.

How do I troubleshoot MCP servers not showing tools in Cursor?

Ensure you are in Agent mode (not regular chat). Restart Cursor after adding servers. Check that the config file is valid JSON and the command is correct. Use full paths to npx/node if needed.

Can I use remote HTTP servers with OAuth for MCP?

Yes. Claude Code supports `--transport http` and browser-based OAuth flows. Tokens stay in the client credential store. For teams, use a shared gateway with audit logging instead of personal PATs.

#mcp#claude-code#cursor#setup-guide#developer-tools

One AI engineering post, weekly

LLM benchmarks, prompt techniques, and token-cost breakdowns, delivered to your inbox.

Comments

Have a question or something to add? Sign in to join the discussion.

Mahmudul Haque Qudrati — CEO & ML Engineer at Pristren

Mahmudul Haque Qudrati

CEO & ML Engineer

Visionary technologist, software engineer, and machine learning specialist. Founder and CEO of Pristren, directing engineering teams that ship production-grade AI/ML pipelines, mission-critical full-stack applications, and developer tooling. Creator of Zlyqor, the unified team workspace platform. Author of 540+ technical guides and benchmark research reports on large language models, agentic workflows, Model Context Protocol (MCP), and modern web stacks.

PristrenZlyqor