Deep Research with MCP (Interactions)
Give the Deep Research agent access to external tools via remote MCP servers. Pass server configs through mcp_servers; the type: "mcp_server" field is added automatically.
Only url is required. name, headers, and allowed_tools are optional. Custom Function Calling tools are not supported by Deep Research, but remote MCP servers are.
Code
1from kern.agent import Agent2from kern.models.google import GeminiInteractions34agent = Agent(5 model=GeminiInteractions(6 agent="deep-research-preview-04-2026",7 thinking_summaries="auto",8 mcp_servers=[9 {10 "name": "Deployment Tracker",11 "url": "https://mcp.example.com/mcp",12 "headers": {"Authorization": "Bearer my-token"},13 # "allowed_tools": ["get_status"], # optionally restrict14 }15 ],16 ),17 markdown=True,18)1920if __name__ == "__main__":21 agent.print_response(22 "Check the status of my last server deployment and summarize any issues."23 )Usage
Set up your virtual environment
1uv venv --python 3.122source .venv/bin/activate1uv venv --python 3.122.venv\Scripts\activateSet your API key
1export GOOGLE_API_KEY=xxxInstall dependencies
1uv pip install -U "google-genai>=2.0" kern-aiRun Agent
1python cookbook/90_models/google/gemini_interactions/deep_research_mcp.py