when I run the example in cookbook, error occurs:
client code:
import asyncio
import os
from agno.agent import Agent
from agno.models.deepseek import DeepSeek
from agno.tools.mcp import MCPTools
from dotenv import load_dotenv
load_dotenv()
async def run_agent(message: str) -> None:
# Initialize the MCP server
async with (
MCPTools(
f"fastmcp run server.py",
) as mcp_tools,
):
agent = Agent(
model=DeepSeek(
id=os.getenv('DEEPSEEK_CHAT_MODEL'),
base_url=os.getenv('DEEPSEEK_API_BASE'),
api_key=os.getenv('DEEPSEEK_API_KEY'),
),
tools=[mcp_tools],
show_tool_calls=True,
markdown=True,
)
await agent.aprint_response(message, stream=True)
if __name__ == "__main__":
asyncio.run(run_agent("What is the weather in San Francisco?"))
server code:
from fastmcp import FastMCP
mcp = FastMCP("weather_tools")
@mcp.tool()
def get_weather(city: str) -> str:
return f"The weather in {city} is sunny"
@mcp.tool()
def get_temperature(city: str) -> str:
return f"The temperature in {city} is 70 degrees"
if __name__ == "__main__":
mcp.run(transport="stdio")
error:
File “C:\Users\name.conda\envs\agno\Lib\subprocess.py”, line 1548, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
# no special security
^^^^^^^^^^^^^^^^^^^^^
…<4 lines>…
cwd,
^^^^
startupinfo)
^^^^^^^^^^^^
FileNotFoundError: [WinError 2] 系统找不到指定的文件。
The server.py and client.py are in the same dir, and file structure is:
project root
- server.py
- client.py
I have tried to use the absolutely path
f"fastmcp run D/mcp_demo/server.py"
but it still doesn’t work and show the same error.