Practical guides
How to set up an MCP server in Claude Code, Cursor and VS Code
What the Model Context Protocol is, how to add a server to Claude Code, Cursor and VS Code, the reference servers and the security rules, according to the official documentation.
An MCP server gives a coding agent access to an external tool: a GitHub repository, a database, a browser, a library's documentation. This guide explains the protocol, then the setup in three common clients. Commands and files are taken from the official documentation, verified on 2026-10-20.
What is MCP?
The Model Context Protocol (MCP) is an open-source standard for connecting AI applications to external systems: local files, databases, tools such as a search engine, or workflows. Its authors compare it to a USB-C port for AI applications (modelcontextprotocol.io). See also the MCP glossary entry.
- What a server exposes: tools (actions the model can run), resources (context data) and prompts (instruction templates) (MCP architecture).
- Two transports: stdio, when the client launches the server as a local process on the same machine; Streamable HTTP, for a remote server, which supports bearer tokens, API keys and custom headers.
Add a server to Claude Code
Claude Code is configured from the command line (Anthropic). If the agent is not installed yet, see our guide How to install and get started with Claude Code.
Remote server (HTTP), the recommended option for online services:
# Basic syntax
claude mcp add --transport http <name> <url>
# Real example: Connect to Notion
claude mcp add --transport http notion https://mcp.notion.com/mcp
Local server (stdio): everything after -- is the command that starts the server.
claude mcp add --env AIRTABLE_API_KEY=YOUR_KEY --transport stdio airtable \
-- npx -y airtable-mcp-server
The SSE transport is deprecated: Anthropic recommends HTTP where the server supports it. To manage servers:
# List all configured servers
claude mcp list
# Get details for a specific server
claude mcp get notion
# Remove a server
claude mcp remove notion
# (within Claude Code) Check server status
/mcp
Three scopes (--scope option):
local(default): the current project, for you only, stored in~/.claude.json;project: shared with your team through a.mcp.jsonfile at the repository root, to commit;user: all your projects, stored in~/.claude.json.
A cloned repository cannot approve its own .mcp.json servers: they stay pending until you accept the workspace trust dialog. Official example with GitHub's remote server, authenticated with a narrowly scoped personal access token:
claude mcp add --transport http github https://api.githubcopilot.com/mcp/ \
--header "Authorization: Bearer YOUR_GITHUB_PAT"
claude mcp add saves the configuration without validating the token: check the connection with /mcp.
Add a server to Cursor
Cursor offers one-click installation from its Marketplace (Customize page, "Add to Cursor" button, OAuth sign-in), or manual configuration in an mcp.json file (Cursor):
.cursor/mcp.jsonin the project, for project-specific tools;~/.cursor/mcp.jsonin your home directory, for tools available everywhere.
A local server launched with Node.js, as shown in Cursor's documentation:
{
"mcpServers": {
"server-name": {
"command": "npx",
"args": ["-y", "mcp-server"],
"env": {
"API_KEY": "value"
}
}
}
}
For a remote server, the entry uses a url key (and optionally headers) instead of command. Cursor supports stdio, SSE and Streamable HTTP, and resolves the ${env:NAME} syntax so you can read a secret from an environment variable instead of writing it in plain text.
Add a server to VS Code
In VS Code, open the Command Palette (⇧⌘P on Mac, Ctrl+Shift+P on Windows and Linux) and run MCP: Add Server (Microsoft). Pick HTTP if the server's publisher gives you a URL, Command (stdio) if it gives you a command. The documentation's example, the Playwright server, needs Node.js 18 or newer:
node --version
npx --version
Choose Command (stdio) and enter:
npx -y @playwright/mcp@latest
Give the server an ID (for example playwright), then choose where to store it:
- Global > Copilot Global:
~/.copilot/mcp-config.json, for all your workspaces; - **Workspace-root
.mcp.json**: to share with your team (experimentalchat.mcp.workspaceRootConfig.enabledsetting); - **
.vscode/mcp.jsonor the user-profilemcp.json**: still available, but labeled deprecated in the guided flow.
Watch the format: portable files use the mcpServers key, the VS Code format uses servers. The server gallery (preview) opens when you type @mcp in the Extensions view. Microsoft also recommends checking that a tool from the server was actually called in your session: an added configuration is not proof that the agent uses it.
Reference servers
The MCP project maintains reference servers to try out the protocol: Everything, Fetch, Filesystem, Git, Memory, Sequential Thinking and Time (official examples). TypeScript servers run with npx, Python servers with uvx:
npx -y @modelcontextprotocol/server-memory
uvx mcp-server-git
Servers maintained by companies for their own platforms are listed in the modelcontextprotocol/servers repository.
Security: rules to follow
A local MCP server is not a sandboxed plugin: it is an ordinary process that inherits your environment variables, can read anything your account can read (SSH keys, cloud credentials, home directory) and can open network connections (modelcontextprotocol.io). The official recommendations:
- Take inventory: remove servers you no longer use and know where each remaining one comes from;
- Prefer the remote version when a server needs nothing from your machine;
- Check the publisher and pin the version rather than
latest, with a deliberate update habit. VS Code's Playwright example uses@latest: adapt it to your own policy; - Isolate third-party servers (container, sandbox or virtual machine);
- Limit access: per-server credentials, filesystem access restricted to a specific directory, read-only where possible, limited network egress;
- Read tool descriptions: the model reads them as instructions, which opens the door to prompt injection.
Anthropic also asks you to verify that you trust each server before connecting it, especially servers that fetch external content (Anthropic). Cursor recommends API keys with minimal permissions and, for critical integrations, reviewing the source code (Cursor).
Going further
- Tool pages show which tools support MCP: Claude Code, Cursor, GitHub Copilot, Cline.
- Compare editors: Cursor, Devin Desktop or Copilot.
- The risks of generated code: what studies say about security.
Sources
- Model Context Protocol: What is MCP?, verified 2026-10-20
- Model Context Protocol: Architecture overview, verified 2026-10-20
- Model Context Protocol: Example Servers, verified 2026-10-20
- Model Context Protocol: Local Server Security, verified 2026-10-20
- Claude Code Docs: Connect Claude Code to tools via MCP, verified 2026-10-20
- Cursor Docs: Model Context Protocol, verified 2026-10-20
- VS Code Docs: Add MCP servers in VS Code, verified 2026-10-20
Key takeaway: an MCP server takes one command or a few lines of JSON to add, but a local server runs with your permissions: only install servers from identified publishers, with pinned versions and limited access.
Spotted an error in this article? Report it · Our corrections policy