mcp_client
Tool
tools/rea/mcp_client.py(library, REA). A small MCP client for one stdio server, for scripts that drive a provider such as REA.
A library: other tools and your own scripts import it. Source on GitHub.
Its own help
This is the help text in the tool itself, as ./gameframe tool mcp_client prints it.
text
A small MCP client for one stdio server, for scripts that drive a provider such as REA.
An agent's MCP servers live inside the agent. A script that wants the same provider starts its
own copy as a child process with this client. `provider_command(name)` reads the launch command
from the project's `.mcp.json` (`./gameframe mcp-provider rea VERSION` after
`./gameframe mcp --enable rea`), so a script and the agent run the same version.
from mcp_client import McpClient, provider_command
with McpClient(provider_command('rea')) as rea:
rea.tool('open_binary', path='/abs/game.exe', provider_id='ghidra')
Lines on the server's stdout that are not the JSON-RPC answer are skipped: `npx` prints an
NDJSON notice there before REA starts. `tool()` returns the tool's JSON result and raises
`McpError` when the tool reports an error. Long calls print a line on stderr every 30 s.Named by
Skills: re-rea.