## Summary **Batch A of Phase 3** of the H1 → front-matter migration (`DOCS-484`; parent `DOCS-477`). Adds a front-matter `title` to every navigable docs page whose title can be migrated **mechanically**, with no editorial judgment. This is the content step that Phase 1 (renderers prefer front-matter title, `DOCS-482`) and Phase 2 (tooling + generators front-matter-aware, `DOCS-483`) unblocked. Both are merged; coder.com #964/#974 are merged and live. **Rendered no-op.** The renderers already resolve the page title from the manifest and hide the leading body H1 (Phase 1), so no page changes visually. This just moves the title into front matter where Fumadocs and the migrated tooling can read it. ## What's in this batch Dry-run on `main` (464 navigable pages) splits into: | category | count | this PR | |----------|-------|---------| | already has front-matter title (Reference, from Phase 2 generators) | 196 | skipped (idempotent) | | **mechanical** — leading body H1 equals the manifest label | 138 | ✅ add front-matter `title`, drop the duplicate H1 | | **no body H1** — renders under the manifest label only | 4 | ✅ add front-matter `title` only | | **mismatch** — body H1 differs from the manifest label | 126 | ⏭️ deferred (needs an editorial decision, see below) | 142 files changed, all under `docs/`. ## Deliberately out of scope: the 126 mismatches Pages where the body H1 is richer than the short sidebar label (e.g. label **Modules** / H1 *Contributing modules*, label **Install** / H1 *Installing Coder*) need a canonical-title decision, not a script. A few even look like the body H1 is the redundant one (`install/cli.md` and `install/index.md` both carry the H1 *Installing Coder*). These will land in follow-up batches **by nav section** once the policy is set, so each gets real review. ## Verification AI was the primary author of this PR (see disclosure below); per the [AI Contribution Guidelines](https://coder.com/docs/about/contributing/AI_CONTRIBUTING) here is the manual verification. - Every added front-matter block parses as YAML and its `title` round-trips to the manifest label (checked programmatically across all 142 files). - Every removed line is a leading `# H1` that equalled the manifest title; no body prose was reflowed. Front matter is correctly hoisted above pre-existing `<!-- markdownlint-disable -->` comments on the two pages that had them. - `pnpm check-docs` (markdownlint-cli2 + table formatter) passes on the changed set: `Summary: 0 error(s)`. `MD041` stays off (re-enabled in Phase 4); `MD025` is not tripped because the duplicate body H1s are removed. ``` $ pnpm exec markdownlint-cli2 $(git diff --name-only origin/main) Linting: 142 file(s) Summary: 0 error(s) ``` Linear: DOCS-484 > This PR was created with AI assistance (Coder Agents).
6.8 KiB
title
| title |
|---|
| MCP Server |
Coder includes a built-in Model Context Protocol (MCP) server that provides AI assistants with tools and context about your Coder deployment. This enables AI-powered workflows for managing workspaces, templates, and development environments.
Coder supports two MCP server modes:
- Local MCP Server: Runs via the Coder CLI using stdio transport. Ideal for local AI tools and IDE integrations.
- Remote MCP Server: HTTP-based server exposed by your Coder deployment. Supports OAuth2 authentication and is published to the MCP Registry.
Local MCP Server
The local MCP server runs via the Coder CLI and uses stdio transport to communicate with AI tools.
Setup
Run the MCP server using the Coder CLI:
coder exp mcp server
Client Configuration
Configure your MCP client to spawn the Coder CLI:
{
"mcpServers": {
"coder": {
"command": "coder",
"args": ["exp", "mcp", "server"]
}
}
}
The CLI automatically uses your existing Coder authentication (from coder login).
Claude Desktop Example
Add to your Claude Desktop configuration file:
macOS
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"coder": {
"command": "coder",
"args": ["exp", "mcp", "server"]
}
}
}
Windows
Edit %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"coder": {
"command": "coder.exe",
"args": ["exp", "mcp", "server"]
}
}
}
Remote MCP Server
The remote MCP server is an HTTP endpoint exposed by your Coder deployment at
/api/experimental/mcp/http. This enables MCP clients to connect to Coder
without running the CLI locally.
The endpoint implements the
Streamable HTTP transport
in stateless mode: it supports MCP specification versions from 2024-11-05
through 2026-07-28, does not issue Mcp-Session-Id headers, and answers
GET and DELETE with 405 Method Not Allowed (there is no standalone
server-event stream or explicit session termination, both permitted by the
specification). The server exposes tools only; MCP resources, prompts,
structured tool output, elicitation, and the MCP Tasks extension are not
implemented.
Prerequisites
The remote MCP HTTP endpoint requires both the oauth2 and mcp-server-http
experiments enabled on your Coder deployment:
coder server --experiments=oauth2,mcp-server-http
Or set the environment variable:
CODER_EXPERIMENTS=oauth2,mcp-server-http
MCP Registry
Coder is published to the official MCP Registry
as io.github.coder/coder, enabling easy installation in supported MCP clients.
VS Code / GitHub Copilot
- Open VS Code Command Palette and run MCP: Add Server...
- Select From MCP Registry
- Search for "Coder" and select it
- Enter your Coder deployment hostname when prompted (e.g.,
coder.example.com) - VS Code will automatically handle OAuth2 authentication
Claude Desktop (Remote)
Add to your Claude Desktop configuration file (claude_desktop_config.json):
{
"mcpServers": {
"coder": {
"url": "https://coder.example.com/api/experimental/mcp/http"
}
}
}
Claude Desktop will automatically discover OAuth2 endpoints and prompt you to authenticate through your browser.
Manual Configuration
For MCP clients that don't support the registry or OAuth2 discovery, configure the server manually with a session token:
{
"mcpServers": {
"coder": {
"url": "https://coder.example.com/api/experimental/mcp/http",
"headers": {
"Coder-Session-Token": "<your-session-token>"
}
}
}
}
To create a session token:
- Navigate to your Coder deployment
- Go to Settings > Tokens
- Create a new token
- Add the token to your MCP client configuration
Authentication
The MCP server supports two authentication methods:
OAuth2 (Recommended for Interactive Clients)
MCP clients that support RFC 9728
(Protected Resource Metadata) can authenticate automatically using OAuth2. The
server advertises its OAuth2 capabilities via the WWW-Authenticate header and
/.well-known/oauth-protected-resource endpoint.
This enables a seamless connect-and-authenticate experience where users sign in through their browser without manually managing tokens.
Note
OAuth2 requires the
oauth2experiment to be enabled on your Coder deployment.
Session Token (For Programmatic Access)
For clients that don't support OAuth2 discovery, or for programmatic access, use a session token as shown in the Manual Configuration section.
Available Tools
The MCP server exposes tools across several areas:
- Workspace management: list, inspect, create, and build workspaces
- Template operations: list, inspect, create, and manage templates and versions
- File operations: read, write, and edit files in a workspace
- Workspace interaction: run commands, forward ports, list apps, and read logs
- Coder Agents chats: create chats, send messages, read transcripts and status, interrupt, archive, and list available models
- User and system: authenticated user details, tar uploads, and task reporting
The full, authoritative set of tools, including their names, descriptions, and
arguments, is defined in Coder's
toolsdk package. Refer to it for the
current list, since the available tools can change between releases.
Available Prompts
The MCP server also exposes prompts for common Coder Agents chat workflows. Clients that support prompts surface them for you to invoke, for example as slash commands:
coder_agents_delegate: delegate a coding task to a Coder Agents chat and monitor it to completioncoder_agents_check: check the status and recent activity of an existing Coder Agents chat
Troubleshooting
"Unauthorized" errors
- Verify your session token is valid and not expired
- Check that the MCP server experiment is enabled on your deployment
- Ensure your user has appropriate permissions for the requested operations
Connection timeouts
- Verify your Coder deployment URL is correct and accessible
- Check network connectivity between your MCP client and the Coder server
- Review Coder server logs for any errors
OAuth2 authentication not working
- Ensure your Coder deployment has the
oauth2experiment enabled - Verify your MCP client supports RFC 9728 Protected Resource Metadata
- Check that your browser can reach the Coder authorization endpoint