Skip to content

MCP client: record what read_resource returns as observed input (carries #689, closes #667) - #776

Merged
LoopGlitch26 merged 6 commits into
mainfrom
agent/carry-pr689
Nov 13, 2026
Merged

LoopGlitch26 merged 6 commits into
mainfrom
agent/carry-pr689

Conversation

@LoopGlitch26

Copy link
Copy Markdown
Member

Carries #689 by @Mr45401: read_resource on a wrapped MCP ClientSession (and under tracekit.instrument()) records what it returns as untrusted observed input, mcp:<server>/resource, and withholds a resource the signer can't record unless the run fails open. Closes #667.

Their four commits are in this branch unchanged (authorship and sign-offs kept). A push to their branch was refused (the git-lfs lock check needs push access to their fork), so the rest is on top here:

  1. Merge of main (Integrations: MCP big lists and input-required rounds, LangChain parallel asks, tracekit last, gateway listing errors #753 changed the same docstring and the MCP tests). main's InputRequiredRounds and BigLists tests restore the methods instrument() patches; read_resource is one of them now, so it's in their lists too, or it would stay patched for later tests.
  2. One helper for the resource and the lists (the last review's ask). read_resource repeated _list's body line for line; _observed(method, kind) now holds the fetch, the unnamed-server warning, observe and the fail-mode branch, and read_resource and the three lists are one line each. With it a resource over half the signer's 1 MiB frame is recorded as its sha256: digest, as a list's page is (Integrations: MCP big lists and input-required rounds, LangChain parallel asks, tracekit last, gateway listing errors #753), instead of being sent whole and refused. New test: test_a_resource_over_half_a_frame_is_recorded_as_its_digest, which fails before the change. docs/integrations/mcp.md says so.

How it was run

In a sealed container (no network), on this head: pyflakes tracekit tests clean; tests/test_contract_mcp.py, test_instrument.py, test_agent_framework.py, test_pydantic_ai.py, test_mcp_gateway.py, test_docs.py: 117 passed, 91 skipped (the framework packages weren't installed there; CI runs them).

As a user would: a real SignerService and a real MCPServer with two resources, read through instrument()'s wiring (autowire._mcp) with mcp.Client.read_resource. Both came back whole, and the signer holds two input.observed records, mcp:notes/resource, untrusted: the 5-character one as itself, the 1 MiB one as its digest.

Closes #689 when merged (superseded).

Mr45401 and others added 6 commits November 9, 2026 18:15
… an observed input (#667)

Signed-off-by: Mr45401 <185895283+Mr45401@users.noreply.github.com>
Signed-off-by: Mr45401 <185895283+Mr45401@users.noreply.github.com>
Signed-off-by: Mr45401 <185895283+Mr45401@users.noreply.github.com>
Signed-off-by: LoopGlitch26 <53336715+LoopGlitch26@users.noreply.github.com>
read_resource repeated _list's body (fetch, unnamed-server warning, observe,
fail-mode branch). One helper, _observed, now takes the session method and
the source suffix, so the fail-closed path lives in one place. A resource
over half a signer frame is now recorded as its digest, as a list's page is,
rather than sent whole and refused by the signer.

Signed-off-by: LoopGlitch26 <53336715+LoopGlitch26@users.noreply.github.com>
@LoopGlitch26
LoopGlitch26 merged commit 1b34426 into main Nov 13, 2026
33 of 34 checks passed
@LoopGlitch26
LoopGlitch26 deleted the agent/carry-pr689 branch November 13, 2026 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP client: record what read_resource returns on a wrapped session as an observed input

2 participants