feat: add Coder Agents chat tools to the MCP toolsdk - #28025
feat: add Coder Agents chat tools to the MCP toolsdk#28025ibetitsmike wants to merge 14 commits into
Conversation
Expose the experimental chats API through MCP so agents can start and drive Coder Agents chats: coder_create_chat, coder_get_chat, coder_get_chat_messages, coder_send_chat_message, coder_interrupt_chat, coder_archive_chat, and coder_list_chat_model_configs. Both the hosted MCP server and the CLI stdio server pick these up from toolsdk.All.
Type busy_behavior with the SDK enum, derive the schema enum from constants, validate the message limit locally so out-of-range values fail loudly, and drop comments and checks inconsistent with sibling tools.
Docs previewCheck off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 78b3e7cd60
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Add a before_id cursor to coder_get_chat_messages so has_more pages are reachable, and filter provider-disabled model configs out of coder_list_chat_model_configs for admin callers.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4b94c814a8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A page holding only tool-call rows filters to an empty messages slice, leaving callers with no id to derive a cursor from. Return next_before_id from the unfiltered API page instead.
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 83b427b541
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ation An admin can remove a user's only membership, so indexing OrganizationIDs[0] can panic and surface as a recovered handler panic instead of an actionable error.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f21095ae07
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Hook-notice parts are user-facing per the SDK part contract, so coder_get_chat_messages must not filter them out with internal parts.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d93cc83872
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A deployment-config reader without AI provider read access (such as an auditor) receives the unfiltered admin model config list, and silently discarding the AIProviders error let provider-disabled configs leak through. Distinguish that case and error instead.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6aba5c2154
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ovider probe A prompt queued behind a busy chat now appears in queued_messages so polling callers do not conclude it was lost, and a failing deployment-config probe now propagates instead of falling through to the fail-open member path.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c73810e414
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…viders Provider deletion only soft-deletes the provider row, so its enabled model configs stay in the admin list while AIProviders omits the provider. Treat a successful provider enumeration as authoritative and exclude configs whose provider is absent, not just disabled ones.
|
@codex review |
ThomasK33
left a comment
There was a problem hiding this comment.
I like it. Either in this PR or in another one, I'd also add a built-in skill behind an MCP prompt (https://modelcontextprotocol.io/specification/2025-06-18/server/prompts).
That way, agents connecting to this would have a quick way to know how to interact with all these APIs.
That's also how Claude Design's MCP server works; they provide tools and a guiding skill for Claude Code via prompts.
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Add coder_agents_delegate and coder_agents_check prompt templates per the MCP prompts spec (2026-07-28). Definitions live in the toolsdk so the coderd-hosted and CLI stdio MCP servers adapt one shared list, the same way tools flow through toolsdk.All. The stdio server registers them only when the chat tools they reference are available.
…ilable A restricted --allowed-tools list could advertise prompts whose workflow tools were not registered. Each prompt now declares its RequiredTools and the stdio server skips prompts with missing tools.
|
@codex review |
Documentation CheckUpdates Needed
Automated review via Coder Agents |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 17cedd44fa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ompt requirements The delegate workflow only suggests coder_list_chat_model_configs as an optional step and omits it entirely when model_config_id is supplied, so requiring it suppressed the prompt for valid restricted allowlists.
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Exposes the experimental Coder Agents chats API through the MCP tool registry, so MCP clients (the hosted
/api/experimental/mcp/httpserver andcoder exp mcp server) can start and drive server-side coding agents.New tools in
codersdk/toolsdk, all thin wrappers over existingcodersdk.ExperimentalClientmethods:coder_create_chatCreateChat(prompt, optional org, model config, labels)coder_get_chatGetChat(status, last error, last turn summary, workspace, files)coder_get_chat_messagesGetChatMessages(user-facing parts, chronological, cursor pagination, queued prompts)coder_send_chat_messageCreateChatMessage(queue or interrupt busy behavior)coder_interrupt_chatInterruptChatcoder_archive_chatUpdateChatwitharchived: truecoder_list_chat_model_configsListChatModelConfigs(enabled configs with default flag)Both MCP servers register tools from
toolsdk.All, so no additional wiring is needed. Responses are trimmed to what an MCP caller needs (IDs as strings, user-facing transcripts) rather than full SDK payloads. No new endpoints and no database changes.Also adds MCP prompts for the chat workflows, defined once in
codersdk/toolsdkand registered by both servers:coder_agents_delegatecoder_agents_checkEach prompt declares the tools its workflow needs; the stdio server skips prompts whose tools are excluded by
--allowed-tools.Tests run the tools against a chat-enabled coderdtest instance (fake OpenAI-compatible provider plus in-process AI bridge), covering the full lifecycle, an interrupt against a blocked turn, pagination cursors, permission-dependent model config filtering, and argument validation. Prompt coverage spans SDK rendering, the hosted
prompts/list/prompts/getround trip, and the stdio server including allowlist gating.