-
Notifications
You must be signed in to change notification settings - Fork 208
Extend the MCP tool wrapper to work with stdio #307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Extend the MCP tool wrapper to work with stdio #307
Conversation
22a72eb
to
dd0f744
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR extends the MCP tool wrapper to support stdio mode in addition to the existing SSE mode. Key changes include:
- Updating the MCPToolConfig schema and client builder to support stdio parameters (command, args, env).
- Refactoring the MCP client structure by introducing a base client and a dedicated MCPStdioClient.
- Enhancing CLI commands, tests, and documentation to demonstrate and verify the stdio mode usage.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
tests/aiq/tools/test_mcp.py | Added tests for both SSE and stdio client usage, and for the MCPBuilder functionality. |
src/aiq/tool/mcp/mcp_tool.py | Updated configuration handling to support stdio mode with new parameters and validation. |
src/aiq/tool/mcp/mcp_client.py | Refactored client architecture by introducing a base client and a dedicated MCPStdioClient, and updated MCPBuilder accordingly. |
src/aiq/cli/commands/info/list_mcp.py | Enhanced CLI options to support stdio mode configuration including command, args, and environment variables. |
examples/simple_calculator/src/aiq_simple_calculator/configs/config-mcp-date-stdio.yml | Added sample config demonstrating usage of MCP stdio mode. |
docs/source/workflows/mcp/mcp-client.md | Updated documentation to include examples and explanation for both SSE and stdio mode configurations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could improve design a bit now that we have two client types by removing MCPBuilder
0eea228
to
22f704a
Compare
Sample Usage: aiq info mcp --client-type stdio --command python --args "-m mcp_server_time --local-timezone=America/Los_Angeles" Sample Output: get_current_time convert_time Signed-off-by: Anuradha Karuppiah <[email protected]>
Signed-off-by: Anuradha Karuppiah <[email protected]>
Signed-off-by: Anuradha Karuppiah <[email protected]>
Signed-off-by: Anuradha Karuppiah <[email protected]>
Signed-off-by: Anuradha Karuppiah <[email protected]>
Signed-off-by: Anuradha Karuppiah <[email protected]>
Signed-off-by: Anuradha Karuppiah <[email protected]>
Signed-off-by: Anuradha Karuppiah <[email protected]>
Signed-off-by: Anuradha Karuppiah <[email protected]>
Co-authored-by: Copilot <[email protected]> Signed-off-by: Anuradha Karuppiah <[email protected]>
Co-authored-by: Copilot <[email protected]> Signed-off-by: Anuradha Karuppiah <[email protected]>
Signed-off-by: Anuradha Karuppiah <[email protected]>
Signed-off-by: Anuradha Karuppiah <[email protected]>
Signed-off-by: Anuradha Karuppiah <[email protected]>
Signed-off-by: Anuradha Karuppiah <[email protected]>
Signed-off-by: Anuradha Karuppiah <[email protected]>
Signed-off-by: Michael Demoret <[email protected]>
Signed-off-by: Anuradha Karuppiah <[email protected]>
e7aa3f7
to
e5b4d5f
Compare
Description
Closes #304
This PR extends the MCP tool client usage via stdio using a format similar to cursor/claude-desktop i.e. by providing {tool_name, command, args, env}
The MCP stdio_client connects to a server by spawning a process and communicating with it over stdin/stdout.
Note: MCP SSE client is the recommended way for accessing remote tools and remains the default. The MCP stdio client is available for rapid-development/easy prototyping.
A. Sample usage with github MCP service
Sample Output:
B. Sample usage with datetime MCP service
0. Install mcp_server_time package in your venv:
Sample Output:
config-mcp-date-stdio.yml
) -By Submitting this PR I confirm: