Before 2.15.0 an MCP server could receive any session-state string by declaring a prompt argument with its name. What changed, who is affected and how to migrate with an allowlist.
The change in one sentence
ADK Python 2.15.0, published on 19 November 2026, lists a security-hardening breaking change: McpInstructionProvider "no longer auto-fills prompt arguments from session.state". The commit behind it, 889ddd3, dated 17 November 2026, explains why in its message: the provider "filled every argument an MCP server declared for a prompt with the session state value stored under that name", so "a malicious or compromised server could therefore read any string in session state, such as a token, email or user ID, just by declaring an argument with that key."
This guide explains how that worked, who is affected by the upgrade, and how to migrate with an explicit allowlist. A companion lab lets you run the old and new bindings against synthetic session state and a server that declares hostile argument names, and see exactly which values leave the session.
What McpInstructionProvider does
An ADK agent's instruction can be dynamic: instead of a fixed string, the agent can take a provider that builds the instruction for each turn. McpInstructionProvider fetches it from an MCP server's prompt. The Model Context Protocol defines prompts as server-side templates: a client calls prompts/list to see which prompts a server offers, each with a name and a list of arguments, and calls prompts/get with a prompt name and argument values to receive the rendered messages.
The interesting question is who decides the argument values. In ADK before 2.15.0, the provider answered it like this: list the server's prompts, find the one by name, read the names of its declared arguments, and fill each one from session state if a state key with that name existed. The removed code was short:
arg_names = {arg.name for arg in prompt_definition.arguments}
prompt_args = {
k: v for k, v in (context.state or {}).items() if k in arg_names
}That is convenient. If the prompt declares locale and case_id, and the agent keeps both in session state, the instruction is filled with no configuration at all.
Why that was a leak
The convenience depended on the server declaring only the arguments it needed, and the server is the party the agent should trust least. Session state in an ADK application holds much more than prompt inputs. State keys with the user: prefix persist across a user's sessions, temp: keys hold values for the current invocation such as tool results, and applications commonly keep identifiers, contact details and credentials there. The commit's own test uses user:email and adk_oauth2_credential as examples.
A server that declares an argument named user:email receives the user's email address. A server that declares adk_oauth2_credential receives whatever is stored under that key. The agent's developer never chose to send those values, and nothing in the agent's code mentions them. The server's prompt definition chose them, and a prompt definition can change whenever the server is updated, or whenever it is compromised.
This is the general shape of a confused-deputy problem: the client holds data on the user's behalf, and the server gets to name which data it receives.
What 2.15.0 does instead
The provider now takes a keyword-only arguments= parameter: a fixed mapping, or a callable that receives the ReadonlyContext and returns a mapping. The provider no longer calls prompts/list at all. It sends what the caller supplies, and nothing when the parameter is left as None:
provider = McpInstructionProvider(
connection_params,
"case_reply_style",
arguments=lambda ctx: {"locale": ctx.state["locale"], "case_id": ctx.state["case_id"]},
)The code comment in the new version states the design directly: "The caller decides what is sent; the server's declared argument names are not consulted, so it cannot pick which session values it receives."
The worked comparison
The companion example uses synthetic session state with six keys: locale, case_id, customer_first_name set to Tanishka, user:email, a placeholder adk_oauth2_credential, and a cached tool result under temp:last_tool_result. Two servers are modelled. One declares locale and case_id. The other also declares user:email, adk_oauth2_credential and temp:last_tool_result.
server binding sent
ordinary name-matched (before 2.15.0) locale, case_id
ordinary explicit, nothing passed (2.15.0 default) nothing
ordinary explicit allowlist locale, case_id
hostile name-matched (before 2.15.0) locale, user:email, adk_oauth2_credential, temp:last_tool_result
hostile explicit, nothing passed (2.15.0 default) nothing
hostile explicit allowlist locale, case_idAgainst the ordinary server, name matching and the allowlist send the same values; the old behaviour was not visibly wrong. Against the hostile server, name matching sends the email, the credential and the cached tool result. The allowlist sends the same two values to both servers, because the server's declaration no longer influences what is sent.
Who is affected by the upgrade
If you use McpInstructionProvider with a prompt that takes arguments, upgrading to 2.15.0 changes your agent's behaviour silently from your side: the provider now sends no arguments. What happens next depends on the server. The MCP prompts specification lists missing required arguments as an invalid-params error, so a server that marks an argument required should fail the request, and the instruction will not be built. A server with optional arguments may render the prompt with defaults or blanks, and the agent will run with a different instruction than before. The second case is the one to look for, because nothing fails.
If your prompts take no arguments, nothing changes.
Migrating with an allowlist
The migration is to write down, for each prompt, exactly which state keys feed which arguments. The companion example wraps that in a small binder that can be passed as the callable:
binder = AllowlistBinder({'locale': 'locale', 'case_id': 'case_id'})
provider = McpInstructionProvider(connection_params, "case_reply_style", arguments=binder)The binder does three things the bare lambda does not. It refuses at construction to map any key on a sensitive list, so a later edit cannot quietly start sending a credential. It raises a clear error when an allowlisted key is missing from state, instead of sending a partial set. And it can review a server's declared arguments against what it will send. For the hostile server, the review reports three declared arguments that will not be sent, and one sent argument, case_id, that this server does not declare. Run the review in a test or at start-up against the prompt list the server currently publishes; a new declared argument is a change to read, not to fill automatically.
Steps for an existing agent:
- Search for every
McpInstructionProviderand note the prompt name. - Call
prompts/liston each server, once, and record the arguments each prompt declares and which are required. - Decide for each argument whether the agent should send it, and from which state key. An argument you cannot justify should not be sent.
- Pass that mapping as
arguments=, and add a test that the mapping contains no sensitive keys. - Keep the review in CI so that a server that adds a required argument fails your build rather than your agent.
Tradeoffs and limits
Explicit arguments cost a little configuration, and they move a failure from "the server got too much" to "the server got too little". That is the right direction for anything crossing a trust boundary.
The change protects session state from argument names. It does not make the prompt's output trustworthy. An MCP prompt still returns text that becomes the agent's instruction, and a hostile server can still write a harmful instruction. Treat MCP prompts from third-party servers with the same review you would give any instruction text, and prefer prompts from servers you operate.
Values you choose to send still leave the session. Sending case_id to a third-party server is a decision about that server, and some deployments will want to send nothing that identifies a customer.
Verification
The companion example has seven tests: name matching lets the hostile server choose sensitive values, name matching on the ordinary server sends only its names, the explicit default sends nothing, fixed mappings and callables send exactly what they return, the allowlist sends the same values to every server and reports what the hostile one asked for, the allowlist refuses sensitive keys and reports missing state, and an unsent required argument is reported. It models the argument choice without importing ADK or starting an MCP server; read McpInstructionProvider in google-adk 2.15.0 for the real signature.
Run the example yourself
The three bindings, the two servers, the allowlist binder and seven tests. It does not import ADK or contact an MCP server. Companion code on GitHub; its README lists the prerequisites, exact commands, expected output and limits.
Interactive experiment
MCP prompt arguments: who chooses what leaves the session. Synthetic inputs computed in your browser; read the lab notes on assumptions and limits before drawing conclusions.