Skip to content

Commit b47644a

Browse files
committed
fix: clients sending undefined to introspect breaks tool
This forces an input that doesn't break by just adding an optional argument that doesn't do anything. Fixes #24
1 parent 6e38845 commit b47644a

File tree

2 files changed

+34
-33
lines changed

2 files changed

+34
-33
lines changed

package.json

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,32 @@
11
{
2-
"name": "mcp-graphql",
3-
"module": "index.ts",
4-
"type": "module",
5-
"version": "2.0.1",
6-
"repository": "github:blurrah/mcp-graphql",
7-
"license": "MIT",
8-
"bin": {
9-
"mcp-graphql": "./dist/index.js"
10-
},
11-
"files": [
12-
"dist"
13-
],
14-
"devDependencies": {
15-
"@graphql-tools/schema": "^10.0.21",
16-
"@types/bun": "latest",
17-
"@types/yargs": "17.0.33",
18-
"graphql-yoga": "^5.13.1",
19-
"typescript": "5.8.2"
20-
},
21-
"dependencies": {
22-
"@modelcontextprotocol/sdk": "1.6.1",
23-
"graphql": "^16.10.0",
24-
"yargs": "17.7.2",
25-
"zod": "3.24.2",
26-
"zod-to-json-schema": "3.24.3"
27-
},
28-
"scripts": {
29-
"dev": "bun --watch src/index.ts",
30-
"build": "bun build src/index.ts --outdir dist --target node && bun -e \"require('fs').chmodSync('dist/index.js', '755')\"",
31-
"start": "bun run dist/index.js"
32-
},
33-
"packageManager": "bun@1.2.4"
2+
"name": "mcp-graphql",
3+
"module": "index.ts",
4+
"type": "module",
5+
"version": "2.0.2",
6+
"repository": "github:blurrah/mcp-graphql",
7+
"license": "MIT",
8+
"bin": {
9+
"mcp-graphql": "./dist/index.js"
10+
},
11+
"files": ["dist"],
12+
"devDependencies": {
13+
"@graphql-tools/schema": "^10.0.21",
14+
"@types/bun": "latest",
15+
"@types/yargs": "17.0.33",
16+
"graphql-yoga": "^5.13.1",
17+
"typescript": "5.8.2"
18+
},
19+
"dependencies": {
20+
"@modelcontextprotocol/sdk": "1.6.1",
21+
"graphql": "^16.10.0",
22+
"yargs": "17.7.2",
23+
"zod": "3.24.2",
24+
"zod-to-json-schema": "3.24.3"
25+
},
26+
"scripts": {
27+
"dev": "bun --watch src/index.ts",
28+
"build": "bun build src/index.ts --outdir dist --target node && bun -e \"require('fs').chmodSync('dist/index.js', '755')\"",
29+
"start": "bun run dist/index.js"
30+
},
31+
"packageManager": "bun@1.2.4"
3432
}

src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ server.resource("graphql-schema", new URL(env.ENDPOINT).href, async (uri) => {
6767
server.tool(
6868
"introspect-schema",
6969
"Introspect the GraphQL schema, use this tool before doing a query to get the schema information if you do not have it available as a resource already.",
70-
{},
70+
{
71+
// This is a fix for certain clients sending an undefined argument, breaking the tool.
72+
argument: z.string().optional().describe("This doesn't do anything"),
73+
},
7174
async () => {
7275
try {
7376
let schema: string;

0 commit comments

Comments
 (0)