feat(mcp): promote introspect() + schema/uri helpers to public API#25
Merged
Merged
Conversation
… public API Closes #24. The @rudderjs/mcp thin binding's inspector had to re-declare the core's @internal _tools()/_resources()/_prompts() shape and carry local copies of the zod->json-schema and uri-template helpers, both smells for a thin binding. Promote a clean public surface instead: - McpServer.introspect(): returns the registered tool/resource/prompt classes (constructors) without starting a session; the internal accessors stay @internal and are still stripped from the published .d.ts. - zodToJsonSchema + matchUriTemplate exported from the package entry as pure MCP-authoring utilities. - New McpServerIntrospection + ZodLikeObject types exported. 104 tests (+4); minor changeset to 0.2.0. Downstream rudder cleanup follows once 0.2.0 publishes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #24. Follow-up from Phase 2 (the
@rudderjs/mcpthin-binding repoint, rudderjs/rudder#1448).Problem
The binding's inspector reached into
@gemstack/mcpinternals two ways, both smells for a thin binding:McpServer._tools()/_resources()/_prompts()and cast throughunknown, because those accessors are@internalandstripInternalremoves them from the published.d.ts.zod-to-json-schema.ts+uri-template.ts, duplicating the core's logic, because neither helper was in the public API.Change
Promote a clean public surface so the binding needs no internal access:
McpServer.introspect()returns the registered tool / resource / prompt classes (constructors, not instances) without starting a session. The internal_tools()/_resources()/_prompts()accessors stay@internaland remain stripped from the published types.zodToJsonSchema(schema)andmatchUriTemplate(template, uri)are now exported from the package entry as pure MCP-authoring utilities.McpServerIntrospectionandZodLikeObjecttypes exported alongside.Verification
introspect()returns/mirrors the internal accessors/empty-server case, plus a public-export smoke for the two helpers)..d.ts:introspect(): McpServerIntrospectionis present;_tools/_resources/_prompts/attachSdkare still stripped.@gemstack/mcpto 0.2.0.Downstream
Once 0.2.0 publishes, a small rudderjs/rudder cleanup PR will delete the binding's local
zod-to-json-schema.ts+uri-template.ts, swap the inspector's internal cast forserver.introspect(), and bump the@gemstack/mcpdep.