Coder Tasks have been removed from coder/coder, so the
`coder_report_task` MCP tool and the status reporting pipeline behind it
no longer do anything useful. This PR removes the tool and the code that
only existed to support it.
### Removed
- `codersdk/toolsdk`: `ToolNameReportTask`, `ReportTaskArgs`,
`ReportTask`, `Deps.report`, `WithTaskReporter`, and the `All` entry,
plus their tests.
- `coderd/mcp`: the remote MCP exclusion for `coder_report_task`.
- `coder exp mcp server`: the task reporter, the AgentAPI screen
watcher, the agent socket connection, and the `coder_report_task` skip
logic. The server now requires an authenticated user client, because
every remaining tool needs one.
- `coder exp mcp configure claude-code`: the
`mcp__coder__coder_report_task` allowed tool, the injected
`coder_report_task` CLAUDE.md prompt, the `report tasks properly`
history line, the default system prompt asking the agent to send task
status updates, and the `CODER_MCP_APP_STATUS_SLUG` /
`CODER_MCP_AI_AGENTAPI_URL` env written to the Claude MCP config.
- `cli/cliutil/queue.go`: only used by the reporter.
- `github.com/coder/agentapi-sdk-go` (and transitive `tmaxmax/go-sse`)
via `go mod tidy`.
- The "task reporting" mention in `docs/ai-coder/mcp-server.md`.
### Breaking: removed `coder exp` flags and env
`coder exp` is experimental. Any scripts that still pass these flags
will now fail with an unknown flag error. Env vars that are no longer
read are ignored.
| Command | Flag | Env |
|---|---|---|
| `coder exp mcp server` | `--app-status-slug` |
`CODER_MCP_APP_STATUS_SLUG` |
| `coder exp mcp server` | `--ai-agentapi-url` |
`CODER_MCP_AI_AGENTAPI_URL` |
| `coder exp mcp server` | `--socket-path` | `CODER_AGENT_SOCKET_PATH`
(still used by `coder agent` and `coder exp sync`) |
| `coder exp mcp configure claude-code` | `--claude-app-status-slug` |
`CODER_MCP_APP_STATUS_SLUG` |
| `coder exp mcp configure claude-code` | `--ai-agentapi-url` |
`CODER_MCP_AI_AGENTAPI_URL` |
`--claude-system-prompt` no longer has a default.
<details>
<summary>Intentionally kept</summary>
- **Workspace app status reporting** (`UpdateAppStatus` on the agent API
and agent socket, `agentsdk.PatchAppStatus` / `ProtoFromPatchAppStatus`,
the deprecated `PATCH /workspaceagents/me/app-status` endpoint): still
served by coderd and the agent and part of versioned protocols. With
this change, nothing in the CLI calls the agent socket `UpdateAppStatus`
client anymore. Removing it would need a separate protocol change.
- **`report_tasks` in
`coderd/templatebuilder/modules/{aider,amazon-q}`**: these catalog
entries mirror the input variables of pinned coder/registry module
versions, and the behavior lives in those modules. Dropping the variable
here would not disable it, because `amazon-q` defaults it to `true`. The
registry modules need a follow-up instead.
- **`UserClientOptional` on toolsdk tools**: other tools still set it,
and remote MCP still uses it.
- No CLI golden files or generated CLI docs changed, because `coder exp`
commands are hidden.
</details>
### Verification
- `go build ./...`
- `go test ./codersdk/toolsdk/... ./coderd/mcp/... ./cli/cliutil/...`
- `go test ./cli -run 'TestExpMcp|TestCommandHelp'`
- `golangci-lint run ./cli/... ./codersdk/toolsdk/... ./coderd/mcp/...`
(0 issues)
---
_Generated by Coder Agents._
Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com>
8.5 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 the OAuth2 provider and the mcp-server-http experiment on your Coder deployment:
coder server --oauth2-provider-enable --experiments=mcp-server-http
Or set the environment variables:
CODER_OAUTH2_PROVIDER_ENABLE=true
CODER_EXPERIMENTS=mcp-server-http
For the YAML and Helm forms of the provider setting, refer to Enable OAuth2 Provider.
That page does not cover the experiment; set it with the top-level experiments YAML key.
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. This enables a seamless connect-and-authenticate experience where users sign in through their browser without manually managing tokens.
The MCP endpoint's WWW-Authenticate header points to /.well-known/oauth-protected-resource/api/experimental/mcp/http through its resource_metadata parameter.
This metadata identifies the full MCP endpoint URL as the resource, for example, https://coder.example.com/api/experimental/mcp/http.
Note
OAuth2 requires
CODER_OAUTH2_PROVIDER_ENABLE=trueon your Coder deployment.Dynamic Client Registration (DCR) is off by default and must be enabled before clients can self-register.
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, manage background processes, 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, organization memberships, and tar uploads
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.
The workspace file and command tools (coder_workspace_read_file,
coder_workspace_write_file, coder_workspace_edit_files,
coder_workspace_execute, and the coder_workspace_process_* tools) share
their arguments and result formats with the matching
Coder Agents tools, with these differences:
- Each tool takes a
workspaceargument that selects the workspace to act on. - Invalid arguments and workspace agent errors are returned as MCP tool errors.
- A single call waits at most 5 minutes. Run longer commands with
run_in_backgroundand check on them withcoder_workspace_process_output. - Commands started through MCP are separate from Coder Agents chat processes, but anyone with SSH access to the workspace can list and signal them.
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 control plane
- Review the logs from
coderd, the process that runs the control plane, for any errors
OAuth2 authentication not working
- Ensure your Coder deployment has
CODER_OAUTH2_PROVIDER_ENABLE=trueset - If your client registers itself automatically, ensure Dynamic Client Registration is enabled
- Verify your MCP client supports RFC 9728 Protected Resource Metadata
- Check that your browser can reach the Coder authorization endpoint