The right way to Join MCP Servers to Claude (Desktop & Code)


Connecting MCP servers to Claude permits it to work with exterior instruments, recordsdata, databases, repositories, and different methods as a substitute of working solely inside the chat window. The setup differs barely between Claude Desktop and Claude Code, however each may be configured in just some steps.

On this article, you’ll learn to join MCP servers with Claude Desktop and Claude Code, a sensible step-by-step information for getting every setup working appropriately.

What Is MCP and Why Does It Matter?

MCP (Mannequin Context Protocol) is the common connector layer that lets any AI mannequin discuss to any exterior device via a single standardised interface with out customized integration code for each mixture.

Earlier than MCP, connecting Claude to GitHub required one customized integration. Connecting it to Slack required a special one. Connecting it to your database required a 3rd. Anthropic referred to as this the “N×M drawback”: N AI fashions instances M exterior instruments meant N×M bespoke connectors. MCP solves it by turning that into N+M. Construct one MCP server for GitHub, and each MCP-compatible AI consumer Claude, Cursor, Windsurf, and dozens extra can use it instantly.

How MCP Works in 3 Easy Components

Understanding the 3-part structure takes 2 minutes and prevents 90% of setup confusion.

Part What It Is Instance in Claude
Host The AI app the consumer talks to, manages context, safety, and which servers can be found. Claude Desktop, Claude Code, Cursor
Shopper Lives contained in the host. Handles protocol-level communication with every MCP server. Constructed into Claude Desktop / Claude Code
Server An exterior course of that exposes instruments, sources, or prompts to the AI through MCP. GitHub MCP server, Filesystem MCP server

Once you ask Claude to “verify my open GitHub PRs”, here’s what occurs behind the scenes:

  1. Claude identifies it wants an exterior device to fulfil the request.
  2. The MCP consumer in Claude sends a JSON-RPC request to the GitHub MCP server.
  3. The server queries GitHub’s API and returns structured knowledge.
  4. Claude incorporates that knowledge into its context and generates your reply.

The entire move takes below a second. You by no means see the plumbing.

As of April 2026, Streamable HTTP is Anthropic’s official really useful transport, and the older SSE transport is being deprecated.

Claude Desktop: Step-by-Step MCP Setup

Claude Desktop reads its MCP configuration from a single JSON file. There are two methods to put in servers: the brand new one-click Desktop Extensions (.mcpb recordsdata, previously .dxt) and the standard JSON config methodology. Use Extensions for supported servers; use JSON config for something customized.

Methodology 1: Desktop Extensions (One-Click on, No JSON)

As of early 2026, Claude Desktop helps Desktop Extensions, pre-packaged MCP servers distributed as .mcpb recordsdata (MCP Bundle; older guides could name these .dxt recordsdata, which nonetheless work however are the legacy title). These set up with a double-click. No JSON enhancing, no Node.js PATH points.

  1. Open Claude Desktop.
  2. Click on the “+” button within the bottom-left of the chat enter.
  3. Choose “Connectors” to open the connectors menu.
  4. Discover your server (e.g., GitHub, Google Drive) and click on Set up (or Click on onn add connectors to seek out one on the connectors listing).
  5. Restart Claude Desktop. The server prompts mechanically.
Claude Dashboard

Desktop Extensions are the precise selection for non-technical customers or servers you need to “set and neglect.” The JSON config methodology under is correct for customized servers, personal servers, or full management over arguments and surroundings variables.

Methodology 2: JSON Config (Full Management)

Claude Desktop reads its MCP configuration from claude_desktop_config.json. The file location is dependent upon your OS:

macOS: ~/Library/Software Assist/Claude/claude_desktop_config.json

Home windows: %APPDATApercentClaudeclaude_desktop_config.json

On Home windows, which folder really has this file is dependent upon the way you put in Claude Desktop, and this journeys up lots of people. There are two utterly totally different areas:

  • Direct .exe installer (from claude.ai/downloads): %APPDATApercentClaudeclaude_desktop_config.json
  • Microsoft Retailer, WinGet, or MSIX set up: %LOCALAPPDATApercentPackagesClaude_pzs8sxrjxfjjcLocalCacheRoamingClaudeclaude_desktop_config.json

If %APPDATApercentClaude doesn’t exist in your machine, you nearly definitely have the Retailer/MSIX set up, and your actual file is at that second, uglier path. Home windows’ app-packaging mannequin silently redirects it there as a substitute of the usual location each piece of documentation assumes.

