You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(mcp): resource support — list on connect + @server:uri expansion (#115)
Implements MCP resources (DEVELOPMENT_PLAN §3.3 / BEHAVIOR_PARITY): an MCP
server's resources can now be referenced from a prompt and their content is
injected for the model.
core (mcp/client.ts):
- connectMcpServer now lists resources on connect (capability-gated; a server
without `resources` — or one that errors on resources/list — yields []).
McpClientHandle gains `resources: McpResourceMeta[]`.
- readMcpResource(handle, uri) — reads a resource, flattens contents to text
(binary blobs → `[binary …]` placeholder).
- parseResourceRefs(text) — finds `@server:scheme://path` tokens (requires
`://`, so it won't match emails or `@user:pass`; dedupes).
- expandMcpResourceRefs(text, handles) — reads each referenced resource and
appends a `<mcp-resource server=… uri=…>` block, leaving the original token
in place; unknown server / read failure surface as errors, never throw.
cli:
- repl.ts + headless.ts expand `@server:uri` refs in the user message after
MCP connect (resolved/error lines to the user).
Tests: +5 (connect→list→read→expand end-to-end against a real spawned stdio
server with a `resources` capability; parseResourceRefs pure cases incl.
email/`@user:pass` rejection + dedup). Core suite 569 green.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments