Skip to content

Commit dd0f744

Browse files
Make url optional for mcp-stdio
Signed-off-by: Anuradha Karuppiah <[email protected]>
1 parent 3bf8894 commit dd0f744

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/aiq/tool/mcp/mcp_tool.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class MCPToolConfig(FunctionBaseConfig, name="mcp_tool_wrapper"):
3333
function.
3434
"""
3535
# Add your custom configuration parameters here
36-
url: HttpUrl = Field(description="The URL of the MCP server (for SSE mode)")
36+
url: HttpUrl | None = Field(default=None, description="The URL of the MCP server (for SSE mode)")
3737
mcp_tool_name: str = Field(description="The name of the tool served by the MCP Server that you want to use")
3838
client_type: str = Field(default="sse", description="The type of client to use ('sse' or 'stdio')")
3939
command: str | None = Field(default=None, description="The command to run for stdio mode (e.g. 'mcp-server')")
@@ -64,6 +64,8 @@ async def mcp_tool(config: MCPToolConfig, builder: Builder): # pylint: disable=
6464
raise ValueError("command is required when using stdio client type")
6565
client = MCPBuilder(url=config.command, client_type=config.client_type, args=config.args)
6666
else:
67+
if not config.url:
68+
raise ValueError("url is required when using sse client type")
6769
client = MCPBuilder(url=str(config.url), client_type=config.client_type)
6870

6971
tool: MCPToolClient = await client.get_tool(config.mcp_tool_name)

0 commit comments

Comments
 (0)