@typia/mcp 12.1.0-dev.20260325 → 13.0.0-dev.20260426

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 Jeongho Nam
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Jeongho Nam
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,69 +1,69 @@
1
- # `@typia/mcp`
2
-
3
- ![Typia Logo](https://typia.io/logo.png)
4
-
5
- [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/typia/blob/master/LICENSE)
6
- [![NPM Version](https://img.shields.io/npm/v/typia.svg)](https://www.npmjs.com/package/typia)
7
- [![NPM Downloads](https://img.shields.io/npm/dm/typia.svg)](https://www.npmjs.com/package/typia)
8
- [![Build Status](https://github.com/samchon/typia/workflows/test/badge.svg)](https://github.com/samchon/typia/actions?query=workflow%3Atest)
9
- [![Guide Documents](https://img.shields.io/badge/Guide-Documents-forestgreen)](https://typia.io/docs/)
10
- [![Gurubase](https://img.shields.io/badge/Gurubase-Document%20Chatbot-006BFF)](https://gurubase.io/g/typia)
11
- [![Discord Badge](https://img.shields.io/badge/discord-samchon-d91965?style=flat&labelColor=5866f2&logo=discord&logoColor=white&link=https://discord.gg/E94XhzrUCZ)](https://discord.gg/E94XhzrUCZ)
12
-
13
- [MCP (Model Context Protocol)](https://modelcontextprotocol.io) integration for [`typia`](https://github.com/samchon/typia).
14
-
15
- Registers typia controllers as MCP tools with automatic validation.
16
-
17
- ## Setup
18
-
19
- ```bash
20
- npm install @typia/mcp @modelcontextprotocol/sdk
21
- npm install typia
22
- npx typia setup
23
- ```
24
-
25
- ## Usage
26
-
27
- ### From TypeScript class
28
-
29
- ```typescript
30
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
31
- import { registerMcpControllers } from "@typia/mcp";
32
- import typia from "typia";
33
-
34
- const server: McpServer = new McpServer({
35
- name: "my-server",
36
- version: "1.0.0",
37
- });
38
- registerMcpControllers({
39
- server,
40
- controllers: [
41
- typia.llm.controller<Calculator>("Calculator", new Calculator()),
42
- ],
43
- });
44
- ```
45
-
46
- ### From OpenAPI document
47
-
48
- ```typescript
49
- import { registerMcpControllers } from "@typia/mcp";
50
- import { HttpLlm } from "@typia/utils";
51
-
52
- registerMcpControllers({
53
- server,
54
- controllers: [
55
- HttpLlm.controller({
56
- name: "petStore",
57
- document: yourOpenApiDocument,
58
- connection: { host: "https://api.example.com" },
59
- }),
60
- ],
61
- });
62
- ```
63
-
64
- ## Features
65
-
66
- - No manual schema definition — generates everything from TypeScript types or OpenAPI
67
- - Automatic argument validation with LLM-friendly error feedback
68
- - Supports both class-based (`typia.llm.controller`) and HTTP-based (`HttpLlm.controller`) controllers
69
- - `preserve` option to coexist with `McpServer.registerTool()`
1
+ # `@typia/mcp`
2
+
3
+ ![Typia Logo](https://typia.io/logo.png)
4
+
5
+ [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/typia/blob/master/LICENSE)
6
+ [![NPM Version](https://img.shields.io/npm/v/typia.svg)](https://www.npmjs.com/package/typia)
7
+ [![NPM Downloads](https://img.shields.io/npm/dm/typia.svg)](https://www.npmjs.com/package/typia)
8
+ [![Build Status](https://github.com/samchon/typia/workflows/test/badge.svg)](https://github.com/samchon/typia/actions?query=workflow%3Atest)
9
+ [![Guide Documents](https://img.shields.io/badge/Guide-Documents-forestgreen)](https://typia.io/docs/)
10
+ [![Gurubase](https://img.shields.io/badge/Gurubase-Document%20Chatbot-006BFF)](https://gurubase.io/g/typia)
11
+ [![Discord Badge](https://img.shields.io/badge/discord-samchon-d91965?style=flat&labelColor=5866f2&logo=discord&logoColor=white&link=https://discord.gg/E94XhzrUCZ)](https://discord.gg/E94XhzrUCZ)
12
+
13
+ [MCP (Model Context Protocol)](https://modelcontextprotocol.io) integration for [`typia`](https://github.com/samchon/typia).
14
+
15
+ Registers typia controllers as MCP tools with automatic validation.
16
+
17
+ ## Setup
18
+
19
+ ```bash
20
+ npm install @typia/mcp @modelcontextprotocol/sdk
21
+ npm install typia
22
+ npx typia setup
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ### From TypeScript class
28
+
29
+ ```typescript
30
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
31
+ import { registerMcpControllers } from "@typia/mcp";
32
+ import typia from "typia";
33
+
34
+ const server: McpServer = new McpServer({
35
+ name: "my-server",
36
+ version: "1.0.0",
37
+ });
38
+ registerMcpControllers({
39
+ server,
40
+ controllers: [
41
+ typia.llm.controller<Calculator>("Calculator", new Calculator()),
42
+ ],
43
+ });
44
+ ```
45
+
46
+ ### From OpenAPI document
47
+
48
+ ```typescript
49
+ import { registerMcpControllers } from "@typia/mcp";
50
+ import { HttpLlm } from "@typia/utils";
51
+
52
+ registerMcpControllers({
53
+ server,
54
+ controllers: [
55
+ HttpLlm.controller({
56
+ name: "petStore",
57
+ document: yourOpenApiDocument,
58
+ connection: { host: "https://api.example.com" },
59
+ }),
60
+ ],
61
+ });
62
+ ```
63
+
64
+ ## Features
65
+
66
+ - No manual schema definition — generates everything from TypeScript types or OpenAPI
67
+ - Automatic argument validation with LLM-friendly error feedback
68
+ - Supports both class-based (`typia.llm.controller`) and HTTP-based (`HttpLlm.controller`) controllers
69
+ - `preserve` option to coexist with `McpServer.registerTool()`
@@ -0,0 +1,4 @@
1
+ var McpControllerRegistrar = {};
2
+
3
+ export { McpControllerRegistrar as __exports };
4
+ //# sourceMappingURL=McpControllerRegistrar.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"McpControllerRegistrar.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -0,0 +1,6 @@
1
+ function getDefaultExportFromCjs (x) {
2
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
3
+ }
4
+
5
+ export { getDefaultExportFromCjs };
6
+ //# sourceMappingURL=_commonjsHelpers.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_commonjsHelpers.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -0,0 +1,4 @@
1
+ var lib = {};
2
+
3
+ export { lib as __exports };
4
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAiCA,wDAiCC;AA9DD,8EAA2E;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,SAAgB,sBAAsB,CAAC,KA+BtC;IACC,OAAO,+CAAsB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAIA,8EAA2E;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,gCAAuC,KA+BtC;IACC,OAAO,+CAAsB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC"}
package/lib/index.mjs CHANGED
@@ -1,35 +1,8 @@
1
- import { McpControllerRegistrar } from './internal/McpControllerRegistrar.mjs';
1
+ import { getDefaultExportFromCjs } from './_virtual/_commonjsHelpers.mjs';
2
+ import { __require as requireLib } from './index2.mjs';
2
3
 
3
- /**
4
- * Register MCP tools from controllers.
5
- *
6
- * Registers TypeScript class methods via `typia.llm.controller<Class>()` or
7
- * OpenAPI operations via `HttpLlm.controller()` as MCP tools.
8
- *
9
- * Every tool call is validated by typia. If LLM provides invalid arguments,
10
- * returns {@link IValidation.IFailure} formatted by {@link LlmJson.stringify} so
11
- * that LLM can correct them automatically. Below is an example of the
12
- * validation error format:
13
- *
14
- * ```json
15
- * {
16
- * "name": "John",
17
- * "age": "twenty", // ❌ [{"path":"$input.age","expected":"number & Type<\"uint32\">"}]
18
- * "email": "not-an-email", // ❌ [{"path":"$input.email","expected":"string & Format<\"email\">"}]
19
- * "hobbies": "reading" // ❌ [{"path":"$input.hobbies","expected":"Array<string>"}]
20
- * }
21
- * ```
22
- *
23
- * If you use `McpServer.registerTool()` instead, you have to define Zod schema,
24
- * function name, and description string manually for each tool. Also, without
25
- * typia's validation feedback, LLM cannot auto-correct its mistakes, which
26
- * significantly degrades tool calling performance.
27
- *
28
- * @param props Registration properties
29
- */
30
- function registerMcpControllers(props) {
31
- return McpControllerRegistrar.register(props);
32
- }
4
+ var libExports = requireLib();
5
+ var index = /*@__PURE__*/getDefaultExportFromCjs(libExports);
33
6
 
34
- export { registerMcpControllers };
7
+ export { index as default };
35
8
  //# sourceMappingURL=index.mjs.map
package/lib/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BG;AACG,SAAU,sBAAsB,CAAC,KA+BtC,EAAA;AACC,IAAA,OAAO,sBAAsB,CAAC,QAAQ,CAAC,KAAK,CAAC;AAC/C;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["index.js?commonjs-entry"],"sourcesContent":["import { getDefaultExportFromCjs } from \"\u0000commonjsHelpers.js\";\nimport { __require as requireLib } from \"/home/samchon/github/samchon/typia@next/packages/mcp/lib/index.js\";\nvar libExports = requireLib();\nexport { libExports as __moduleExports };\nexport default /*@__PURE__*/getDefaultExportFromCjs(libExports);"],"names":[],"mappings":";;;AAEA,IAAI,UAAU,GAAG,UAAU,EAAE;AAE7B,YAAe,aAAa,uBAAuB,CAAC,UAAU,CAAC;;;;"}
package/lib/index2.mjs ADDED
@@ -0,0 +1,47 @@
1
+ import { __exports as lib } from './_virtual/index.mjs';
2
+ import { __require as requireMcpControllerRegistrar } from './internal/McpControllerRegistrar2.mjs';
3
+
4
+ var hasRequiredLib;
5
+
6
+ function requireLib () {
7
+ if (hasRequiredLib) return lib;
8
+ hasRequiredLib = 1;
9
+ Object.defineProperty(lib, "__esModule", { value: true });
10
+ lib.registerMcpControllers = registerMcpControllers;
11
+ const McpControllerRegistrar_1 = requireMcpControllerRegistrar();
12
+ /**
13
+ * Register MCP tools from controllers.
14
+ *
15
+ * Registers TypeScript class methods via `typia.llm.controller<Class>()` or
16
+ * OpenAPI operations via `HttpLlm.controller()` as MCP tools.
17
+ *
18
+ * Every tool call is validated by typia. If LLM provides invalid arguments,
19
+ * returns {@link IValidation.IFailure} formatted by {@link LlmJson.stringify} so
20
+ * that LLM can correct them automatically. Below is an example of the
21
+ * validation error format:
22
+ *
23
+ * ```json
24
+ * {
25
+ * "name": "John",
26
+ * "age": "twenty", // ❌ [{"path":"$input.age","expected":"number & Type<\"uint32\">"}]
27
+ * "email": "not-an-email", // ❌ [{"path":"$input.email","expected":"string & Format<\"email\">"}]
28
+ * "hobbies": "reading" // ❌ [{"path":"$input.hobbies","expected":"Array<string>"}]
29
+ * }
30
+ * ```
31
+ *
32
+ * If you use `McpServer.registerTool()` instead, you have to define Zod schema,
33
+ * function name, and description string manually for each tool. Also, without
34
+ * typia's validation feedback, LLM cannot auto-correct its mistakes, which
35
+ * significantly degrades tool calling performance.
36
+ *
37
+ * @param props Registration properties
38
+ */
39
+ function registerMcpControllers(props) {
40
+ return McpControllerRegistrar_1.McpControllerRegistrar.register(props);
41
+ }
42
+
43
+ return lib;
44
+ }
45
+
46
+ export { requireLib as __require };
47
+ //# sourceMappingURL=index2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index2.mjs","sources":["index.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.registerMcpControllers = registerMcpControllers;\nconst McpControllerRegistrar_1 = require(\"./internal/McpControllerRegistrar\");\n/**\n * Register MCP tools from controllers.\n *\n * Registers TypeScript class methods via `typia.llm.controller<Class>()` or\n * OpenAPI operations via `HttpLlm.controller()` as MCP tools.\n *\n * Every tool call is validated by typia. If LLM provides invalid arguments,\n * returns {@link IValidation.IFailure} formatted by {@link LlmJson.stringify} so\n * that LLM can correct them automatically. Below is an example of the\n * validation error format:\n *\n * ```json\n * {\n * \"name\": \"John\",\n * \"age\": \"twenty\", // ❌ [{\"path\":\"$input.age\",\"expected\":\"number & Type<\\\"uint32\\\">\"}]\n * \"email\": \"not-an-email\", // ❌ [{\"path\":\"$input.email\",\"expected\":\"string & Format<\\\"email\\\">\"}]\n * \"hobbies\": \"reading\" // ❌ [{\"path\":\"$input.hobbies\",\"expected\":\"Array<string>\"}]\n * }\n * ```\n *\n * If you use `McpServer.registerTool()` instead, you have to define Zod schema,\n * function name, and description string manually for each tool. Also, without\n * typia's validation feedback, LLM cannot auto-correct its mistakes, which\n * significantly degrades tool calling performance.\n *\n * @param props Registration properties\n */\nfunction registerMcpControllers(props) {\n return McpControllerRegistrar_1.McpControllerRegistrar.register(props);\n}\n//# sourceMappingURL=index.js.map"],"names":["require$$0"],"mappings":";;;;;;;;AACA,CAAA,MAAM,CAAC,cAAc,CAAC,GAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,CAAA,GAAA,CAAA,sBAA8B,GAAG,sBAAsB;CACvD,MAAM,wBAAwB,GAAGA,6BAAA,EAA4C;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;CACA,SAAS,sBAAsB,CAAC,KAAK,EAAE;KACnC,OAAO,wBAAwB,CAAC,sBAAsB,CAAC,QAAQ,CAAC,KAAK,CAAC;AAC1E,CAAA;AACA;;;;;;"}
@@ -86,9 +86,13 @@ var McpControllerRegistrar;
86
86
  // Get McpServer reference for coexistence with McpServer.registerTool()
87
87
  const mcpServer = "server" in originalServer ? originalServer : null;
88
88
  // Helper to get existing tools dynamically (supports tools registered after this call)
89
- const getExistingTools = () => { var _a;
90
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
91
- return mcpServer ? ((_a = mcpServer._registeredTools) !== null && _a !== void 0 ? _a : {}) : {}; };
89
+ const getExistingTools = () => {
90
+ var _a;
91
+ if (mcpServer === null)
92
+ return {};
93
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
94
+ return (_a = mcpServer._registeredTools) !== null && _a !== void 0 ? _a : {};
95
+ };
92
96
  // Check for conflicts with existing McpServer tools at registration time
93
97
  for (const pair of Object.entries(getExistingTools())) {
94
98
  if (pair[1].enabled && registry.has(pair[0])) {
@@ -1 +1 @@
1
- {"version":3,"file":"McpControllerRegistrar.js","sourceRoot":"","sources":["../../src/internal/McpControllerRegistrar.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,iEAK4C;AAQ5C,wCAAgD;AAEhD,2DAAqD;AAErD,IAAiB,sBAAsB,CAgTtC;AAhTD,WAAiB,sBAAsB;IACxB,+BAAQ,GAAG,CAAC,KAIxB,EAAQ,EAAE;;QACT,0EAA0E;QAC1E,MAAM,MAAM,GACV,QAAQ,IAAI,KAAK,CAAC,MAAM;YACtB,CAAC,CAAE,KAAK,CAAC,MAAoB,CAAC,MAAM;YACpC,CAAC,CAAE,KAAK,CAAC,MAAiB,CAAC;QAE/B,uCAAuC;QACvC,MAAM,QAAQ,GAA4B,IAAI,GAAG,EAAE,CAAC;QAEpD,KAAK,MAAM,UAAU,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;YAC3C,IAAI,UAAU,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;gBACpC,uBAAuB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;YAChD,CAAC;iBAAM,CAAC;gBACN,sBAAsB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;YAC/C,CAA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AAuB,CAAC,SAAS,CAAC,CAAC;QAC9D,IACE,OAAO,SAAS,KAAK,QAAQ;YAC7B,MAAM,IAAI,SAAS;YACnB,SAAS,CAAC,IAAI,KAAK,QAAQ,EAC3B,CAAC;YACD,OAAO,SAAgC,CAAC;QAC1C,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;IAC5C,CAAC,CAAC;AACJ,CAAC,EAlTgB,sBAAsB,aAAtB,sBAAsB,GAAtB,sBAAsB,QAkTtC"}
@@ -1,248 +1,8 @@
1
- import { ListToolsRequestSchema, CallToolRequestSchema } from '@modelcontextprotocol/sdk/types.js';
2
- import { HttpLlm, LlmJson } from '@typia/utils';
3
- import { zodToJsonSchema } from 'zod-to-json-schema';
1
+ import { getDefaultExportFromCjs } from '../_virtual/_commonjsHelpers.mjs';
2
+ import { __require as requireMcpControllerRegistrar } from './McpControllerRegistrar2.mjs';
4
3
 
5
- var McpControllerRegistrar;
6
- (function (McpControllerRegistrar) {
7
- McpControllerRegistrar.register = (props) => {
8
- // McpServer wraps raw Server - we need raw Server for JSON Schema support
9
- const server = "server" in props.server
10
- ? props.server.server
11
- : props.server;
12
- // Build tool registry from controllers
13
- const registry = new Map();
14
- for (const controller of props.controllers) {
15
- if (controller.protocol === "class") {
16
- registerClassController(registry, controller);
17
- }
18
- else {
19
- registerHttpController(registry, controller);
20
- }
21
- }
22
- // Determine preserve mode (default: false)
23
- const preserve = props.preserve ?? false;
24
- if (preserve) {
25
- // PRESERVE MODE: Coexist with McpServer.registerTool()
26
- // Uses MCP SDK internal API (_registeredTools, _toolHandlersInitialized)
27
- registerWithPreserve(server, registry, props.server);
28
- }
29
- else {
30
- // STANDALONE MODE: Typia tools only, no private API dependency
31
- registerStandalone(server, registry);
32
- }
33
- };
34
- /**
35
- * Standalone registration without private API. Typia tools completely replace
36
- * any existing tool handlers.
37
- */
38
- const registerStandalone = (server, registry) => {
39
- // tools/list handler
40
- server.setRequestHandler(ListToolsRequestSchema, async () => ({
41
- tools: Array.from(registry.values()).map((entry) => ({
42
- name: entry.function.name,
43
- description: entry.function.description,
44
- inputSchema: {
45
- type: "object",
46
- properties: entry.function.parameters.properties,
47
- required: entry.function.parameters.required,
48
- additionalProperties: false,
49
- $defs: entry.function.parameters.$defs,
50
- },
51
- })),
52
- }));
53
- // tools/call handler
54
- server.setRequestHandler(CallToolRequestSchema, async (request) => {
55
- const name = request.params.name;
56
- const args = request.params.arguments;
57
- const entry = registry.get(name);
58
- if (entry !== undefined) {
59
- return handleToolCall(entry, args);
60
- }
61
- return {
62
- isError: true,
63
- content: [{ type: "text", text: `Unknown tool: ${name}` }],
64
- };
65
- });
66
- };
67
- /**
68
- * Preserve mode registration with private API. Coexists with tools registered
69
- * via McpServer.registerTool().
70
- */
71
- const registerWithPreserve = (server, registry, originalServer) => {
72
- // Get McpServer reference for coexistence with McpServer.registerTool()
73
- const mcpServer = "server" in originalServer ? originalServer : null;
74
- // Helper to get existing tools dynamically (supports tools registered after this call)
75
- const getExistingTools = () =>
76
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
77
- mcpServer ? (mcpServer._registeredTools ?? {}) : {};
78
- // Check for conflicts with existing McpServer tools at registration time
79
- for (const pair of Object.entries(getExistingTools())) {
80
- if (pair[1].enabled && registry.has(pair[0])) {
81
- throw new Error(`Duplicate function name "${pair[0]}" between McpServer.registerTool() and controller "${registry.get(pair[0]).controller}"`);
82
- }
83
- }
84
- // tools/list handler
85
- server.setRequestHandler(ListToolsRequestSchema, async () => {
86
- const existingTools = getExistingTools();
87
- return {
88
- tools: [
89
- // Typia controller tools
90
- ...Array.from(registry.values()).map((entry) => {
91
- return {
92
- name: entry.function.name,
93
- description: entry.function.description,
94
- inputSchema: {
95
- type: "object",
96
- properties: entry.function.parameters.properties,
97
- required: entry.function.parameters.required,
98
- additionalProperties: false,
99
- $defs: entry.function.parameters.$defs,
100
- },
101
- };
102
- }),
103
- // Existing McpServer tools
104
- ...Object.entries(existingTools)
105
- .filter((pair) => !registry.has(pair[0]) && pair[1].enabled)
106
- .map((pair) => {
107
- return {
108
- name: pair[0],
109
- description: pair[1].description,
110
- inputSchema: convertZodToJsonSchema(pair[1].inputSchema),
111
- };
112
- }),
113
- ],
114
- };
115
- });
116
- // tools/call handler
117
- server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
118
- const name = request.params.name;
119
- const args = request.params.arguments;
120
- // Check typia registry first
121
- const entry = registry.get(name);
122
- if (entry !== undefined) {
123
- return handleToolCall(entry, args);
124
- }
125
- // Fall back to existing McpServer tools
126
- const existingTools = getExistingTools();
127
- const existingTool = existingTools[name];
128
- if (existingTool && existingTool.enabled) {
129
- return existingTool.handler(args, extra);
130
- }
131
- return {
132
- isError: true,
133
- content: [{ type: "text", text: `Unknown tool: ${name}` }],
134
- };
135
- });
136
- // Mark handlers as initialized to prevent McpServer from overwriting
137
- if (mcpServer) {
138
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
139
- mcpServer._toolHandlersInitialized = true;
140
- }
141
- };
142
- const registerClassController = (registry, controller) => {
143
- const execute = controller.execute;
144
- for (const func of controller.application.functions) {
145
- const existing = registry.get(func.name);
146
- if (existing !== undefined) {
147
- throw new Error(`Duplicate function name "${func.name}" between controllers "${existing.controller}" and "${controller.name}"`);
148
- }
149
- const method = execute[func.name];
150
- if (typeof method !== "function") {
151
- throw new Error(`Method "${func.name}" not found on controller "${controller.name}"`);
152
- }
153
- registry.set(func.name, {
154
- controller: controller.name,
155
- function: func,
156
- execute: async (args) => method.call(execute, args),
157
- });
158
- }
159
- };
160
- const registerHttpController = (registry, controller) => {
161
- const application = controller.application;
162
- const connection = controller.connection;
163
- for (const func of application.functions) {
164
- const existing = registry.get(func.name);
165
- if (existing !== undefined) {
166
- throw new Error(`Duplicate function name "${func.name}" between controllers "${existing.controller}" and "${controller.name}"`);
167
- }
168
- registry.set(func.name, {
169
- controller: controller.name,
170
- function: func,
171
- execute: async (args) => {
172
- if (controller.execute !== undefined) {
173
- const response = await controller.execute({
174
- connection,
175
- application,
176
- function: func,
177
- arguments: args,
178
- });
179
- return response.body;
180
- }
181
- return HttpLlm.execute({
182
- application,
183
- function: func,
184
- connection,
185
- input: args,
186
- });
187
- },
188
- });
189
- }
190
- };
191
- const handleToolCall = async (entry, args) => {
192
- const coerced = LlmJson.coerce(args, entry.function.parameters);
193
- const validation = entry.function.validate(coerced);
194
- if (!validation.success) {
195
- return {
196
- isError: true,
197
- content: [
198
- {
199
- type: "text",
200
- text: LlmJson.stringify(validation),
201
- },
202
- ],
203
- };
204
- }
205
- try {
206
- const result = await entry.execute(validation.data);
207
- return {
208
- content: [
209
- {
210
- type: "text",
211
- text: result === undefined
212
- ? "Success"
213
- : JSON.stringify(result, null, 2),
214
- },
215
- ],
216
- };
217
- }
218
- catch (error) {
219
- return {
220
- isError: true,
221
- content: [
222
- {
223
- type: "text",
224
- text: error instanceof Error
225
- ? `${error.name}: ${error.message}`
226
- : String(error),
227
- },
228
- ],
229
- };
230
- }
231
- };
232
- const convertZodToJsonSchema = (zodSchema) => {
233
- if (zodSchema === undefined) {
234
- return { type: "object", properties: {} };
235
- }
236
- // @todo: error TS2589: Type instantiation is excessively deep and possibly infinite.
237
- const converted = zodToJsonSchema(zodSchema);
238
- if (typeof converted === "object" &&
239
- "type" in converted &&
240
- converted.type === "object") {
241
- return converted;
242
- }
243
- return { type: "object", properties: {} };
244
- };
245
- })(McpControllerRegistrar || (McpControllerRegistrar = {}));
4
+ var McpControllerRegistrarExports = requireMcpControllerRegistrar();
5
+ var McpControllerRegistrar = /*@__PURE__*/getDefaultExportFromCjs(McpControllerRegistrarExports);
246
6
 
247
- export { McpControllerRegistrar };
7
+ export { McpControllerRegistrar as default };
248
8
  //# sourceMappingURL=McpControllerRegistrar.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"McpControllerRegistrar.mjs","sources":["../../src/internal/McpControllerRegistrar.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAmBM,IAAW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AAA,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"McpControllerRegistrar.mjs","sources":["McpControllerRegistrar.js?commonjs-entry"],"sourcesContent":["import { getDefaultExportFromCjs } from \"\u0000commonjsHelpers.js\";\nimport { __require as requireMcpControllerRegistrar } from \"/home/samchon/github/samchon/typia@next/packages/mcp/lib/internal/McpControllerRegistrar.js\";\nvar McpControllerRegistrarExports = requireMcpControllerRegistrar();\nexport { McpControllerRegistrarExports as __moduleExports };\nexport default /*@__PURE__*/getDefaultExportFromCjs(McpControllerRegistrarExports);"],"names":[],"mappings":";;;AAEA,IAAI,6BAA6B,GAAG,6BAA6B,EAAE;AAEnE,6BAAe,aAAa,uBAAuB,CAAC,6BAA6B,CAAC;;;;"}
@@ -0,0 +1,278 @@
1
+ import { __exports as McpControllerRegistrar } from '../_virtual/McpControllerRegistrar.mjs';
2
+ import require$$0 from '@modelcontextprotocol/sdk/types.js';
3
+ import require$$1 from '@typia/utils';
4
+ import require$$2 from 'zod-to-json-schema';
5
+
6
+ var hasRequiredMcpControllerRegistrar;
7
+
8
+ function requireMcpControllerRegistrar () {
9
+ if (hasRequiredMcpControllerRegistrar) return McpControllerRegistrar;
10
+ hasRequiredMcpControllerRegistrar = 1;
11
+ var __awaiter = (McpControllerRegistrar && McpControllerRegistrar.__awaiter) || function (thisArg, _arguments, P, generator) {
12
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
+ return new (P || (P = Promise))(function (resolve, reject) {
14
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18
+ });
19
+ };
20
+ Object.defineProperty(McpControllerRegistrar, "__esModule", { value: true });
21
+ McpControllerRegistrar.McpControllerRegistrar = void 0;
22
+ const types_js_1 = require$$0;
23
+ const utils_1 = require$$1;
24
+ const zod_to_json_schema_1 = require$$2;
25
+ var McpControllerRegistrar$1;
26
+ (function (McpControllerRegistrar) {
27
+ McpControllerRegistrar.register = (props) => {
28
+ var _a;
29
+ // McpServer wraps raw Server - we need raw Server for JSON Schema support
30
+ const server = "server" in props.server
31
+ ? props.server.server
32
+ : props.server;
33
+ // Build tool registry from controllers
34
+ const registry = new Map();
35
+ for (const controller of props.controllers) {
36
+ if (controller.protocol === "class") {
37
+ registerClassController(registry, controller);
38
+ }
39
+ else {
40
+ registerHttpController(registry, controller);
41
+ }
42
+ }
43
+ // Determine preserve mode (default: false)
44
+ const preserve = (_a = props.preserve) !== null && _a !== void 0 ? _a : false;
45
+ if (preserve) {
46
+ // PRESERVE MODE: Coexist with McpServer.registerTool()
47
+ // Uses MCP SDK internal API (_registeredTools, _toolHandlersInitialized)
48
+ registerWithPreserve(server, registry, props.server);
49
+ }
50
+ else {
51
+ // STANDALONE MODE: Typia tools only, no private API dependency
52
+ registerStandalone(server, registry);
53
+ }
54
+ };
55
+ /**
56
+ * Standalone registration without private API. Typia tools completely replace
57
+ * any existing tool handlers.
58
+ */
59
+ const registerStandalone = (server, registry) => {
60
+ // tools/list handler
61
+ server.setRequestHandler(types_js_1.ListToolsRequestSchema, () => __awaiter(this, void 0, void 0, function* () {
62
+ return ({
63
+ tools: Array.from(registry.values()).map((entry) => ({
64
+ name: entry.function.name,
65
+ description: entry.function.description,
66
+ inputSchema: {
67
+ type: "object",
68
+ properties: entry.function.parameters.properties,
69
+ required: entry.function.parameters.required,
70
+ additionalProperties: false,
71
+ $defs: entry.function.parameters.$defs,
72
+ },
73
+ })),
74
+ });
75
+ }));
76
+ // tools/call handler
77
+ server.setRequestHandler(types_js_1.CallToolRequestSchema, (request) => __awaiter(this, void 0, void 0, function* () {
78
+ const name = request.params.name;
79
+ const args = request.params.arguments;
80
+ const entry = registry.get(name);
81
+ if (entry !== undefined) {
82
+ return handleToolCall(entry, args);
83
+ }
84
+ return {
85
+ isError: true,
86
+ content: [{ type: "text", text: `Unknown tool: ${name}` }],
87
+ };
88
+ }));
89
+ };
90
+ /**
91
+ * Preserve mode registration with private API. Coexists with tools registered
92
+ * via McpServer.registerTool().
93
+ */
94
+ const registerWithPreserve = (server, registry, originalServer) => {
95
+ // Get McpServer reference for coexistence with McpServer.registerTool()
96
+ const mcpServer = "server" in originalServer ? originalServer : null;
97
+ // Helper to get existing tools dynamically (supports tools registered after this call)
98
+ const getExistingTools = () => {
99
+ var _a;
100
+ if (mcpServer === null)
101
+ return {};
102
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
103
+ return (_a = mcpServer._registeredTools) !== null && _a !== void 0 ? _a : {};
104
+ };
105
+ // Check for conflicts with existing McpServer tools at registration time
106
+ for (const pair of Object.entries(getExistingTools())) {
107
+ if (pair[1].enabled && registry.has(pair[0])) {
108
+ throw new Error(`Duplicate function name "${pair[0]}" between McpServer.registerTool() and controller "${registry.get(pair[0]).controller}"`);
109
+ }
110
+ }
111
+ // tools/list handler
112
+ server.setRequestHandler(types_js_1.ListToolsRequestSchema, () => __awaiter(this, void 0, void 0, function* () {
113
+ const existingTools = getExistingTools();
114
+ return {
115
+ tools: [
116
+ // Typia controller tools
117
+ ...Array.from(registry.values()).map((entry) => {
118
+ return {
119
+ name: entry.function.name,
120
+ description: entry.function.description,
121
+ inputSchema: {
122
+ type: "object",
123
+ properties: entry.function.parameters.properties,
124
+ required: entry.function.parameters.required,
125
+ additionalProperties: false,
126
+ $defs: entry.function.parameters.$defs,
127
+ },
128
+ };
129
+ }),
130
+ // Existing McpServer tools
131
+ ...Object.entries(existingTools)
132
+ .filter((pair) => !registry.has(pair[0]) && pair[1].enabled)
133
+ .map((pair) => {
134
+ return {
135
+ name: pair[0],
136
+ description: pair[1].description,
137
+ inputSchema: convertZodToJsonSchema(pair[1].inputSchema),
138
+ };
139
+ }),
140
+ ],
141
+ };
142
+ }));
143
+ // tools/call handler
144
+ server.setRequestHandler(types_js_1.CallToolRequestSchema, (request, extra) => __awaiter(this, void 0, void 0, function* () {
145
+ const name = request.params.name;
146
+ const args = request.params.arguments;
147
+ // Check typia registry first
148
+ const entry = registry.get(name);
149
+ if (entry !== undefined) {
150
+ return handleToolCall(entry, args);
151
+ }
152
+ // Fall back to existing McpServer tools
153
+ const existingTools = getExistingTools();
154
+ const existingTool = existingTools[name];
155
+ if (existingTool && existingTool.enabled) {
156
+ return existingTool.handler(args, extra);
157
+ }
158
+ return {
159
+ isError: true,
160
+ content: [{ type: "text", text: `Unknown tool: ${name}` }],
161
+ };
162
+ }));
163
+ // Mark handlers as initialized to prevent McpServer from overwriting
164
+ if (mcpServer) {
165
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
166
+ mcpServer._toolHandlersInitialized = true;
167
+ }
168
+ };
169
+ const registerClassController = (registry, controller) => {
170
+ const execute = controller.execute;
171
+ for (const func of controller.application.functions) {
172
+ const existing = registry.get(func.name);
173
+ if (existing !== undefined) {
174
+ throw new Error(`Duplicate function name "${func.name}" between controllers "${existing.controller}" and "${controller.name}"`);
175
+ }
176
+ const method = execute[func.name];
177
+ if (typeof method !== "function") {
178
+ throw new Error(`Method "${func.name}" not found on controller "${controller.name}"`);
179
+ }
180
+ registry.set(func.name, {
181
+ controller: controller.name,
182
+ function: func,
183
+ execute: (args) => __awaiter(this, void 0, void 0, function* () { return method.call(execute, args); }),
184
+ });
185
+ }
186
+ };
187
+ const registerHttpController = (registry, controller) => {
188
+ const application = controller.application;
189
+ const connection = controller.connection;
190
+ for (const func of application.functions) {
191
+ const existing = registry.get(func.name);
192
+ if (existing !== undefined) {
193
+ throw new Error(`Duplicate function name "${func.name}" between controllers "${existing.controller}" and "${controller.name}"`);
194
+ }
195
+ registry.set(func.name, {
196
+ controller: controller.name,
197
+ function: func,
198
+ execute: (args) => __awaiter(this, void 0, void 0, function* () {
199
+ if (controller.execute !== undefined) {
200
+ const response = yield controller.execute({
201
+ connection,
202
+ application,
203
+ function: func,
204
+ arguments: args,
205
+ });
206
+ return response.body;
207
+ }
208
+ return utils_1.HttpLlm.execute({
209
+ application,
210
+ function: func,
211
+ connection,
212
+ input: args,
213
+ });
214
+ }),
215
+ });
216
+ }
217
+ };
218
+ const handleToolCall = (entry, args) => __awaiter(this, void 0, void 0, function* () {
219
+ const coerced = utils_1.LlmJson.coerce(args, entry.function.parameters);
220
+ const validation = entry.function.validate(coerced);
221
+ if (!validation.success) {
222
+ return {
223
+ isError: true,
224
+ content: [
225
+ {
226
+ type: "text",
227
+ text: utils_1.LlmJson.stringify(validation),
228
+ },
229
+ ],
230
+ };
231
+ }
232
+ try {
233
+ const result = yield entry.execute(validation.data);
234
+ return {
235
+ content: [
236
+ {
237
+ type: "text",
238
+ text: result === undefined
239
+ ? "Success"
240
+ : JSON.stringify(result, null, 2),
241
+ },
242
+ ],
243
+ };
244
+ }
245
+ catch (error) {
246
+ return {
247
+ isError: true,
248
+ content: [
249
+ {
250
+ type: "text",
251
+ text: error instanceof Error
252
+ ? `${error.name}: ${error.message}`
253
+ : String(error),
254
+ },
255
+ ],
256
+ };
257
+ }
258
+ });
259
+ const convertZodToJsonSchema = (zodSchema) => {
260
+ if (zodSchema === undefined) {
261
+ return { type: "object", properties: {} };
262
+ }
263
+ // @todo: error TS2589: Type instantiation is excessively deep and possibly infinite.
264
+ const converted = zod_to_json_schema_1.zodToJsonSchema(zodSchema);
265
+ if (typeof converted === "object" &&
266
+ "type" in converted &&
267
+ converted.type === "object") {
268
+ return converted;
269
+ }
270
+ return { type: "object", properties: {} };
271
+ };
272
+ })(McpControllerRegistrar$1 || (McpControllerRegistrar.McpControllerRegistrar = McpControllerRegistrar$1 = {}));
273
+
274
+ return McpControllerRegistrar;
275
+ }
276
+
277
+ export { requireMcpControllerRegistrar as __require };
278
+ //# sourceMappingURL=McpControllerRegistrar2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"McpControllerRegistrar2.mjs","sources":["McpControllerRegistrar.js"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.McpControllerRegistrar = void 0;\nconst types_js_1 = require(\"@modelcontextprotocol/sdk/types.js\");\nconst utils_1 = require(\"@typia/utils\");\nconst zod_to_json_schema_1 = require(\"zod-to-json-schema\");\nvar McpControllerRegistrar;\n(function (McpControllerRegistrar) {\n McpControllerRegistrar.register = (props) => {\n var _a;\n // McpServer wraps raw Server - we need raw Server for JSON Schema support\n const server = \"server\" in props.server\n ? props.server.server\n : props.server;\n // Build tool registry from controllers\n const registry = new Map();\n for (const controller of props.controllers) {\n if (controller.protocol === \"class\") {\n registerClassController(registry, controller);\n }\n else {\n registerHttpController(registry, controller);\n }\n }\n // Determine preserve mode (default: false)\n const preserve = (_a = props.preserve) !== null && _a !== void 0 ? _a : false;\n if (preserve) {\n // PRESERVE MODE: Coexist with McpServer.registerTool()\n // Uses MCP SDK internal API (_registeredTools, _toolHandlersInitialized)\n registerWithPreserve(server, registry, props.server);\n }\n else {\n // STANDALONE MODE: Typia tools only, no private API dependency\n registerStandalone(server, registry);\n }\n };\n /**\n * Standalone registration without private API. Typia tools completely replace\n * any existing tool handlers.\n */\n const registerStandalone = (server, registry) => {\n // tools/list handler\n server.setRequestHandler(types_js_1.ListToolsRequestSchema, () => __awaiter(this, void 0, void 0, function* () {\n return ({\n tools: Array.from(registry.values()).map((entry) => ({\n name: entry.function.name,\n description: entry.function.description,\n inputSchema: {\n type: \"object\",\n properties: entry.function.parameters.properties,\n required: entry.function.parameters.required,\n additionalProperties: false,\n $defs: entry.function.parameters.$defs,\n },\n })),\n });\n }));\n // tools/call handler\n server.setRequestHandler(types_js_1.CallToolRequestSchema, (request) => __awaiter(this, void 0, void 0, function* () {\n const name = request.params.name;\n const args = request.params.arguments;\n const entry = registry.get(name);\n if (entry !== undefined) {\n return handleToolCall(entry, args);\n }\n return {\n isError: true,\n content: [{ type: \"text\", text: `Unknown tool: ${name}` }],\n };\n }));\n };\n /**\n * Preserve mode registration with private API. Coexists with tools registered\n * via McpServer.registerTool().\n */\n const registerWithPreserve = (server, registry, originalServer) => {\n // Get McpServer reference for coexistence with McpServer.registerTool()\n const mcpServer = \"server\" in originalServer ? originalServer : null;\n // Helper to get existing tools dynamically (supports tools registered after this call)\n const getExistingTools = () => {\n var _a;\n if (mcpServer === null)\n return {};\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (_a = mcpServer._registeredTools) !== null && _a !== void 0 ? _a : {};\n };\n // Check for conflicts with existing McpServer tools at registration time\n for (const pair of Object.entries(getExistingTools())) {\n if (pair[1].enabled && registry.has(pair[0])) {\n throw new Error(`Duplicate function name \"${pair[0]}\" between McpServer.registerTool() and controller \"${registry.get(pair[0]).controller}\"`);\n }\n }\n // tools/list handler\n server.setRequestHandler(types_js_1.ListToolsRequestSchema, () => __awaiter(this, void 0, void 0, function* () {\n const existingTools = getExistingTools();\n return {\n tools: [\n // Typia controller tools\n ...Array.from(registry.values()).map((entry) => {\n return {\n name: entry.function.name,\n description: entry.function.description,\n inputSchema: {\n type: \"object\",\n properties: entry.function.parameters.properties,\n required: entry.function.parameters.required,\n additionalProperties: false,\n $defs: entry.function.parameters.$defs,\n },\n };\n }),\n // Existing McpServer tools\n ...Object.entries(existingTools)\n .filter((pair) => !registry.has(pair[0]) && pair[1].enabled)\n .map((pair) => {\n return {\n name: pair[0],\n description: pair[1].description,\n inputSchema: convertZodToJsonSchema(pair[1].inputSchema),\n };\n }),\n ],\n };\n }));\n // tools/call handler\n server.setRequestHandler(types_js_1.CallToolRequestSchema, (request, extra) => __awaiter(this, void 0, void 0, function* () {\n const name = request.params.name;\n const args = request.params.arguments;\n // Check typia registry first\n const entry = registry.get(name);\n if (entry !== undefined) {\n return handleToolCall(entry, args);\n }\n // Fall back to existing McpServer tools\n const existingTools = getExistingTools();\n const existingTool = existingTools[name];\n if (existingTool && existingTool.enabled) {\n return existingTool.handler(args, extra);\n }\n return {\n isError: true,\n content: [{ type: \"text\", text: `Unknown tool: ${name}` }],\n };\n }));\n // Mark handlers as initialized to prevent McpServer from overwriting\n if (mcpServer) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n mcpServer._toolHandlersInitialized = true;\n }\n };\n const registerClassController = (registry, controller) => {\n const execute = controller.execute;\n for (const func of controller.application.functions) {\n const existing = registry.get(func.name);\n if (existing !== undefined) {\n throw new Error(`Duplicate function name \"${func.name}\" between controllers \"${existing.controller}\" and \"${controller.name}\"`);\n }\n const method = execute[func.name];\n if (typeof method !== \"function\") {\n throw new Error(`Method \"${func.name}\" not found on controller \"${controller.name}\"`);\n }\n registry.set(func.name, {\n controller: controller.name,\n function: func,\n execute: (args) => __awaiter(this, void 0, void 0, function* () { return method.call(execute, args); }),\n });\n }\n };\n const registerHttpController = (registry, controller) => {\n const application = controller.application;\n const connection = controller.connection;\n for (const func of application.functions) {\n const existing = registry.get(func.name);\n if (existing !== undefined) {\n throw new Error(`Duplicate function name \"${func.name}\" between controllers \"${existing.controller}\" and \"${controller.name}\"`);\n }\n registry.set(func.name, {\n controller: controller.name,\n function: func,\n execute: (args) => __awaiter(this, void 0, void 0, function* () {\n if (controller.execute !== undefined) {\n const response = yield controller.execute({\n connection,\n application,\n function: func,\n arguments: args,\n });\n return response.body;\n }\n return utils_1.HttpLlm.execute({\n application,\n function: func,\n connection,\n input: args,\n });\n }),\n });\n }\n };\n const handleToolCall = (entry, args) => __awaiter(this, void 0, void 0, function* () {\n const coerced = utils_1.LlmJson.coerce(args, entry.function.parameters);\n const validation = entry.function.validate(coerced);\n if (!validation.success) {\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text: utils_1.LlmJson.stringify(validation),\n },\n ],\n };\n }\n try {\n const result = yield entry.execute(validation.data);\n return {\n content: [\n {\n type: \"text\",\n text: result === undefined\n ? \"Success\"\n : JSON.stringify(result, null, 2),\n },\n ],\n };\n }\n catch (error) {\n return {\n isError: true,\n content: [\n {\n type: \"text\",\n text: error instanceof Error\n ? `${error.name}: ${error.message}`\n : String(error),\n },\n ],\n };\n }\n });\n const convertZodToJsonSchema = (zodSchema) => {\n if (zodSchema === undefined) {\n return { type: \"object\", properties: {} };\n }\n // @todo: error TS2589: Type instantiation is excessively deep and possibly infinite.\n const converted = zod_to_json_schema_1.zodToJsonSchema(zodSchema);\n if (typeof converted === \"object\" &&\n \"type\" in converted &&\n converted.type === \"object\") {\n return converted;\n }\n return { type: \"object\", properties: {} };\n };\n})(McpControllerRegistrar || (exports.McpControllerRegistrar = McpControllerRegistrar = {}));\n//# sourceMappingURL=McpControllerRegistrar.js.map"],"names":["this","McpControllerRegistrar_1","McpControllerRegistrar"],"mappings":";;;;;;;;;;AACA,CAAA,IAAI,SAAS,GAAG,CAACA,sBAAI,IAAIA,sBAAI,CAAC,SAAS,KAAK,UAAU,OAAO,EAAE,UAAU,EAAE,CAAC,EAAE,SAAS,EAAE;KACrF,SAAS,KAAK,CAAC,KAAK,EAAE,EAAE,OAAO,KAAK,YAAY,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,UAAU,OAAO,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA,CAAE,CAAC,CAAC,CAAA;AAC9G,KAAI,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,EAAE,UAAU,OAAO,EAAE,MAAM,EAAE;AAC/D,SAAQ,SAAS,SAAS,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA,CAAE,CAAC,O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O,CAAC;+BAChC,MAAM,CAAC,KAAK,CAAC;sBACtB;kBACJ;cACJ;AACb,SAAA;AACA,KAAA,CAAK,CAAC;AACN,KAAI,MAAM,sBAAsB,GAAG,CAAC,SAAS,KAAK;AAClD,SAAQ,IAAI,SAAS,KAAK,SAAS,EAAE;aACzB,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE;AACrD,SAAA;AACA;SACQ,MAAM,SAAS,GAAG,oBAAoB,CAAC,eAAe,CAAC,SAAS,CAAC;AACzE,SAAQ,IAAI,OAAO,SAAS,KAAK,QAAQ;aAC7B,MAAM,IAAI,SAAS;AAC/B,aAAY,SAAS,CAAC,IAAI,KAAK,QAAQ,EAAE;AACzC,aAAY,OAAO,SAAS;AAC5B,SAAA;SACQ,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE;KACjD,CAAK;CACL,CAAC,EAAEA,wBAAsB,KAAKD,sBAAA,CAAA,sBAA8B,GAAGC,wBAAsB,GAAG,EAAE,CAAC,CAAC;AAC5F;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typia/mcp",
3
- "version": "12.1.0-dev.20260325",
3
+ "version": "13.0.0-dev.20260426",
4
4
  "description": "MCP (Model Context Protocol) integration for typia",
5
5
  "main": "lib/index.js",
6
6
  "exports": {
@@ -23,8 +23,8 @@
23
23
  "homepage": "https://typia.io",
24
24
  "dependencies": {
25
25
  "zod-to-json-schema": ">=3.24.0",
26
- "@typia/interface": "^12.1.0-dev.20260325",
27
- "@typia/utils": "^12.1.0-dev.20260325"
26
+ "@typia/interface": "^13.0.0-dev.20260426",
27
+ "@typia/utils": "^13.0.0-dev.20260426"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@modelcontextprotocol/sdk": ">=1.0.0"
@@ -33,14 +33,14 @@
33
33
  "@modelcontextprotocol/sdk": "^1.26.0",
34
34
  "@rollup/plugin-commonjs": "^29.0.0",
35
35
  "@rollup/plugin-node-resolve": "^16.0.3",
36
- "@rollup/plugin-typescript": "^12.3.0",
36
+ "@typescript/native-preview": "7.0.0-dev.20260421.2",
37
37
  "rimraf": "^6.1.2",
38
38
  "rollup": "^4.56.0",
39
39
  "rollup-plugin-auto-external": "^2.0.0",
40
40
  "rollup-plugin-node-externals": "^8.1.2",
41
41
  "tinyglobby": "^0.2.12",
42
- "typescript": "~6.0.2",
43
- "zod": "^3.25.0"
42
+ "zod": "^3.25.0",
43
+ "ttsc": "^0.4.2"
44
44
  },
45
45
  "sideEffects": false,
46
46
  "files": [
@@ -61,15 +61,14 @@
61
61
  "chatgpt",
62
62
  "gemini",
63
63
  "validation",
64
- "json-schema",
65
- "typescript"
64
+ "json-schema"
66
65
  ],
67
66
  "publishConfig": {
68
67
  "access": "public"
69
68
  },
70
69
  "scripts": {
71
- "build": "rimraf lib && tsc && rollup -c",
72
- "dev": "rimraf lib && tsc --watch"
70
+ "build": "rimraf lib && ttsc && rollup -c",
71
+ "dev": "ttsc --watch"
73
72
  },
74
73
  "module": "lib/index.mjs",
75
74
  "types": "lib/index.d.ts"
@@ -108,9 +108,11 @@ export namespace McpControllerRegistrar {
108
108
  "server" in originalServer ? (originalServer as McpServer) : null;
109
109
 
110
110
  // Helper to get existing tools dynamically (supports tools registered after this call)
111
- const getExistingTools = (): Record<string, any> =>
111
+ const getExistingTools = (): Record<string, any> => {
112
+ if (mcpServer === null) return {};
112
113
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
113
- mcpServer ? ((mcpServer as any)._registeredTools ?? {}) : {};
114
+ return (mcpServer as any)._registeredTools ?? {};
115
+ };
114
116
 
115
117
  // Check for conflicts with existing McpServer tools at registration time
116
118
  for (const pair of Object.entries(getExistingTools())) {