Skip to content

feat: Add VS Code MCP client compatibility#123

Open
trickyfalcon wants to merge 1 commit intoGitGuardian:mainfrom
trickyfalcon:feat/vscode-mcp-client-compatibility
Open

feat: Add VS Code MCP client compatibility#123
trickyfalcon wants to merge 1 commit intoGitGuardian:mainfrom
trickyfalcon:feat/vscode-mcp-client-compatibility

Conversation

@trickyfalcon
Copy link
Copy Markdown

Summary

VS Code's MCP client has several incompatibilities with the protocol features enabled by FastMCP 2.x + mcp 1.24 (protocol version 2025-11-25), causing silent failures when trying to use the GitGuardian MCP server from VS Code. This PR fixes all known incompatibilities:

  • Protocol version downgrade: Forces 2024-11-05 (the stable version VS Code supports) instead of 2025-11-25
  • Disable outputSchema: VS Code silently fails to call tools that include auto-generated outputSchema from Pydantic return types
  • Strip structuredContent: Removes structuredContent from CallToolResult responses (unsupported 2025-11-25 feature)
  • Inline $ref/$defs in inputSchema: Flattens JSON Schema references that VS Code's MCP client cannot resolve
  • Remove tasks capability: VS Code may attempt to use the task protocol, causing "no response" errors
  • Disable FastMCP _meta field: Prevents _meta fields in tool definitions that VS Code doesn't understand

Problem

When using the GitGuardian MCP server with VS Code, tools either don't appear or fail silently when called. This is because FastMCP 2.x negotiates protocol version 2025-11-25 which includes features VS Code hasn't implemented yet. The failures are silent — no error messages are shown to the user, tools simply don't work.

Changes

All changes are in packages/gg_api_core/src/gg_api_core/mcp_server.py:

  1. Added _resolve_schema_refs() helper to inline $ref/$defs in JSON Schemas
  2. Patched mcp.server.session to advertise protocol version 2024-11-05
  3. Override __init__ to disable include_fastmcp_meta and patch out tasks capability
  4. Override tool() to force output_schema=None
  5. Override _call_tool_mcp() to strip structuredContent from results
  6. Override _list_tools_mcp() to flatten $ref/$defs in tool schemas

Test plan

  • Verify MCP server starts successfully with VS Code
  • Verify all tools appear in VS Code's MCP tool list
  • Verify tool calls work correctly (no silent failures)
  • Verify existing Cursor/Claude Desktop integrations still work (no regression)
  • Verify protocol negotiation returns 2024-11-05

🤖 Generated with Claude Code

VS Code's MCP client has several incompatibilities with the protocol
features enabled by FastMCP 2.x + mcp 1.24 (protocol version 2025-11-25).
This causes silent failures when trying to use the GitGuardian MCP server
from VS Code.

This patch addresses the following issues:

1. **Protocol version**: Force 2024-11-05 (the stable version VS Code
   supports) instead of 2025-11-25 which enables unsupported features.

2. **outputSchema**: Disable auto-generated outputSchema from Pydantic
   return types - VS Code silently fails to call tools that include it.

3. **structuredContent**: Strip structuredContent from CallToolResult
   responses - VS Code doesn't support this 2025-11-25 feature.

4. **$ref/$defs in inputSchema**: Inline all JSON Schema references to
   produce flat schemas - VS Code can't resolve $ref/$defs references.

5. **Tasks capability**: Patch server to not advertise tasks capability -
   VS Code may try to use the task protocol causing "no response" errors.

6. **FastMCP _meta field**: Disable include_fastmcp_meta to prevent
   _meta fields in tool definitions that VS Code doesn't understand.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@timothedelion
Copy link
Copy Markdown
Collaborator

Hello @trickyfalcon

Thanks for reporting this. The package now uses FastMCP 3.x. Can you check if it solves your issue ?

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