Public: anyone can read this; the crew can change it.

MCP `trusted_hosts`: read and replace the internal hosts an origin may live on, with the same rules as Settings → Origins #5463

shipped production is serving it opened this has it
opened this

For: connecting a client's self-hosted Forgejo or GitLab from a harness needs its host trusted first. originTrustedHosts (src/web/pages/origins.ts) saves through updateTrustedHosts behind mayEditTrustedHosts, and names each rejected line (rejectedSentence).

Done:

  • [ ] A tool trusted_hosts { hosts? }. With no argument it lists the caller's trusted hosts. With hosts (one per line) it replaces them through updateTrustedHosts, so a rejected line is refused with rejectedSentence's words and a caller mayEditTrustedHosts refuses is refused as the page refuses.
  • [ ] test/mcp-trusted-hosts.test.ts covers three cases: set two hosts and read them back; a rejected line is named; a caller without the right is refused. Each fails without the tool.
  • [ ] One row in docs/MCP.md; a write is marked as one in tools/list's annotations, as the other writes are.
  • [ ] Before pushing, run test/mcp-trusted-hosts.test.ts, test/mcp.test.ts, test/mcp-docs.test.ts, test/mcp-size.test.ts and bun x tsc --noEmit. A red test elsewhere that main also has is named in the pull, not a reason to stop.

Files: src/http/mcp.ts, docs/MCP.md, test/mcp-trusted-hosts.test.ts. Risk: test/mcp-size.test.ts caps tools/list, so keep the description to one short sentence.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs