Skip to content

fix(chat): implement a real MCP client in McpToolConverter - #387

Open
robbee wants to merge 1 commit into
AIDotNet:mainfrom
robbee:fix/mcp-tool-converter-real-client
Open

fix(chat): implement a real MCP client in McpToolConverter#387
robbee wants to merge 1 commit into
AIDotNet:mainfrom
robbee:fix/mcp-tool-converter-real-client

Conversation

@robbee

@robbee robbee commented Aug 13, 2026

Copy link
Copy Markdown

Summary

  • The chat assistant's MCP provider integration (Admin > Tools > MCPsEnabledMcpIds) sent a raw {"input": "..."} POST instead of speaking the MCP JSON-RPC protocol, so it failed against any spec-compliant MCP server — including OpenDeepWiki's own /api/mcp — with 406 Not Acceptable: Client must accept both application/json and text/event-stream.
  • Replaced the hand-rolled HTTP call with the official ModelContextProtocol.Client SDK: it now connects over Streamable HTTP, performs the real handshake, and exposes each tool the server advertises individually to the agent (via McpClientTool, which is itself an AIFunction) instead of one opaque wrapper tool.
  • Bumped the ModelContextProtocol package to 1.3.0 in Directory.Packages.props to match ModelContextProtocol.AspNetCore and resolve a NU1605 downgrade error that surfaced once the client package was referenced directly.

Test plan

  • docker compose build opendeepwiki succeeds with 0 errors
  • Configured a self-referential MCP provider (http://localhost:8080/api/mcp) and enabled it on the Chat Assistant
  • Asked a cross-repository question from a single repo's chat widget; confirmed via logs that Loaded N tools from MCP server replaces the old Not Acceptable failure

🤖 Generated with Claude Code

The chat assistant's "MCP provider" tool integration posted a raw
{"input": "..."} body to the configured server instead of speaking
the MCP JSON-RPC protocol, so it failed against any spec-compliant
MCP server (including OpenDeepWiki's own /api/mcp) with
"406 Not Acceptable: Client must accept both application/json and
text/event-stream".

Replace it with the official ModelContextProtocol.Client SDK:
connect over Streamable HTTP, list the server's real tools, and
expose each one individually to the agent (via McpClientTool, which
is itself an AIFunction) instead of one opaque wrapper tool. Bump
the ModelContextProtocol package to 1.3.0 to match
ModelContextProtocol.AspNetCore and resolve a NU1605 downgrade
error.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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