Skip to content

Comments

feat(mcp): convert TypeScript classes to MCP tools.#1743

Merged
samchon merged 5 commits intofeat/monorepofrom
feat/mcp
Feb 21, 2026
Merged

feat(mcp): convert TypeScript classes to MCP tools.#1743
samchon merged 5 commits intofeat/monorepofrom
feat/mcp

Conversation

@samchon
Copy link
Owner

@samchon samchon commented Feb 21, 2026

This pull request introduces a new MCP integration package for typia, enabling seamless registration of both TypeScript class-based and OpenAPI-based LLM function controllers as MCP tools. The changes provide robust validation feedback for LLM function calls, simplify controller creation, and ensure compatibility with MCP servers. The most important changes are grouped below.

MCP Integration and Controller Registration

  • Added new package @typia/mcp with configuration, dependencies, and build scripts, providing MCP integration for typia and supporting both class and HTTP controllers. (packages/mcp/package.json, packages/mcp/tsconfig.json, pnpm-lock.yaml) [1] [2] [3]
  • Implemented registerMcpControllers function in packages/mcp/src/index.ts to register controllers as MCP tools and provide validation feedback for LLM function calls. (packages/mcp/src/index.ts)
  • Added McpControllerRegistrar internal module to handle tool registration, tool call routing, validation, and integration with MCP server tool handlers. (packages/mcp/src/internal/McpControllerRegistrar.ts)

HTTP Controller and OpenAPI Support

  • Introduced IHttpLlmController interface for HTTP-based LLM controllers, allowing OpenAPI operations to be registered as LLM function calling tools. (packages/interface/src/http/IHttpLlmController.ts, packages/interface/src/http/index.ts) [1] [2]
  • Added HttpLlm.controller function to compose HTTP LLM controllers from OpenAPI documents, simplifying MCP tool registration for API endpoints. (packages/utils/src/http/HttpLlm.ts) [1] [2] [3] [4]

Documentation and Validation Feedback

  • Improved documentation for ILlmController and IHttpLlmController, clarifying usage for class-based and OpenAPI-based controllers and their registration process. (packages/interface/src/schema/ILlmController.ts, packages/interface/src/http/IHttpLlmController.ts) [1] [2]
  • Enhanced stringifyValidationFailure output to wrap annotated JSON in a markdown code block, making validation feedback clearer for LLM auto-correction. (packages/utils/src/utils/stringifyValidationFailure.ts)

@samchon samchon self-assigned this Feb 21, 2026
@samchon samchon added documentation Improvements or additions to documentation enhancement New feature or request labels Feb 21, 2026
@socket-security
Copy link

socket-security bot commented Feb 21, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedzod-to-json-schema@​3.25.110010010085100
Added@​modelcontextprotocol/​sdk@​1.26.09910010099100

View full report

@samchon samchon marked this pull request as ready for review February 21, 2026 16:20
Copilot AI review requested due to automatic review settings February 21, 2026 16:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new @typia/mcp package that registers typia LLM controllers (class-based and OpenAPI/HTTP-based) as MCP tools, with typia-powered argument validation feedback suitable for LLM auto-correction.

Changes:

  • Introduces @typia/mcp with registerMcpControllers() and an internal registrar that wires MCP tools/list + tools/call.
  • Adds IHttpLlmController and HttpLlm.controller() to treat OpenAPI operations as tool controllers.
  • Updates stringifyValidationFailure() formatting to wrap annotated JSON output in Markdown code fences.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
pnpm-lock.yaml Adds dependency graph entries for the new MCP package and MCP SDK dependencies.
packages/utils/src/utils/stringifyValidationFailure.ts Wrapes validation feedback in Markdown code blocks and improves output structure.
packages/utils/src/http/HttpLlm.ts Adds HttpLlm.controller() and adjusts HttpLlm.application() typing.
packages/mcp/package.json Defines the new @typia/mcp package metadata and dependencies.
packages/mcp/tsconfig.json Adds TypeScript build configuration for the new package.
packages/mcp/src/index.ts Exposes registerMcpControllers() public API.
packages/mcp/src/internal/McpControllerRegistrar.ts Implements MCP tool registration/listing/calling and typia validation feedback.
packages/interface/src/http/IHttpLlmController.ts Defines HTTP/OpenAPI controller shape for tool registration.
packages/interface/src/http/index.ts Re-exports IHttpLlmController.
packages/interface/src/schema/ILlmController.ts Updates documentation to include MCP registration examples.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

@samchon samchon merged commit 31b3166 into feat/monorepo Feb 21, 2026
5 checks passed
@samchon samchon deleted the feat/mcp branch February 21, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant