smolagents
A smolagents agent can run tradefloor simulations and evaluate trading strategies through the local MCP server. smolagents loads the server's 13 tools as ordinary smolagents tools. None of them places an order.
Install
pip install "smolagents[mcp]" "mcp<2"
The server runs in its own environment through uvx, which needs uv. The mcp<2 pin applies only to your agent's environment. smolagents[mcp] 1.26.0 installs mcpadapt 0.1.20, which fails to import under mcp 2.x with ImportError: cannot import name 'streamablehttp_client'. The tradefloor server still gets the mcp 2.x it needs, because uvx installs it separately.
Connect
MCPClient starts the server as a subprocess, returns its tools as a list and closes the connection when the with block exits.
import json
from mcp import StdioServerParameters
from smolagents import MCPClient
server = StdioServerParameters(
command="uvx",
args=["--with", "tradefloor[mcp]", "tradefloor", "mcp"],
)
with MCPClient(server, structured_output=False) as tools:
names = sorted(tool.name for tool in tools)
print(len(names), "tools:", ", ".join(names[:4]), "...")
list_scenarios = next(tool for tool in tools if tool.name == "list_scenarios")
result = json.loads(list_scenarios())
print("scenarios:", ", ".join(s["name"] for s in result["shipped"]))13 tools: build_scenario, build_universe, check_envelope, check_job ... scenarios: curve_shock, geopolitical_conflict, liquidity_crisis, oil_price_spike, policy_regime_shift, rate_shock, recession
Setting structured_output explicitly silences a FutureWarning about its default changing. With False, each tool returns the server's JSON as a string.
To give the tools to an agent, pass the list inside the with block, for example CodeAgent(tools=tools, model=model) or ToolCallingAgent(tools=tools, model=model). Both agents also add their own final_answer tool. ToolCollection.from_mcp(server, trust_remote_code=True) loads the same 13 tools, and it raises a ValueError unless you pass trust_remote_code=True to confirm you trust a server that runs code on your machine.
Tested with
smolagents 1.26.0, mcpadapt 0.1.20, mcp 1.30.0, Python 3.12.14, uv 0.12.14 and tradefloor 0.9.1.