If neither path has the file but, open Claude Desktop itself, go to Settings → Developer → Edit Config. That creates the file at whichever path your particular set up really makes use of, so that you don’t should guess.

One Home windows-specific entice: paths inside JSON want double backslashes. C:UsersyournameDocuments in a JSON string should be written as C:CustomersyournamePaperwork, a single backslash breaks the JSON parser. Right here’s what an entire, appropriately escaped config appears to be like like:

Claude Desktop json file

Enhancing the Config File

Open Claude Desktop → high menu bar → Settings → Developer → Edit Config. This opens the file in your default editor and creates it if it doesn’t exist.

The file has only one top-level key, mcpServers. Consider it as a listing of servers you need Claude to learn about. Every server will get its personal entry inside that record, and also you choose no matter title you need for that entry (like “filesystem” or “github” under).

Inside every server’s entry, there are three issues you possibly can set:

  • command: the precise program Claude runs to start out that server (often npx, since most servers are distributed as npm packages)
  • argsthe record of arguments handed to that command, precisely such as you’d sort them in a terminal
  • env: any surroundings variables the server wants, mostly API keys or entry tokens

Right here’s a sensible starter config for a developer workflow: filesystem entry, GitHub integration, and net search:

{
  "mcpServers": {
    "filesystem": {
      "command": "/usr/native/bin/npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem",
               "/Users/yourname/Documents", "/Users/yourname/projects"]
    },
    "github": {
      "command": "/usr/native/bin/npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"
      }
    },
    "brave-search": {
      "command": "/usr/native/bin/npx",
      "args": ["-y", "@modelcontextprotocol/server-brave-search"],
      "env": { "BRAVE_API_KEY": "your_brave_api_key" }
    }
  }
}

What’s occurring in every of the three servers:

filesystem doesn’t want any credentials, so it solely has command and args. The args record tells npx which bundle to run (@modelcontextprotocol/server-filesystem) and which folders in your pc it’s allowed to the touch, on this case Paperwork and tasks.

github must show who you might be to GitHub’s API, so it has an additional env block. GITHUB_PERSONAL_ACCESS_TOKEN is the place you paste your personal GitHub token. The server reads it as an surroundings variable when it begins up, the identical method a program run out of your terminal would.

Getting a GitHub token, step-by-step:

  1. Go to github.com and register. Click on your profile picture within the top-right nook, then click on Settings.
  2. Within the left sidebar, click on Developer settings (it’s close to the underside).
  3. Click on Private entry tokens, then High quality-grained tokens, then Generate new token. GitHub now recommends fine-grained tokens over the older “traditional” ones, since you possibly can restrict them to particular repos as a substitute of your complete account.
  4. Give it a Token title (something memorable, like “claude-mcp”), and set an Expiration. GitHub warns towards “no expiration” for good motive, choose 90 days and put a renewal reminder in your calendar.
  5. Beneath Useful resource proprietor, choose your private account (or the group whose repos you want). Beneath Repository entry, select Solely choose repositories and choose simply those Claude really wants, not all of them.
  6. Beneath Permissions, grant solely what you’ll use. For many workflows, Contents (learn and write) and Points (learn and write) cowl it. Add Pull requests (learn and write) if you would like Claude opening or reviewing PRs.
  7. Click on Generate token on the backside, then copy it instantly. GitHub reveals a fine-grained token precisely as soon as, should you navigate away earlier than copying it, you’ll should generate a brand new one.

That token (it begins with github_pat_) is what goes instead of “ghp_your_token_here” within the JSON config above:

"GITHUB_PERSONAL_ACCESS_TOKEN": "github_pat_your_actual_token"

brave-search follows the identical sample as github: one command, one args record to run the precise bundle, and one env variable for its API key.

That’s the entire sample. Each server you ever add to this file follows the identical form: a reputation you select, a command to run it, arguments to configure it, and (if it must authenticate) an env block for its secrets and techniques.

Claude Code: Including MCP Servers through CLI

Claude Code has its personal MCP configuration floor separate from Claude Desktop, and it comes with a devoted CLI command that makes setup quicker than enhancing JSON manually.

You’ll be able to set up Claude Code following this information: Claude Code Information

Have already got servers arrange in Claude Desktop? Run claude mcp add-from-claude-desktop (macOS or WSL) to repeat them straight into Claude Code as a substitute of re-adding each by hand.

