运行OK
Some checks failed
Integration Tests / Integration Tests (ubuntu-latest, 3.11) (push) Has been cancelled
Integration Tests / Integration Tests (ubuntu-latest, 3.12) (push) Has been cancelled

This commit is contained in:
2025-11-01 23:11:56 +08:00
parent 81e64e3fb6
commit b6c4d1d048
5 changed files with 20 additions and 12 deletions

View File

@@ -41,6 +41,7 @@ async def make_graph() -> CompiledStateGraph[Any, Any, Any, Any]:
client = get_client()
mcp_tools = await client.get_tools()
# mcp_tools = []
tools = [get_wheather]
tools.extend(mcp_tools)
@@ -51,7 +52,7 @@ async def make_graph() -> CompiledStateGraph[Any, Any, Any, Any]:
graph_builder.add_node("chatbot", chatbot)
tool_node = ToolNode(tools=[tool])
tool_node = ToolNode(tools=tools)
graph_builder.add_node("tools", tool_node)
graph_builder.add_conditional_edges(

View File

@@ -2,7 +2,7 @@
"math": {
"command": "python",
"args": [
"/home/kexsh/src/knightutils/test/mcp/math_server.py"
"./src/mcp/server/math_server.py"
],
"transport": "stdio"
}

View File

@@ -1,9 +0,0 @@
{
"math": {
"command": "python",
"args": [
"/home/kexsh/src/knightutils/test/mcp/math_server.py"
],
"transport": "stdio"
}
}

View File

@@ -2,7 +2,7 @@ from langchain_mcp_adapters.client import MultiServerMCPClient
import json
def get_client() -> MultiServerMCPClient:
mcp_tools = json.load(open("mcp_servers.json"))
mcp_tools = json.load(open("src/mcp/config/mcp_servers.json"))
client = MultiServerMCPClient(mcp_tools)

View File

@@ -0,0 +1,16 @@
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("Math")
@mcp.tool()
def add(a: int, b: int) -> int:
"""Add two numbers"""
return a + b
@mcp.tool()
def multiply(a: int, b: int) -> int:
"""Multiply two numbers"""
return a * b
if __name__ == "__main__":
mcp.run(transport="stdio")