← All guides

What Is MCP? A Practical Guide to MCP Servers in Claude Code, Cursor and VS Code

By the ContextSwitch team · October 26, 2026 · 8 min read

The Model Context Protocol, usually shortened to MCP, is an open standard that lets AI assistants call external tools and read external data in a consistent way. Instead of every editor and chatbot inventing its own plugin format, a tool author builds one MCP server and it works in any client that supports the protocol.

This guide explains the moving parts, shows how to connect a server in common developer tools, and covers the security habits that matter when you give an AI assistant new abilities.

The three pieces: host, client and server

When you ask the assistant for something, the model sees the list of available tools with their descriptions and input schemas. If a tool fits the task, the model requests a call, the client sends it to the server, and the result comes back into the conversation.

  • Host: the application you interact with, such as Claude Code, Cursor, VS Code with Copilot, or a desktop chat app.
  • Client: the component inside the host that speaks MCP and keeps the connection to each server.
  • Server: a program that exposes capabilities — tools the model can call, resources it can read, and reusable prompts.

Local (stdio) versus remote (HTTP) servers

A local server runs on your machine as a child process and communicates over standard input and output. It is a good fit for tools that need your files or local programs, and it requires the right runtime — often Node.js or Python — to be installed.

A remote server runs on the internet and is reached over HTTP, typically using the Streamable HTTP transport. Nothing needs to be installed locally; you add a URL and usually an authentication header or sign-in. Remote servers suit hosted services such as databases, issue trackers or SaaS products.

Some older clients only support local servers. A small bridge such as the open-source mcp-remote package can run locally and forward requests to a remote server, letting those clients use it anyway.

Adding a server in popular tools

Exact menus change between releases, but the configuration shapes are stable:

  • Claude Code: use the "claude mcp add" command with the server name and either a command to run (local) or "--transport http" plus a URL (remote). "claude mcp list" shows what is connected.
  • Cursor: add an entry under "mcpServers" in ~/.cursor/mcp.json for all projects, or .cursor/mcp.json for one project, with either a command or a url and headers.
  • VS Code: add servers in .vscode/mcp.json under "servers". VS Code supports input variables, so it can prompt for an API key once and store it securely instead of saving it in the file.
  • Codex CLI and Gemini CLI: both read MCP servers from their settings files and list connected servers with a /mcp command inside the session.

Using tools well once connected

You rarely need to name a tool explicitly; describing the task is usually enough. Naming the server helps when several servers offer similar tools — for example "use ContextSwitch to save this session as checkout-refactor". Most clients ask for confirmation before running a tool, and you can usually allow trusted read-only tools permanently while keeping confirmation on anything that changes data.

Keep the number of connected servers reasonable. Every tool description is sent to the model, so dozens of rarely used tools consume context and make it harder for the model to choose correctly.

Security checklist

  • Install servers only from sources you trust, and read what tools they expose before connecting.
  • Treat API keys like passwords: keep them out of git, prefer environment variables or secure input prompts, and create a separate key per machine so you can revoke one without breaking the others.
  • Prefer least privilege: if a service offers read-only keys or scoped tokens, use them.
  • Review tool calls that write, delete or send data before approving them.
  • Be cautious with content returned by tools: web pages and documents can contain instructions aimed at the AI, a risk known as prompt injection.

Example: moving work between coding agents

A practical use of MCP is handing work from one agent to another. With the ContextSwitch MCP server connected, you can ask one agent to save a summary of the current task, then open a different tool later and ask it to load that summary and continue. The context travels through your account rather than through copy and paste. Setup instructions for each client are on the ContextSwitch MCP page.

Troubleshooting basics

  • Tools do not appear: restart the client after editing its configuration and check the file is valid JSON or TOML.
  • Authentication errors: confirm the header format the server expects, commonly "Authorization: Bearer <key>", and that the key has not been revoked.
  • Local server fails to start: run the configured command yourself in a terminal to see the real error, often a missing runtime or package.

More guides