Business data
CRM, ERP, orders, documents, analytics, and internal knowledge.
MCP lets another program publish tools, information, and reusable prompts through a standard contract. ADK-Rust turns those capabilities into typed agent tools, exposes the wider protocol, and can manage a changing fleet of local MCP servers while your product is running.
ADK-Rust MCP architecture
Your agent uses MCP capabilities just like any other ADK-Rust tool. MCP connects it to each server, while every server remains responsible for its own data, rules, and actions.
The experience asking for work.
Agent or workflow
Chooses a capability from the tools it has been allowed to see.
ADK policy
Applies approval, authorization, guardrails, and audit around the call.
The typed adapter inside the runtime.
McpToolset
Discovers tools and preserves the server's schemas and result content.
Protocol APIs
Resources, prompts, completion, subscriptions, elicitation, and tasks.
Server manager
Changes and supervises a registry of local stdio connections.
Choose the transport that matches ownership.
Local stdio
ADK-Rust starts a native binary or other child process and owns its session.
Streamable HTTP
Connect to an independently hosted service with headers, auth, and timeouts.
Each server publishes only what it owns.
Tools
Actions
Resources
Context
Prompts
Templates
Tasks
Long work
CRM, ERP, orders, documents, analytics, and internal knowledge.
Source control, build tools, browsers, sandboxes, and coding environments.
Payments, communications, search, maps, and partner APIs.
Media generation, spreadsheets, computer use, and domain-specific services.
Start with the problem
An AI agent becomes useful when it can reach the systems that hold real information and perform real work. Without a shared protocol, every database, SaaS product, browser tool, internal service, and specialist runtime needs a custom adapter. Those adapters repeat discovery, schemas, transport, errors, authentication, and lifecycle code.
MCP puts a stable contract around that boundary. A server describes what it offers and how to call it. A client discovers that catalog at runtime. The agent application can then select a reviewed capability without importing the server's implementation or receiving its private credentials.
ADK-Rust connects that contract to the same Tool and Toolset abstractions used by native Rust tools. The model can work with MCP capabilities through its normal agent loop, while the application keeps provider-specific schema conversion, approval, sessions, telemetry, and operating policy around the call.
Tool
A tool has a name, a useful description, an input schema, and optionally an output schema. Examples include reading an order, searching a repository, updating a ticket, or generating a spreadsheet.
Resource
A resource gives information a stable URI. It can represent a document, policy, database record, catalog, or generated result without pretending that reading data is an action.
Prompt
A prompt can capture the right instructions and inputs for a task owned by the server's domain, such as investigating an order or reviewing a deployment.
Elicitation
During a tool call, a server can ask the client to present a form or open an approved URL. The application remains responsible for consent and for validating the answer.
Dynamic MCP management
An agent product may serve several tenants, workspaces, or operating modes. The useful MCP servers can change when a workspace opens, an administrator enables an integration, a credential rotates, or a specialist process is upgraded.
`McpServerManager` keeps that lifecycle in the application instead of forcing every server definition into startup code. It is designed for local stdio child processes; independently hosted HTTP services remain application-owned connections.
Read mcp.json-compatible definitions or construct them in Rust. Disabled servers stay registered without starting.
Spawn each enabled child and complete the MCP handshake before its capabilities become visible.
List tools from running servers, filter the published surface, and prefix only names that collide.
Add, update, enable, disable, or remove a server without rebuilding the agent application.
Detect a closed connection and apply the server's bounded exponential-backoff restart policy.
Persist the current registry atomically, cancel MCP sessions, wait for the grace period, and drop child transports.
Practical sequence
The model does not receive database credentials or private API clients. It receives a reviewed catalog of tools and resources. ADK-Rust keeps approval around the consequential replacement call.
Current protocol surface
The direct ADK-Rust APIs cover the capabilities an agent product most often needs: discover and call tools, read resources, resolve prompts, request argument suggestions, subscribe to changing resources, answer elicitation requests, and follow a negotiated long-running tool task.
For advanced server authoring, custom client handlers, notifications, transports, authorization work, and protocol extensions, adk_tool::mcp::rmcp re-exports the exact official SDK version used inside the framework. This avoids mixing incompatible protocol types in one application.
Use MCP capabilities inside ordinary ADK-Rust agent and tool flows.
Read the rest of the catalog instead of reducing MCP to tool calls.
Support protocol conversations that continue beyond one immediate response.
Choose local process ownership or a separately hosted service.
Working example
An application may need different MCP capabilities for each workspace, customer, or task. Hard-coding every server at startup makes those changes difficult. McpServerManager gives the application one place to start local MCP servers, combine their tools, change their configuration, monitor their connections, and close them cleanly.
This example begins with one configured server named local-tools. The agent can discover and call its echo tool. The application then adds a second server, enables it, replaces its running configuration, saves the updated registry, and removes it again. Every change uses the same APIs available to an administration screen or configuration service.
The example runs entirely on your machine. The Rust executable starts a copy of itself as the MCP child server, so the handshake, tool discovery, tool call, restart, persistence, and shutdown are real. No model, Node.js package, API key, or internet connection is required.
Load local-tools from an mcp.json-compatible configuration, start its child process, complete the MCP handshake, and discover its echo tool.
Register standby-tools as disabled, then enable and start it when the application decides that capability should become available.
Update the running server definition. The manager restarts it with the new configuration and can restore the previous definition if replacement startup fails.
Write the live registry back to JSON, disable and remove the extra server, then close every MCP session and child process cleanly.
let manager = McpServerManager::from_json(&config)?
.with_health_check_interval(Duration::from_secs(15));
manager.start_server("local-tools").await?;
manager.start_monitoring();
manager
.add_server("standby-tools".into(), standby)
.await?;
manager.enable_server("standby-tools").await?;
manager.start_server("standby-tools").await?;
manager
.update_server("standby-tools", replacement)
.await?;
manager.save_json_file("mcp.json").await?;
manager.shutdown().await?;$ cargo run --manifest-path examples/mcp_manager/Cargo.toml
1. Loaded local-tools from mcp.json-compatible configuration
status: Running
2. Discovered 1 tool: echo
3. Called the real child server
response: {"output":"MCP server replied: dynamic MCP is running"}
4. Added standby-tools at runtime: Disabled
enabled and started: Running
5. Reconfigured the running server and restarted it safely
6. Saved the live registry
7. Disabled, removed, and shut down every child serverClient, manager, or server
Most agent applications are MCP clients. They connect to an existing server and make selected tools available to an agent. Products that allow workspace or administrator integrations can place local stdio connections behind the manager. Teams publishing a new capability use the re-exported rmcp server APIs and then test the server from an ADK-Rust client.
Production design
MCP makes discovery and communication consistent. It does not decide which systems an agent should reach, which actions require approval, how credentials are issued, or what should happen when a dependency fails. Those remain product and platform decisions.
Create a server around a coherent capability owned by one team or system. Avoid one enormous server whose tools span unrelated credentials and risk levels.
Filter tools before the model sees them. Keep read operations distinct from writes, payments, deletion, deployment, and other consequential actions.
mcp.json autoApprove is preserved for compatibility; it does not bypass the framework's authorization, confirmation handlers, or application policy.
Use stdio when your application owns the local child process. Use Streamable HTTP when another deployment owns availability, identity, and scaling.
Tool descriptions, schemas, resource content, and results cross a system boundary. Validate arguments, bound result sizes, and protect model context from hostile instructions.
Set connection and task timeouts, record lifecycle changes, probe the business dependency separately, and decide how the product behaves when one server is unavailable.
Connect the useful systems
Begin with a server you understand, filter its catalog, call one read-only tool, and inspect the complete result. Add write actions, dynamic management, remote services, elicitation, and long-running tasks when the product has a clear reason for each one.