MCP (Model Context Protocol) is a protocol for exposing tools and resources to AI agents.
Read more about MCP here.
Basic MCP Usage
The ready-to-run basic MCP usage example is available here!
MCP Configuration
Configure MCP servers using a dictionary with server names and connection details following this configuration formatmcp_config
Tool Filtering
Usefilter_tools_regex to control which MCP tools are available to the agentfilter_tools_regex
MCP with OAuth
The ready-to-run MCP with OAuth example is available here!For MCP servers requiring OAuth authentication:
- Configure OAuth-enabled MCP servers by specifying the URL and auth type
- The SDK automatically handles the OAuth flow when first connecting
- When the agent first attempts to use an OAuth-protected MCP server’s tools, the SDK initiates the OAuth flow via FastMCP
- User will be prompted to authenticate
- Access tokens are securely stored and automatically refreshed by FastMCP as needed
mcp_config
Ready-to-Run Basic MCP Usage Example
This example is available on GitHub: examples/01_standalone_sdk/07_mcp_integration.py
examples/01_standalone_sdk/07_mcp_integration.py
The model name should follow the LiteLLM convention:
provider/model_name (e.g., anthropic/claude-sonnet-4-5-20250929, openai/gpt-4o).
The LLM_API_KEY should be the API key for your chosen provider.Ready-to-Run MCP with OAuth Example
This example is available on GitHub: examples/01_standalone_sdk/08_mcp_with_oauth.py
examples/01_standalone_sdk/08_mcp_with_oauth.py
The model name should follow the LiteLLM convention:
provider/model_name (e.g., anthropic/claude-sonnet-4-5-20250929, openai/gpt-4o).
The LLM_API_KEY should be the API key for your chosen provider.Next Steps
- Custom Tools - Creating native SDK tools
- Security Analyzer - Securing tool usage
- MCP Package Source Code - MCP integration implementation

