Skip to content

Conversation

@takumiyoshikawa
Copy link
Contributor

Related Issues

#6

Summary

In this PR, I modify the mcp-graphql's mcp-server to allow receiving headers and endpoints from the mcp-client.
With this change, even if the MCP Client deploys the GraphQL server to some BaaS, it will be able to send requests without modifying the mcp-graphql configuration.

@blurrah
Copy link
Owner

blurrah commented Mar 11, 2025

Thanks! I do think we should stress in the description/name of the tool input that they're additional, otherwise models might keep filling in those fields while they're optional. Same for potential headers, should let them know which headers are already used

@takumiyoshikawa
Copy link
Contributor Author

takumiyoshikawa commented Mar 12, 2025

I did some research, and according to the mcp spec, parameters can have a description.

It seems good to add an explanation such as 'Optional: Override the default endpoint' to the parameters.

When I tried it like this, it was successfully added to the parameter:

	{
		endpoint: z.string().url().optional().describe("Optional: Override the default endpoint"),
		headers: z.union([z.record(z.string()), z.string()]).optional().describe("Optional: Add header configurations to the default headers"),
	},

What do you think?

@blurrah
Copy link
Owner

blurrah commented Mar 12, 2025

Ah good one, way better! Would also add a stringified json of the already configured headers so it knows whether it needs to override

@takumiyoshikawa
Copy link
Contributor Author

takumiyoshikawa commented Mar 12, 2025

Is it correct that you mean adding the current header to headers.describe?
In that case, would the header be completely overwritten?

If you could share a bit more of a concrete idea, I can work on this together with the previous comment.
Please let me know!

IMO, it might be a good idea to set up a tool like getCurrentConfig that returns the configuration currently set on the mcp-client side.

@blurrah
Copy link
Owner

blurrah commented Mar 12, 2025

Yeah so my idea would be:

.describe(`Optional: Add additional headers, the already used headers are: ${JSON.stringify(config.headers)}`)

Also in regards to setting up a config tool, I'm actually not sure whether MCP clients already get this information directly. Will check that out but can always add it in a separate PR.

@takumiyoshikawa
Copy link
Contributor Author

takumiyoshikawa commented Mar 13, 2025

Screenshot 2025-03-13 at 10 50 16
Based on our previous discussion, I've made changes.
I'd appreciate it if you could check them!

@blurrah
Copy link
Owner

blurrah commented Mar 13, 2025

Thanks! Merging and will release asap

@blurrah blurrah merged commit 46d3436 into blurrah:main Mar 13, 2025
2 checks passed
@takumiyoshikawa takumiyoshikawa deleted the feat/accept-graphql-info-from-client branch March 13, 2025 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants