feat(sdk): add MCP (Model Context Protocol) client support - #24
Open
matebenyovszky wants to merge 1 commit into
Open
feat(sdk): add MCP (Model Context Protocol) client support#24matebenyovszky wants to merge 1 commit into
matebenyovszky wants to merge 1 commit into
Conversation
Adds the ability to connect the agent to MCP servers and expose their tools alongside the built-in Office/bash tools. - sdk/mcp: minimal Streamable HTTP MCP client (initialize, tools/list, tools/call with SSE parsing + session handling), config load/save in localStorage (`<prefix>-mcp-config`), and loadMcpTools() which wraps each server's tools as AgentTools (named `<server>_<tool>`). - runtime: load MCP tools during init() before the agent is built, merge them into the tool list, and expose reloadMcpTools(). - core: ChatController.reloadMcpTools() passthrough and a "MCP servers" section in the settings panel (add/remove/enable servers, save & reload). No secrets are stored in code — server URLs live in localStorage like provider config. For an http:// MCP server behind the browser, point the configured URL at a localhost proxy (Chromium allows https->http://localhost). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Author
|
@hewliyang could you please review? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds Model Context Protocol (MCP) support so the agent can connect to MCP servers and use their tools alongside the built-in Office/bash tools.
Why
MCP is becoming a common way to expose tools/data to agents (databases, internal APIs, etc.). This lets an Office Agent reach those without hard-coding app-specific tools.
Changes
packages/sdk/src/mcp/(new): a minimal, browser-only Streamable HTTP MCP client —initialize,notifications/initialized,tools/list,tools/callwith SSE parsing andmcp-session-idhandling. PlusloadMcpConfig/saveMcpConfig(localStorage) andloadMcpTools()which wraps each enabled server's tools asAgentTools (named<server>_<tool>). A failing server is logged and skipped — never throws.runtime.ts: loads MCP tools duringinit()before the agent is built (so they're included), merges them into thetoolsgetter, and addsreloadMcpTools().core:ChatController.reloadMcpTools()passthrough and a new "MCP servers" section in the settings panel (add/remove/enable servers, Save & Reload).Notes
localStorage(<prefix>-mcp-config), same as provider config.http://MCP server is blocked by the browser except onlocalhost. For a remotehttp://server, point the configured URL at a local proxy (or serve the MCP endpoint over HTTPS).strictis left off, so tool JSON Schemas are passed through as-is; existing Office tools are unaffected (verified: Office + MCP tools coexist and the model picks the right one).tscpasses for@office-agents/sdk;svelte-checkpasses for@office-agents/core.Testing
Verified end-to-end against a FastMCP
mssql-mcpserver (via a localhost proxy): tools load into the agent and are callable from Excel/PowerPoint/Word.🤖 Generated with Claude Code