Skip to content

feat: accept streamable-http MCP type, add plugin data dir helper - #29324

Closed
jscottmiller wants to merge 1 commit into
scott/agent-plugins/4-chatdfrom
scott/agent-plugins/5-agentmcp-helpers
Closed

jscottmiller wants to merge 1 commit into
scott/agent-plugins/4-chatdfrom
scott/agent-plugins/5-agentmcp-helpers

Conversation

@jscottmiller

@jscottmiller jscottmiller commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

tl;dr: Accept the Agent Plugins streamable-http MCP type name and add the PluginDataDir helper that the plugin mcp.json loader uses.

inferTransport maps type: "streamable-http", the Agent Plugins spelling, to the existing http transport, so .mcp.json files can use either name. The extending-agents docs list the accepted type names. PluginDataDir(home, name, installDir) returns <home>/.coder/plugin-data/<name>-<hash>, where the hash covers the cleaned install directory so two installs of the same plugin get separate directories. It rejects names that are not valid plugin names and does not create the directory.

Header handling for .mcp.json servers is unchanged. The same-origin header rule from the Agent Plugins specification applies only to plugin servers and lands with the plugin loader in the next PR. A stricter origin policy is tracked in CODAGT-1383.

PR map

scott/agent-plugins/4-chatd..2289fe7a33

Category Files + -
prod (backend) 2 29 0
test (backend) 2 62 0
docs 1 1 0
Total 5 92 0
  1. agent/x/agentmcp/plugindata.go (+25/-0, new): PluginDataDir validates the plugin name and returns <home>/.coder/plugin-data/<name>-<hash>, with the hash taken over the cleaned install directory. It does not create the directory.
  2. agent/x/agentmcp/config.go (+4/-0): inferTransport maps streamable-http to http.

This PR was generated by Coder Agents on behalf of @jscottmiller.

@jscottmiller jscottmiller added the experimental Changes that might not necessarily be merged, until its approved to proceed with. label Sep 15, 2026
@jscottmiller
jscottmiller force-pushed the scott/agent-plugins/5-agentmcp-helpers branch 2 times, most recently from 73f758b to 6ae7d81 Compare September 15, 2026 17:53
@jscottmiller jscottmiller removed the experimental Changes that might not necessarily be merged, until its approved to proceed with. label Sep 15, 2026
@jscottmiller
jscottmiller force-pushed the scott/agent-plugins/5-agentmcp-helpers branch from 6ae7d81 to cdc3d6b Compare September 15, 2026 19:11
@jscottmiller
jscottmiller force-pushed the scott/agent-plugins/5-agentmcp-helpers branch from cdc3d6b to 2961c77 Compare September 17, 2026 21:16
@jscottmiller
jscottmiller force-pushed the scott/agent-plugins/5-agentmcp-helpers branch 2 times, most recently from 08b2b01 to ce83c77 Compare September 18, 2026 22:02
@linear-code

linear-code Bot commented Sep 22, 2026

Copy link
Copy Markdown

CODAGT-1101

@jscottmiller
jscottmiller force-pushed the scott/agent-plugins/5-agentmcp-helpers branch from ce83c77 to 747265b Compare September 24, 2026 17:01
@jscottmiller jscottmiller changed the title feat(agent/x/agentmcp): pin MCP HTTP headers to origin and add plugin env helpers feat(agent/x/agentmcp): pin MCP HTTP headers to origin and add plugin data dir helper Sep 24, 2026
@jscottmiller
jscottmiller force-pushed the scott/agent-plugins/5-agentmcp-helpers branch from 747265b to 0b3c2c8 Compare September 24, 2026 22:10
@jscottmiller jscottmiller added the experimental Changes that might not necessarily be merged, until its approved to proceed with. label Sep 24, 2026
@jscottmiller
jscottmiller force-pushed the scott/agent-plugins/5-agentmcp-helpers branch from 0b3c2c8 to 58e12e8 Compare September 30, 2026 01:18
@jscottmiller
jscottmiller force-pushed the scott/agent-plugins/5-agentmcp-helpers branch from d48e7f8 to 2b25f78 Compare October 6, 2026 19:22
@jscottmiller
jscottmiller force-pushed the scott/agent-plugins/5-agentmcp-helpers branch from 2b25f78 to 7f4fba0 Compare October 6, 2026 19:47
@jscottmiller
jscottmiller force-pushed the scott/agent-plugins/5-agentmcp-helpers branch from 7f4fba0 to 8102b7c Compare October 6, 2026 21:36
@jscottmiller
jscottmiller force-pushed the scott/agent-plugins/5-agentmcp-helpers branch from 8102b7c to 0812a94 Compare October 6, 2026 22:54
@jscottmiller
jscottmiller force-pushed the scott/agent-plugins/5-agentmcp-helpers branch from 0812a94 to 46d7a7f Compare October 7, 2026 18:53
@jscottmiller
jscottmiller force-pushed the scott/agent-plugins/5-agentmcp-helpers branch from 46d7a7f to b767701 Compare October 7, 2026 20:29
@jscottmiller
jscottmiller force-pushed the scott/agent-plugins/5-agentmcp-helpers branch from b767701 to b330dc2 Compare October 7, 2026 21:34
@jscottmiller
jscottmiller force-pushed the scott/agent-plugins/5-agentmcp-helpers branch from b330dc2 to 6a761a4 Compare October 7, 2026 22:07
@jscottmiller
jscottmiller force-pushed the scott/agent-plugins/5-agentmcp-helpers branch from 6a761a4 to 2eee941 Compare October 8, 2026 00:36
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Docs preview

Check 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.

