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

One MCP server beside every harness: tools with MCP Apps ui:// cards, an OpenAPI description, thin plugins for OpenCode and Claude Code #1349

Closed opened this in answer to
Closed without merging

The forge's MCP server now serves four ui:// cards, GET /contract/openapi.json describes its public API, and there are thin OpenCode and Claude Code plugins. Type check is clean. I couldn't run test/mcp.test.ts as written: this sandbox refuses the unix-socket listen that serve() does.

Notes

stopped closed without shipping deploy 30a2d3b

opened this

The forge's MCP server now serves four ui:// cards, GET /contract/openapi.json describes its public API, and there are thin OpenCode and Claude Code plugins. Type check is clean. I couldn't run test/mcp.test.ts as written: this sandbox refuses the unix-socket listen that serve() does. I ran the same tests through forgeHttp(app) in-process, and all 17 passed, including the new ones. I didn't run the rest of the suite; the forge's check does that.

  • Cards.
    • apps, now, asks and milestones now name a card in _meta.ui.resourceUri: ui://forge/app, run, decision and wave. initialize declares the resources capability, and resources/list and resources/read serve the cards.
    • Each of those four tool results also carries structuredContent.card, a plain title/status/rows/actions model built in src/web/studio/cards.ts.
    • Each ui:// resource is one small sandboxed page that draws that model with textContent, never innerHTML.
    • The same file renders the model as escaped HTML with cardHtml.
    • Card buttons ask the host to call asks_act, say, stop or tell. The host decides, and each call goes through the usual checks.
  • Contract. src/contract/openapi.ts is an OpenAPI 3.1 document for the routes the manifest (here) names, plus POST /mcp. It's served at /contract/openapi.json, public and cached for 5 minutes. test/openapi.test.ts fails when the manifest names a route the document lacks.
  • Tell tracing. tell takes an optional context with page (http/https), run, commit (hex) and said (the person's words). src/actions/tell_context.ts checks it and appends a "Where this was told from" block to the issue body. Malformed context is refused with invalid.
  • Plugins. plugins/opencode (forge.ts) and plugins/claude-code (plugin.json plus commands/forge.md) register /mcp using FORGE_URL and FORGE_TOKEN. They add a forge command with tell, status and decide. They hold no logic of their own.
  • Tests. test/mcp.test.ts now pins the resource list and read, the tool-to-card links, a card coming from a tool result (escaped), tell context accepted and rejected, and the OpenAPI route. I also added the resources capability assertion there. docs/MCP.md is updated.

Left out:

  • Cards vs. pages. The cards are not the studio pages' own fragments. Those are tied to a request context and the page stylesheet, so I built a small model per card instead.
  • Release agent. I found no "contract not published" string in src, so I did nothing on the release side beyond serving the route. Whether the release agent finds it there is unconfirmed.
  • Plugin publishing. The plugins are not published to any registry, and plugins/ is outside the tsc include.
  • Run card. It is a snapshot of what's running, not live progress; there is no stream.

To try it: set FORGE_URL and FORGE_TOKEN. Then send resources/list to POST /mcp and curl $FORGE_URL/contract/openapi.json. For the plugins, use claude --plugin-dir plugins/claude-code, or copy plugins/opencode/forge.ts into .opencode/plugin/.

🤖 Generated with Claude Code

Closes #1116

commented

Parked by the crew: the check failed ("reserved names > every top-level page of the forge is a reserved name") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs