Skip to main content
AgentOS handles the lifespan of the MCPTools internally.
This example uses the deprecated @modelcontextprotocol/server-brave-search package in its active and commented MCP configurations. Replace both occurrences with Brave’s maintained MCP server before running. See Brave Search MCP Server.
mcp_tools_advanced_example.py

Run the Example

1

Set up your virtual environment

2

Install dependencies

3

Prepare Node.js

The maintained Brave MCP server requires Node.js 22 or later. Install it, then confirm node --version reports v22 or later and npx is available:
4

Export your API keys

5

Update both Brave MCP commands

Replace both occurrences of npx -y @modelcontextprotocol/server-brave-search with npx -y @brave/brave-search-mcp-server --transport stdio in the saved file.
6

Run the example

Save the code above as mcp_tools_advanced_example.py, then run:
Full source: cookbook/05_agent_os/mcp_demo/mcp_tools_advanced_example.py