@jscottmiller

Copy link
Copy Markdown
Contributor Author

/coder-agents-review

2 similar comments
@jscottmiller

Copy link
Copy Markdown
Contributor Author

/coder-agents-review

@jscottmiller

Copy link
Copy Markdown
Contributor Author

/coder-agents-review

@coder-agents-review coder-agents-review Bot 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.

Re-review of ef2b518, which is now rebased onto the earlier Agent Plugins PRs. All 20 round 2 findings are fixed. Round 3 findings: 2 P2, 4 P3, 7 P4, 2 Nit.

The CI failures on this head come from a cancelled run. go build, go vet, gofmt, the package tests, and markdownlint pass locally.

Each round has found a URL form the redactor misses: round 1 raw errors, round 2 %v-flattened and user:***@ URLs, and round 3 quote characters, scheme-relative and flattened relative Location values, and parse-error fragments. Building the catalog text from parts the agent controls, such as the operation, the configured origin, and an error class, with the full error kept in the agent log, would remove this whole class instead of adding another pattern each round.

The author's reply on the retained-client finding (manager.go:809) says a follow-up ticket is coming; no ticket link has been posted yet.

Out of scope (needs a ticket or explicit acceptance by a human):

  • agent/x/agentmcp/api.go:54: handleCallTool returns CallTool errors to coderd as Detail: err.Error() without redaction, so an HTTP error during a tool call sends the configured URL path and query to coderd.

Notes:

  • agent/x/agentmcp/mcphttpclient.go:144: redactErrorURLs is the fourth error-URL redactor in the repository (others in coderd/x/chatd/mcpclient, chatdebug, chaterror), each with different rules.
  • agent/x/agentmcp/plugindata.go:20: plugin name validation lives in agent/agentcontext; if the next PR's caller is there, PluginDataDir may belong next to it.

🤖 This review was automatically generated with Coder Agents.

Comment thread agent/x/agentmcp/mcphttpclient.go Resolved
Comment thread agent/x/agentmcp/mcphttpclient.go Resolved
Comment thread agent/x/agentmcp/mcphttpclient.go Resolved
Comment thread agent/x/agentmcp/mcphttpclient.go Resolved
Comment thread agent/x/agentmcp/mcphttpclient.go Resolved
Comment thread agent/x/agentmcp/plugindata.go Resolved
Comment thread agent/x/agentmcp/mcphttpclient.go Resolved
Comment thread agent/x/agentmcp/mcphttpclient.go Resolved
@jscottmiller

Copy link
Copy Markdown
Contributor Author

/coder-agents-review

@coder-agents-review coder-agents-review Bot 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.

Re-review of 4e056e9. The PR is narrower now: configured headers are withheld from off-origin requests, redirects are followed as before, and connect errors no longer go into the catalog. All 15 round 3 findings are closed, by a fix or because the code was removed. Round 4 findings: 1 P2, 1 P3, 8 P4, 4 Nit, plus one reopened naming finding.

Withholding headers matches Agent Plugins spec 7.2.1, and removing the redactor ends the URL-leak findings from rounds 1 to 3. The removed work (refusing off-origin redirects, reporting connect errors in the catalog, and showing the hidden error after a failed reconnect) is described as tracked in a sub-issue of CODAGT-1101, but no link has been posted. This needs a human decision: link the ticket, or accept dropping that work.

Out of scope (needs a ticket or explicit acceptance by a human):

  • agent/x/agentmcp/mcphttpclient.go:57: the HTTP and SSE clients follow up to 10 redirects from a remote MCP server to any origin, including loopback and link-local addresses such as 169.254.169.254.
  • agent/x/agentmcp/mcphttpclient.go:45: on a cross-origin redirect, net/http sends Referer with the full configured URL, so a ?api_key= query reaches the redirect target even though headers are withheld.
  • agent/x/agentmcp/config.go:82: ParseConfig accepts header names that differ only in case, so which value is sent depends on map iteration order.
  • agent/x/agentmcp/mcphttpclient.go:94: mcpHTTPClient detects tests with flag.Lookup("test.v"); testing.Testing() answers that directly.

Notes:

  • The commit subject and PR title are 81 characters, over the 72-character limit.

agent/x/agentmcp/manager.go:805

P2 [CRF-84] The stricter policy removed in this round (refusing off-origin redirects, catalog connect errors) and the hidden error state after a failed reconnect are described as "tracked separately" and "a follow-up sub-issue of CODAGT-1101", but no reply or description links that sub-issue. (Mafu-san, Leorio)

Without a link, a reviewer cannot confirm the work exists, so it is dropped rather than deferred. Link the sub-issue in the PR description and in the replies, or state that the work is dropped.

🤖

🤖 This review was automatically generated with Coder Agents.

Comment thread agent/x/agentmcp/mcphttpclient.go Resolved
Comment thread agent/x/agentmcp/mcphttpclient.go Resolved
Comment thread agent/x/agentmcp/plugindata.go Resolved
Comment thread agent/x/agentmcp/mcphttpclient.go Resolved
Comment thread agent/x/agentmcp/mcphttpclient.go Resolved
Comment thread agent/x/agentmcp/manager.go Resolved

@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.

Docs LGTM

@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.

Docs LGTM 👍

Edit: I forgot I already reviewed this lol

The streamable-http transport name from the Agent Plugins mcp.json
schema is normalized to http when a config is parsed, and the
extending-agents docs list the accepted type names.

PluginDataDir derives the per-plugin data directory under the user's
home from a validated plugin name and the plugin's cleaned install
directory, for the plugin mcp.json loader added next.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale This issue is like stale bread.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants