Attach a server
Note: Run this on your machine. Try it Yourself cannot start a server or open a path on the host.
Local tool first
Attach MCP on your machine after you practise a function tool here.
Example
from praisonai import Agent
def stub_mcp() -> str:
"""Pretend MCP is attached."""
return "tools: stub"
agent = Agent(instructions="Call stub_mcp when asked.", tools=[stub_mcp])
print(agent.start("What tools do you have?"))One server
tools=MCP(…) points at a server command. Replace the path with a server you actually have.
The string is the command that starts the server. The agent receives whatever tools that server offers.
Example
from praisonai import Agent, MCP
agent = Agent(
instructions="You are a helpful assistant",
tools=MCP("python /path/to/mcp_server.py"),
)
print(agent.start("Which tools do you have?"))Example explained
- MCP — The wrapper that launches a tool server.
- tools — Where the server is attached, in place of a plain function.
Reference: documentation