Skip to content

docs(docs): add bring your own MCP servers guide for Coder Agents - #31495

Merged
nickvigilante merged 2 commits into
mainfrom
docs/byo-mcp-servers
Nov 3, 2026
Merged

nickvigilante merged 2 commits into
mainfrom
docs/byo-mcp-servers

Conversation

@coder

@coder coder Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Adds a user-facing Bring your own MCP servers page for Coder Agents, aimed at developers coming from Claude Code who want claude mcp add-style personal servers without an org admin registering each one.

The page compares the three options (workspace .mcp.json, organization MCP servers, inline MCP servers), then walks through writing .mcp.json from dotfiles or ~/personalize, keeping tokens in user secrets, and reusing a Claude Code setup. It also links the page from Extending agents and adds it to the manifest.

Behavior verified against main:

  • .mcp.json resolves relative to the agent's dir. With no dir, no file is read (agent/agentcontextconfig, agent.go workingDirFn).
  • stdio servers inherit user-secret env vars through updateCommandEnv. ${VAR} expansion only applies to env values and uses the agent process env, which doesn't include user secrets (agent/x/agentmcp/config.go).
  • Accepted type values are stdio, http, sse. streamable-http is not accepted yet (feat: accept streamable-http MCP type, add plugin data dir helper #29324 would change that).
  • The config watcher picks up a late-created .mcp.json. MCP-only edits don't mark existing chats out of date.

The claude mcp add --scope project example follows Claude Code's docs and hasn't been tested end to end in a Coder workspace.

markdownlint-cli2, markdown-table-formatter, and Vale pass on the new page.

Requested in Slack by Michael Suchacz, prompted by a customer ask for BYO MCP in Coder Agents.

@coder
coder Bot requested review from matifali and nickvigilante October 29, 2026 15:15
@github-actions github-actions Bot added the community Pull Requests and issues created by the community. label Oct 29, 2026

@nickvigilante nickvigilante left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation review

I checked the new page, the link from Extending agents, and the sidebar entry against the code on this PR's base.
Details and suggestions are in the inline comments.

Blockers

  • docs/manifest.json: gen and offlinedocs fail because the sidebar entry was added by hand instead of in docs/manifest/ai-coder/agents.yml.
  • Lines 7, 15, and 185-187: existing chats do get .mcp.json changes, so readers don't need a new chat.
  • Lines 96-98: the startup script can stop the template's git-clone module from cloning into the working directory.
  • Lines 120-123: the dotfiles and personalize scripts must be executable.
  • Lines 75 and 90: a secret's name is confused with its environment variable target.

Outside this PR

These existing pages conflict with the new page or with the code:

  • extending-agents.md:449-452 has the same outdated claim about existing chats, and #31226 rewrites it.
  • user-guides/user-secrets.md:109 says env secrets are injected into the agent's process environment.
    The agent applies them to each child process (updateCommandEnv), as line 77 of the new page correctly says.
  • platform-controls/agent-isolation.md:104 sets CODER_AGENT_EXP_MCP_CONFIG_FILES in coder_agent.env, which reaches only child processes.
    The agent reads that variable from its own environment at startup (cli/agent.go:299).

Other notes

  • The examples use Bash, chmod, and umask, and Windows agents also read .mcp.json, so a line saying the examples assume a Linux or macOS workspace would scope them.
  • prepare-linkspector-browser failed at checkout, so CI didn't check links.
    I checked the relative links and anchors by hand, and they resolve.
  • #29324 would make Coder accept streamable-http, which changes line 161.

The rest of the page matches the code: the dir requirement, the server-name rules, the type values, where ${VAR} expands, secret inheritance by stdio servers, connecting after startup scripts, the file watcher, the 30-second and 60-second timeouts, the lack of OAuth, and the CODER_AGENT_EXP_MCP_CONFIG_FILES behavior.


🤖 Review generated with Coder Agents on behalf of @nickvigilante.

Comment thread docs/manifest.json Resolved
Move the sidebar entry into docs/manifest, fix chat refresh, secret
naming, script ordering, and executable-bit guidance.

Generated by Coder Agents on behalf of @nickvigilante.
@nickvigilante

Copy link
Copy Markdown
Contributor

Applied all review suggestions in 3033d9e, moved the sidebar entry into docs/manifest/ai-coder/agents.yml, and fixed the startup-script ordering issue by waiting for the clone instead of creating $WORKDIR.

Generated by Coder Agents on behalf of @nickvigilante.

@nickvigilante
nickvigilante enabled auto-merge (squash) November 3, 2026 13:24
@nickvigilante nickvigilante added cherry-pick/v2.39 Cherry-pick PR targeting release/2.39 and removed cherry-pick labels Nov 3, 2026
@nickvigilante
nickvigilante merged commit effc49e into main Nov 3, 2026
50 of 51 checks passed
@nickvigilante
nickvigilante deleted the docs/byo-mcp-servers branch November 3, 2026 14:13
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cherry-pick/v2.39 Cherry-pick PR targeting release/2.39 cherry-pick community Pull Requests and issues created by the community.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants