chore: import upstream snapshot with attribution
Continuous Integration / Pre-commit Linter (push) Has been cancelled
Continuous Integration / Mypy Check (Python 3.10) (push) Has been cancelled
Continuous Integration / Mypy Check (Python 3.11) (push) Has been cancelled
Continuous Integration / Mypy Check (Python 3.12) (push) Has been cancelled
Continuous Integration / Mypy Check (Python 3.13) (push) Has been cancelled
Continuous Integration / Unit Tests (Python 3.10) (push) Has been cancelled
Continuous Integration / Unit Tests (Python 3.11) (push) Has been cancelled
Continuous Integration / Unit Tests (Python 3.12) (push) Has been cancelled
Continuous Integration / Unit Tests (Python 3.13) (push) Has been cancelled
Continuous Integration / Unit Tests (Python 3.14) (push) Has been cancelled
Continuous Integration / A2A v0.3 Tests (Python 3.10) (push) Has been cancelled
Continuous Integration / A2A v0.3 Tests (Python 3.11) (push) Has been cancelled
Continuous Integration / A2A v0.3 Tests (Python 3.12) (push) Has been cancelled
Copybara PR Handler / close-imported-pr (push) Has been cancelled
Continuous Integration / A2A v0.3 Tests (Python 3.13) (push) Has been cancelled
Continuous Integration / A2A v0.3 Tests (Python 3.14) (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:25:13 +08:00
commit ec2b666284
2231 changed files with 491535 additions and 0 deletions
@@ -0,0 +1,74 @@
# AgentTool with MCP Demo (SSE Mode)
This demo shows how `AgentTool` works with MCP (Model Context Protocol) toolsets using **SSE mode**.
## SSE vs Stdio Mode
This demo uses **SSE (Server-Sent Events) mode** where the MCP server runs as a separate HTTP server:
- **Remote connection** - Connects to server via HTTP
- **Separate process** - Server must be started manually
- **Network communication** - Uses HTTP/SSE for messaging
For the **stdio (subprocess) version**, see [mcp_in_agent_tool_stdio](../mcp_in_agent_tool_stdio/).
## Setup
**Start the MCP simple-tool server in SSE mode** (in a separate terminal):
```bash
# Run the server using uvx (no installation needed)
# Port 3000 avoids conflict with adk web (which uses 8000)
uvx --from 'git+https://github.com/modelcontextprotocol/python-sdk.git#subdirectory=examples/servers/simple-tool' \
mcp-simple-tool --transport sse --port 3000
```
The server should be accessible at `http://localhost:3000/sse`.
## Running the Demo
```bash
adk web contributing/samples
```
Then select **mcp_in_agent_tool_remote** from the list and interact with the agent.
## Try These Prompts
This demo uses **Gemini 2.5 Flash** as the model. Try these prompts:
1. **Check available tools:**
```
What tools do you have access to?
```
1. **Fetch and summarize JSON Schema specification:**
```
Use the mcp_helper to fetch https://json-schema.org/specification and summarize the key features of JSON Schema
```
## Architecture
```
main_agent (root_agent)
└── AgentTool wrapping:
└── mcp_helper (sub_agent)
└── McpToolset (SSE connection)
└── http://localhost:3000/sse
└── MCP simple-tool server
└── Website Fetcher Tool
```
## Related
- **Issue:** [#1112 - Using agent as tool outside of adk web doesn't exit cleanly](https://github.com/google/adk-python/issues/1112)
- **Related Issue:** [#929 - LiteLLM giving error with OpenAI models and Grafana's MCP server](https://github.com/google/adk-python/issues/929)
- **Stdio Version:** [mcp_in_agent_tool_stdio](../mcp_in_agent_tool_stdio/) - Uses local subprocess connection