Skip to content

[Bug] v2's mcp forced to verify mcp_tool_id #4069

@zhainanshidai

Description

@zhainanshidai

Contact Information

No response

MaxKB Version

v2.1.1

Problem Description

v2's mcp forced to verify mcp_tool_id

Image

步骤:
#Server.py
from mcp.server.fastmcp import FastMCP

Create an MCP Server

mcp = FastMCP("Demo")

#Add an addition tool
@mcp.tool()
def add(a: int,b:int)->int:
"""加法计算"""
return a+b

@mcp.tool()
def fdaewfa(a: int,b:int)->int:
"""减法计算"""
return a-b

Add a dynamic greeting resource

@mcp.resource("greeting://{name}")
def get_greeting(name: str)-> str:
"""询问时间"""
return f"Hello,{name}!"

if name =="main":
mcp.settings.host="0.0.0.0"
mcp.run(transport='sse')

1.用这个简单的mcp实现,直接报错。
2.用SQLBot按照文档去部署,也是报上述错误。

3.修改后:
main.py:
#Server.py
import uuid
from mcp.server.fastmcp import FastMCP

Create an MCP Server with a unique ID

mcp = FastMCP("Demo")

#Add an addition tool
@mcp.tool(name="add", description="加法计算")
def add(a: int,b:int)->int:
"""加法计算"""
return a+b

@mcp.tool(name="subtract", description="减法计算")
def fdaewfa(a: int,b:int)->int:
"""减法计算"""
return a-b

Add a dynamic greeting resource

@mcp.resource("greeting://{name}")
def get_greeting(name: str)-> str:
"""询问时间"""
return f"Hello,{name}!"

if name =="main":
mcp.settings.host="0.0.0.0"
mcp.run(transport='sse')

新增mcp_config.json
{
"mcpServers": {
"calculator": {
"command": "python",
"args": ["main.py"],
"mcp_tool_id": "550e8400-e29b-41d4-a716-446655440000"
}
}
}
后可

正常。

v1版本中不加上述文件可运行正常。

Image

已有几个环境出现类似情况,社区中也是

Image

Steps to Reproduce

The expected correct result

No response

Related log output

Additional Information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions