Skip to content

feat(mcp): promote introspect() + schema/uri helpers to public API#25

Merged
suleimansh merged 1 commit into
mainfrom
feat/mcp-public-introspection-helpers
Jun 26, 2026
Merged

feat(mcp): promote introspect() + schema/uri helpers to public API#25
suleimansh merged 1 commit into
mainfrom
feat/mcp-public-introspection-helpers

Conversation

@suleimansh

Copy link
Copy Markdown
Member

Closes #24. Follow-up from Phase 2 (the @rudderjs/mcp thin-binding repoint, rudderjs/rudder#1448).

Problem

The binding's inspector reached into @gemstack/mcp internals two ways, both smells for a thin binding:

  1. It re-declared the shape of McpServer._tools()/_resources()/_prompts() and cast through unknown, because those accessors are @internal and stripInternal removes them from the published .d.ts.
  2. It carried local copies of 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 @internal and remain stripped from the published types.
  • zodToJsonSchema(schema) and matchUriTemplate(template, uri) are now exported from the package entry as pure MCP-authoring utilities.
  • New McpServerIntrospection and ZodLikeObject types exported alongside.

Verification

  • Typecheck + build clean.
  • 104 tests pass (+4: introspect() returns/mirrors the internal accessors/empty-server case, plus a public-export smoke for the two helpers).
  • Confirmed in the built .d.ts: introspect(): McpServerIntrospection is present; _tools/_resources/_prompts/attachSdk are still stripped.
  • Minor changeset bumps @gemstack/mcp to 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 for server.introspect(), and bump the @gemstack/mcp dep.

… 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.
@suleimansh suleimansh added the enhancement New feature or request label Jun 26, 2026
@suleimansh suleimansh self-assigned this Jun 26, 2026
@suleimansh suleimansh added the priority: low Nice to have / latent label Jun 26, 2026
@suleimansh suleimansh merged commit f7c7a45 into main Jun 26, 2026
1 check passed
@suleimansh suleimansh deleted the feat/mcp-public-introspection-helpers branch June 26, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority: low Nice to have / latent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Promote MCP server accessors + schema/uri helpers to public API (retire binding-local copies)

1 participant