modelcontextprotocol / modelcontextprotocol/typescript-sdk

KIMI mcp integration fix

Open
#2,257 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

potentially close
Dominant language
TypeScript
Stars
13.4k
Forks
2.2k
Avg merge
3d 15h
Merged PRs (30d)
4

Description

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @modelcontextprotocol/sdk@1.29.0 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-json-schema-compat.js b/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-json-schema-compat.js
index bc067da..ad3237f 100644
--- a/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-json-schema-compat.js
+++ b/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-json-schema-compat.js
@@ -54,7 +54,9 @@ function toJsonSchemaCompat(schema, opts) {
     // v3 branch — use vendored converter
     return (0, zod_to_json_schema_1.zodToJsonSchema)(schema, {
         strictUnions: opts?.strictUnions ?? true,
-        pipeStrategy: opts?.pipeStrategy ?? 'input'
+        pipeStrategy: opts?.pipeStrategy ?? 'input',
+        definitionPath: "$defs",
+        $refStrategy: "none"
     });
 }
 function getMethodLiteral(schema) {
diff --git a/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js b/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
index 62f7fd0..4965ae1 100644
--- a/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
+++ b/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
@@ -26,7 +26,9 @@ export function toJsonSchemaCompat(schema, opts) {
     // v3 branch — use vendored converter
     return zodToJsonSchema(schema, {
         strictUnions: opts?.strictUnions ?? true,
-        pipeStrategy: opts?.pipeStrategy ?? 'input'
+        pipeStrategy: opts?.pipeStrategy ?? 'input',
+        definitionPath: "$defs",
+        $refStrategy: "none"
     });
 }
 export function getMethodLiteral(schema) {

This issue body was partially generated by patch-package.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the source corresponding to the mentioned dist/cjs/server/zod-json-schema-compat.js and dist/esm/server/zod-json-schema-compat.js files, then read how the SDK's Zod-to-JSON-Schema conversion is built and tested. Reproduce the KIMI integration problem and verify that the conversion uses the required $defs definition path and avoids unwanted references in both module outputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.