Including a Server with claude mcp add

The fundamental syntax is:

claude mcp add  --  [args...]

That’s the sample for an area server, one Claude Code runs itself as a subprocess. Hosted servers reached over a URL use –transport http as a substitute and skip the — command fully:

claude mcp add --transport http docs-server https://instance.com/mcp

Hosted servers want no Node.js, no native course of, and nothing to put in. They’re the best first server to attempt. Native servers, just like the Postgres instance under, want a command Claude Code can really run in your machine.

For a Postgres database server:

claude mcp add --transport stdio project-db 
  -- npx -y @modelcontextprotocol/server-postgres 
     postgresql://localhost:5432/mydb

Claude Code helps three scopes for server configuration:

Scope Config Location Who Sees It Greatest For
Native (default) ~/.claude.json (per-project) You solely Private instruments, like GitHub, Slack, your DB
Venture .mcp.json in mission root Your complete workforce (dedicated) Shared servers like Linear, Sentry
Consumer ~/.claude.json (top-level mcpServers key) Solely you, all tasks Private instruments you need in every single place, not project-specific

To confirm setup, run:

claude mcp record

The standing column tells you precisely what’s occurring:

Standing That means
✓ Related Prepared to make use of
! Wants authentication Reachable, however wants a browser sign-in or a token
! Related · instruments fetch failed Related, however couldn’t record its instruments. Run claude mcp get for element
✗ Failed to attach Server didn’t reply. Run the uncooked command manually to see the actual error
✗ Connection error The connection try itself threw an error
⏸ Pending approval A project-scoped server you haven’t authorized but

If it reveals something apart from “Related”, run the precise set up command manually in your terminal. The error it prints is way extra helpful than something within the standing line.

The Greatest MCP Servers to Set up First

The MCP ecosystem has over 2,300 public servers in Could 2026. Most are deserted demos. Those under are actively maintained, production-tested, and canopy 80% of actual workflows. My sincere take: set up 3–5 servers most to start out. Each server provides its device definitions to Claude’s context window, and a bloated device record visibly degrades Claude’s tool-selection high quality.

Server What It Permits Set up Package deal / Methodology Greatest For
GitHub (Official) Create points, evaluation PRs, search code throughout repos Docker: ghcr.io/github/github-mcp-server All builders
Filesystem Learn, search, and organise recordsdata in your machine @modelcontextprotocol/server-filesystem Everybody
Courageous Search Stay net search with out rate-limit friction @modelcontextprotocol/server-brave-search Analysis duties
Postgres Question and handle your database in plain English @modelcontextprotocol/server-postgres Information / backend groups
Notion Learn pages, question databases, replace docs from Claude Official Notion MCP server (OAuth) Information-heavy groups
Slack Learn channels, search historical past, ship messages @modelcontextprotocol/server-slack Group comms + ops
Context7 Up-to-date library docs, fixing the stale coaching knowledge drawback Through npx or Claude Code CLI Builders constructing with APIs
Playwright Browser automation and net testing instantly in Claude Code @playwright/mcp QA and frontend engineers

For builders, the sensible starter pack is GitHub + Filesystem + Context7. That mixture covers 80% of coding workflows with out burning context tokens on unused instruments.

Widespread Errors and Fixes

73% of first-time MCP customers hit no less than one connection error. Listed below are the 5 patterns that account for the overwhelming majority of failures, and the repair for every.

Error 1: Standing reveals “Failed to attach” or “Connection error”

Each statuses imply the server didn’t begin, or an HTTP server’s URL didn’t reply. Run the precise set up command manually in your terminal and skim the error output instantly. The three commonest causes: npx not present in PATH (use absolute path), incorrect npm bundle title, or lacking surroundings variable. Repair the underlying error earlier than touching the Claude config.

If it’s an area server timing out on its first run (npx downloading the bundle for the primary time can take some time), elevate the startup timeout as a substitute of assuming it’s damaged:

MCP_TIMEOUT=60000 claude

Error 2: Instruments don’t seem after connecting

Use the /mcp slash command inside a Claude Code session to drive a reconnect. If instruments nonetheless don’t seem, run claude mcp get an empty device record means the server began however declared no instruments, often a server-side config error. Restart with the up to date server config.

Error 3: JSON syntax error silently breaks all servers

