-
Notifications
You must be signed in to change notification settings - Fork 218
FEAT: Enable MCP client tool for Agent #1678
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
FEAT: Enable MCP client tool for Agent #1678
Conversation
Signed-off-by: lvliang-intel <liang1.lv@intel.com>
…to agent_mcp_client Signed-off-by: lvliang-intel <liang1.lv@intel.com>
for more information, see https://pre-commit.ci
Signed-off-by: lvliang-intel <liang1.lv@intel.com>
…enAIComps into agent_mcp_client Signed-off-by: lvliang-intel <liang1.lv@intel.com>
for more information, see https://pre-commit.ci
Signed-off-by: lvliang-intel <liang1.lv@intel.com>
…enAIComps into agent_mcp_client Signed-off-by: lvliang-intel <liang1.lv@intel.com>
for more information, see https://pre-commit.ci
Signed-off-by: lvliang-intel <liang1.lv@intel.com>
…enAIComps into agent_mcp_client Signed-off-by: lvliang-intel <liang1.lv@intel.com>
Signed-off-by: lvliang-intel <liang1.lv@intel.com>
Codecov ReportAttention: Patch coverage is
🚀 New features to boost your workflow:
|
Signed-off-by: lvliang-intel <liang1.lv@intel.com>
for more information, see https://pre-commit.ci
Signed-off-by: lvliang-intel <liang1.lv@intel.com>
…enAIComps into agent_mcp_client Signed-off-by: lvliang-intel <liang1.lv@intel.com>
for more information, see https://pre-commit.ci
|
For the client side, I think a FastMCP client is a cleaner solution. https://gofastmcp.com/clients/client import asyncio
from fastmcp import Client, FastMCP
# Example transports (more details in Transports page)
server_instance = FastMCP(name="TestServer") # In-memory server
sse_url = "http://localhost:8000/sse" # SSE server URL
ws_url = "ws://localhost:9000" # WebSocket server URL
server_script = "my_mcp_server.py" # Path to a Python server file
# Client automatically infers the transport type
client_in_memory = Client(server_instance)
client_sse = Client(sse_url)
client_ws = Client(ws_url)
client_stdio = Client(server_script)
print(client_in_memory.transport)
print(client_sse.transport)
print(client_ws.transport)
print(client_stdio.transport)
# Expected Output (types may vary slightly based on environment):
# <FastMCP(server='TestServer')>
# <SSE(url='http://localhost:8000/sse')>
# <WebSocket(url='ws://localhost:9000')>
# <PythonStdioTransport(command='python', args=['/path/to/your/my_mcp_server.py'])> |
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.
LGTM, but I doubt whether it is necessary to use a registry pattern here. One good example what the FastMCP does: https://gofastmcp.com/clients/client, which provides methods such as:
list_tools, list_resources, call_tool and also manage different transport automatically (be checking the url format) instead of passing different OpeaMCPxxxServerConfig.
|
@lvliang-intel @Spycsh Do we have a conclusion on whether using fastmcp or not? what are the pros and cons of the methods implemented by @lvliang-intel vs. fastmcp? |
|
@minmin-intel we will suggest users to use OPEA MCP client. There should not be any difference between FastMCP/OPEA's. The initial plan is to only use the official mcp package but only the server side from FastMCP 1.0 was migrated into the official mcp. Since we only want to use that part from official mcp python sdk, we need another OPEA MCP client implementation aligned with the FastMCP's client. |
…to agent_mcp_client Signed-off-by: lvliang-intel <liang1.lv@intel.com>
…enAIComps into agent_mcp_client Signed-off-by: lvliang-intel <liang1.lv@intel.com>
…to agent_mcp_client Signed-off-by: lvliang-intel <liang1.lv@intel.com>
…enAIComps into agent_mcp_client Signed-off-by: lvliang-intel <liang1.lv@intel.com>
for more information, see https://pre-commit.ci
lkk12014402
left a comment
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.
LGTM
Description
Enable MCP client tool for Agent
Issues
1832
Type of change
List the type of change like below. Please delete options that are not relevant.
Dependencies
mcp
Tests
Local test and unit test.
[2025-05-08 06:02:38,047] [ INFO] - comps-mcp-manager - Initializing MCP client for SSE server: http://localhost:8931/sse
[2025-05-08 06:02:38,092] [ INFO] - comps-mcp-client - Connected to server with tools: ['browser_close', 'browser_wait', 'browser_resize', 'browser_console_messages', 'browser_handle_dialog', 'browser_file_upload', 'browser_install', 'browser_press_key', 'browser_navigate', 'browser_navigate_back', 'browser_navigate_forward', 'browser_network_requests', 'browser_pdf_save', 'browser_snapshot', 'browser_click', 'browser_drag', 'browser_hover', 'browser_type', 'browser_select_option', 'browser_take_screenshot', 'browser_tab_list', 'browser_tab_new', 'browser_tab_select', 'browser_tab_close', 'browser_generate_playwright_test']
[2025-05-08 06:02:38,093] [ INFO] - comps-mcp-manager - Successfully connected to MCP server: url='http://localhost:8931/sse' api_key=None
[2025-05-08 06:02:38,093] [ INFO] - comps-mcp-manager - Initializing MCP client for Stdio server: uv
[2025-05-08 06:02:38,646] [ INFO] - comps-mcp-client - Connected to server with tools: ['fetch']
[2025-05-08 06:02:38,646] [ INFO] - comps-mcp-manager - Successfully connected to MCP server: name='mcp-simple-tool' command='uv' args=['run', 'mcp-simple-tool'] env={}