Conversation
bb74ff7 to
ac59a0d
Compare
This commit introduces initial support for MCP. It integrates the MCP server tools into the existing function declaration implementation.
ac59a0d to
eccc318
Compare
Add a permission system for tool calls.
076e03a to
0892fbb
Compare
|
Is this still WIP or is it ready to test out? |
|
I tried this branch and have some notes:
|
|
Denied tools should not appear as usable tools to the LLM. They should be completely removed. |
|
Ideally, an MCP server would only start when In general, I would say the blockers right now are |
This commit introduces initial support for MCP. It integrates the MCP server tools into the existing function declaration implementation. I still have a couple items to finish on this PR, but I wanted to put up a draft early to get some feedback. I read some of the backlog of issues around MCP, and see that there is some desire from users to have native MCP client support, so I put this PR together. Feel free to close if you don't feel like native MCP client support is something you want to see in aichat proper.
Architecture overview
The PR introduces a couple of new types:
McpClientandMcpManager.McpClientis a wrapper/owner type that owns the corresponding MCP server. This type implements thermcpclient traits necessary to call the RPC methods on its peer MCP server process.McpManageris a collection manager owning each instance ofMcpClient. It exposes an API that allows introspecting the tools that are supported by each MCP server and passing tool calls down to the MCP server. As each tool is discovered, it gets translated into aFunctionDeclarationso that the MCP tool calling uses a similar logic to the native function calling.The configuration data structure is updated to declare
mcp_serversin a YAML array. The REPL has a few new commands to inspect and interact with MCP servers.Tool calls can be configured to run automatically or via "human in the loop" prompting. To preserve existing function calling behavior, the default permission is "always", however tools can be set to "always", "ask" or "deny" by using simple glob-style pattern matching.
TODO
Fixes: #1346