A single lacking comma or mismatched bracket in claude_desktop_config.json silently disables each server. Run your JSON via jsonlint.com or use jq to validate earlier than restarting Claude. That is the one commonest first-install failure mode.

Error 4: Relative paths fail

Claude Desktop begins MCP servers with an undefined working listing, so relative paths like ./mydir by no means resolve. At all times use absolute paths: /Customers/yourname/tasks as a substitute of ~/tasks or ./tasks.

Error 5: Context window will get eaten by device definitions

One developer measured 30–40% of their Claude context window going to MCP device schemas that have been by no means utilized in that session. If Claude appears unusually gradual or costly, the perpetrator is nearly at all times too many linked servers. Prune to the three–5 servers you really use in your present workflow. You’ll be able to at all times add extra later.

Scorching take: most individuals who assume they want a higher-tier Claude plan really simply want fewer MCP servers loaded. The context value is invisible however vital. For a comparability of Claude plan options and what they really unlock

Superior: Construct Your Personal MCP Server

Constructing a customized MCP server is the quickest technique to give Claude entry to inner instruments, proprietary APIs, or knowledge that no public server covers. The Python SDK makes this surprisingly accessible: you outline instruments with decorators as a substitute of writing JSON schemas by hand.

The minimal viable MCP server in Python:

!pip set up mcp

from mcp.server.fastmcp import FastMCP

mcp = FastMCP("my-server")

@mcp.device()
def get_data(question: str) -> str:
    """Fetch knowledge from my inner API."""
    return my_api.fetch(question)

if __name__ == "__main__":
    mcp.run()

Register it in your Claude Desktop config the identical method as every other server level command at your Python interpreter and args on the server file path.

One safety notice that the majority tutorials skip: at all times use scoped permissions when connecting MCP servers. Grant read-only entry first, broaden to put in writing entry solely when you could have confirmed the server behaves as anticipated. An MCP server with write entry to manufacturing methods and a misinterpreted immediate can do actual injury.

Conclusion

Connecting MCP servers to Claude turns it right into a sensible assistant that may work with recordsdata, repositories, databases, APIs, and different exterior instruments. Claude Desktop affords easy setup via Extensions or JSON configuration, whereas Claude Code makes server set up and administration straightforward via the CLI.

One of the best strategy is to start out with a couple of important servers, use absolute paths, safe your credentials, and grant solely the permissions required. As soon as configured appropriately, MCP creates a dependable bridge between Claude and the instruments you already use. With that basis in place, Claude turns into much more succesful, helpful, and prepared for real-world workflows.

Incessantly Requested Questions

Q1. What’s MCP in Claude AI?

A. MCP stands for Mannequin Context Protocol. It’s an open commonplace created by Anthropic in November 2024 that lets Claude connect with exterior instruments, databases, recordsdata, and APIs via a common interface. With MCP enabled, Claude strikes from answering questions primarily based on coaching knowledge to taking actual actions in linked methods studying recordsdata, querying databases, pushing GitHub commits, or sending Slack messages.

Q2. How do I arrange MCP in Claude Desktop?

A. Claude Desktop reads MCP configuration from claude_desktop_config.json. On macOS, the file is at ~/Library/Software Assist/Claude/claude_desktop_config.json. On Home windows, it’s at %APPDATApercentClaudeclaude_desktop_config.json. Add your server definitions below the mcpServers key utilizing absolute paths, save the file, then totally restart Claude Desktop. Alternatively, use Claude Desktop Extensions (.mcpb recordsdata, previously .dxt) for one-click set up of supported servers no JSON enhancing required.

Q3. How do I add MCP servers to Claude Code?

A. Use the CLI command: claude mcp add [args]. For instance, so as to add a Postgres server: claude mcp add project-db — npx -y @modelcontextprotocol/server-postgres postgresql://localhost:5432/mydb. Run claude mcp record to confirm the server linked. Claude Code helps native scope (private, default), mission scope (team-shared through .mcp.json), and consumer scope (private, however energetic throughout all of your tasks).

Hello , I’m Sree Vamsi a passionate Information Science fanatic at present working at Analytics Vidhya. My journey into knowledge science started with a curiosity for uncovering insights from advanced knowledge and has advanced into constructing end-to-end Generative AI functions, RAG pipelines, agentic AI workflows, and multi-agent methods that clear up real-world enterprise issues.

Login to proceed studying and luxuriate in expert-curated content material.

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *