MCP for coding agents: servers, config files, and tokens
The Model Context Protocol (MCP) is an open-source standard that lets an AI application call tools on an external server. A coding agent is the host, each server runs as a local process or a remote service, and the agent’s config file says which servers to start or contact. Every client keeps that file in a different place, and the format varies: the root key is mcpServers in most clients, servers in VS Code’s own format, mcp in OpenCode, and mcp_servers in Codex. Get three things right: where the file lives, which transport the server speaks, and where its token is kept.
What MCP is
The Model Context Protocol is an open-source standard for connecting AI applications to external systems. A host, such as a coding agent, runs one client per server, and they exchange JSON-RPC 2.0 messages. A server offers tools the model can call, resources the application can read, and prompts a person picks. The model decides to call a tool, but the host sends the request, and the specification says hosts must obtain explicit user consent first. What MCP is in Rig covers the same ground from the product side.
Where the config lives
The root key is mcpServers in most clients, servers in VS Code’s own format, mcp in OpenCode, and mcp_servers in Codex. MCP config file locations lists paths, keys, and transports client by client. The MCP config generator writes the exact JSON or TOML for each client and converts a snippet from one client’s shape to another’s.
Transports and tokens
With stdio, the client starts the server as a local process. With Streamable HTTP, it sends requests to a URL. A token in a config file is a credential in a file, so treat the file like a .env file: write a variable reference where the client supports one, keep personal tokens in user-scope files, and commit a project file only when every value in it is safe for anyone who can read the repository. Env files and secrets covers the habits.
Reading order
- Read the Model Context Protocol entry for the vocabulary.
- Find your agent in MCP config file locations, then generate its entry with the MCP config generator.
- If you use Rig, follow Connect AI editors (MCP) and the page for your client, such as Cursor, Claude, or Codex.
- Decide how much an agent may do, using Project-scoped MCP and the MCP tools overview.
What Rig exposes
Rig runs a local MCP hub that speaks Streamable HTTP on 127.0.0.1, port 47823 by default, and asks for a bearer token. It offers dozens of scoped tools for projects, ports, logs, env profiles, and git. Access comes in three modes: read, control, and full. Any write waits for an Approve click in Rig. The Link action writes a rig entry into the config of Cursor, Claude Code, Codex, Windsurf, VS Code, GitHub Copilot CLI, OpenCode, and Pi. It has no writer for Claude Desktop. See MCP that isn’t a raw shell for the design, and the MCP hub for Cursor and Claude and Cursor and Claude MCP pages for the product view.
Limits
Client formats change, so if a client rejects a snippet, the vendor’s documentation is the authority. The generator writes configuration text only: it does not start a server or test a connection, and it covers stdio and Streamable HTTP, not legacy SSE servers. The protocol moves too. Clients on older revisions still use a handshake that the current revision removed.
Tools in this topic
Guides in this topic
Glossary terms in this topic
Knowledge base articles in this topic
- Docs
MCP in Rig
How Rig’s local MCP hub links Cursor, Claude, and other editors to live processes with scoped tools.
- Docs
What is MCP?
Model Context Protocol in Rig: scoped runtime tools for AI editors, not a pasted terminal session.
- Docs
Connect Cursor
One-click MCP link for Cursor.
- Docs
Connect Claude
Wire Claude to Rig’s MCP hub.
- Docs
Connect Codex
OpenAI Codex via Rig MCP.
- Docs
Connect VS Code
MCP for VS Code / Copilot-style workflows.
- Docs
Connect Windsurf
Link Windsurf to the Rig hub.
- Docs
Connect GitHub Copilot CLI
One-click link to Rig MCP for Copilot CLI.
- Docs
Connect OpenCode
Link OpenCode to Rig’s local MCP hub.
- Docs
MCP tools overview
What agents can call today.
- Docs
Project-scoped MCP
Keep the agent on the right repo and port.
- Docs
ACP vs MCP in Rig
When to use Rig’s local MCP hub versus the cloud ACP agent.
Blog posts in this topic
- Blog
MCP that isn’t a raw shell
Giving an agent your terminal is a trust fall. Scoped runtime tools are the safer contract, here’s ours.
- Blog
Scoped MCP, not a pasted terminal
Giving Cursor your shell is a trust fall. Rig’s local MCP hub hands the agent health, logs, ports, and restart, with a token you can rotate.
- Blog
Project-scoped MCP tokens
Hub-wide tokens are convenient. Project tokens are what you hand an agent that should not see the whole fleet.
Pages in this topic
Related topics
Frequently asked questions
Why does an MCP config work in one agent and not another?
The format differs by client. Servers sit under mcpServers in most clients, servers in VS Code’s own format, mcp in OpenCode, and mcp_servers in a TOML file for Codex. A snippet pasted between clients needs its root key renamed, and sometimes its entry reshaped, which is what the config generator’s convert mode does.
Does an MCP server have to be remote?
No. With stdio, the client starts the server as a local process and they exchange messages over standard input and output. With Streamable HTTP, the client sends JSON-RPC messages as HTTP POST requests, and the server replies with plain JSON or a stream. A local HTTP server should validate the Origin header and bind to localhost, according to the 2025-06-18 transport specification.
Is it safe to put a token in an MCP config file?
Treat it like a .env file. A token in env or headers is a credential in a file, and a project file is shared the moment it is committed. Where a client supports references, write the variable name and keep the value in your shell. Keep personal tokens in user-scope files, and commit a project file only when every value in it is safe for anyone who can read the repository.
How does Rig limit what an agent can do over MCP?
Access has three modes, read, control, and full, and a fresh install starts in control. Any write waits for an Approve click in Rig, and confirm set to true does not approve it on its own. A project-scoped token cannot use the group start and stop tools, and its kill_port tool frees only that project’s own port.
See how Rig fits in
Rig is a Mac app that starts, stops, and watches the processes in a project from one window. The knowledge base explains each part in plain language.
Related
Section links
- MCP config generator
- MCP config file locations: where each coding agent reads its servers
- Model Context Protocol: definition and meaning
- MCP in Rig
- What is MCP?
- Connect Cursor
- Connect Claude
- Connect Codex
- Connect VS Code
- Connect Windsurf
- Connect GitHub Copilot CLI
- Connect OpenCode
- MCP tools overview
- Project-scoped MCP
- ACP vs MCP in Rig
- MCP that isn't a raw shell
- Scoped MCP, not a pasted terminal
- Project-scoped MCP tokens
- MCP hub for Cursor & Claude
- Cursor & Claude MCP for local dev
- Env files and secrets in local development
- Connect Pi
- Connect OpenClaw
- Connect Antigravity
- Connect LM Studio
- Connect Hermes
- MCP open_url gotchas
- MCP activity log
- Guidelines for agents using Rig
- Ask Cursor to restart — without kill -9