Skip to content

feat(mcp): extensions offer tools and events through the MCP server - #289

Merged
StuBehan merged 3 commits into
mainfrom
feat/mcp-extensions
Nov 25, 2026
Merged

StuBehan merged 3 commits into
mainfrom
feat/mcp-extensions

Conversation

@StuBehan

Copy link
Copy Markdown
Collaborator

Last of four for the local MCP server, following #288. Service extensions can now offer their own tools and event types through it, so something like Pylon can give Claude Code an open_issues tool and an sla_breach event without speaking MCP itself.

  • a new mcp capability (service tier) and an mcp block in the manifest declaring the tools and event types, up to 16 of each, checked at install. Clients see them under the extension's id, pylon.open_issues, and only while the service is running. They're told when that changes, and only when it actually does: a service moving between starting and running without changing what it offers sends nothing
  • a call goes to the extension as mcp.call with the caller as stack-nudge saw it. sessionId and pid are only there when they name a session it can see running, never because a model said so. The answer comes back as mcp.result, or fails after 30 s. Waiting on it doesn't hold up the client's other requests, and a call the client cancels is never answered
  • mcp.event emits an occurrence of a declared type. Anything undeclared is dropped and logged
  • event:settings (also service tier) tells an extension when a setting changes, from Settings or an MCP client, which is the straight path for an extension that wants to react without being an MCP client
  • the install prompt says what both ask for. Before, an app that didn't know them installed the extension without a word about it:

Both from scripts/render-screenshots.sh <dir> mcp. docs/extensions.md has a "Tools and events for AI agents" section with the message shapes.

Locally I ran a throwaway service extension with an echo tool, a tool that never answers and an event type, and drove it from a scripted client: the caller came through with the right session, the filtered stream only got its own events, the undeclared one was dropped, and a ping sent behind the slow call came straight back. That last one used to wait the full 30 s, which is the fix commit here.

Tests: ExtensionMCPTests (manifest parsing, tiers, the protocol lines, routing and answering a call, events gated on what was declared, settings events only to those granted them) plus the session tests for the async calls pass.

Base automatically changed from feat/mcp-events to main November 25, 2026 00:56
A call waited on the connection's reader, so a slow extension held up the client's other requests for up to 30 s and a cancel couldn't reach it. The answer is now sent from the host's completion, and dropped when the call was cancelled. Clients hear tools/list_changed only when what's offered differs, the caller an extension sees is the documented fields, and the unused setExtensionTypes is gone.
Pylon in the fixture catalogue asks for mcp and event:settings, so the install prompt shows how they read.
@StuBehan
StuBehan force-pushed the feat/mcp-extensions branch from 197759b to 849b9c2 Compare November 25, 2026 00:57
@StuBehan
StuBehan merged commit f3c76d3 into main Nov 25, 2026
6 checks passed
@StuBehan
StuBehan deleted the feat/mcp-extensions branch November 25, 2026 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant