← MCP server and skill grades

polymarket-paper-trader

agent-next/polymarket-paper-trader

C
Type
MCP server
Scanned
Nov 17, 2026
Version
55bb35b79568
Files read
226

This project is a paper-trading simulator MCP server, CLI, and agent skill that lets AI agents practice trading against live Polymarket and Kalshi order books using fake money. Its biggest risk is that the default stdio MCP tools pk_battle and backtest import and execute Python modules from the current working directory, which could allow prompt injection to run arbitrary code if an untrusted workspace contains or is given a matching module.

What it can reach

Files
Reads and writes simulated trading databases and lock files under ~/.pm-trader/ (or a custom data directory), reads CSV or JSON snapshot files under the home directory or /tmp during backtests, and exports trade or position files when requested via CLI.
Network
Makes outbound HTTPS requests to public Polymarket and Kalshi market APIs (and to a configured OIDC issuer in opt-in remote auth mode), and can listen on an HTTP port when started with the streamable-http transport.
System
Imports and executes local Python functions from examples.* and tests.test_benchmark.* modules in the current working directory when running strategies, PK battles, or backtests, and launches via uvx when installed as an agent plugin.

Findings

1 high1 medium3 low
  1. HighArbitrary local code execution via strategy import from working directory

    pm_trader/benchmark.py:65

    The pk_battle and backtest MCP tools are enabled by default on stdio, marked non-destructive, and call _load_strategy() to load a Python strategy. Although a prefix check restricts imports to examples.* and tests.test_benchmark.* (the latter not mentioned in tool descriptions), _load_strategy() prepends the current working directory to sys.path and imports the module. If a user opens an untrusted repository containing an examples/ or tests/test_benchmark module, or if a prompt-injected agent has file-edit permissions without shell access and writes examples/payload.py, calling pk_battle or backtest executes arbitrary Python code on the user's machine.

    Fix: Disable pk_battle and backtest on the MCP server unless explicitly enabled by a startup flag, remove tests.test_benchmark. from the production allowlist, mark strategy-execution tools with destructive_hint=True, and avoid inserting os.getcwd() onto sys.path.

  2. MediumSkill text instructs the agent to act unprompted and publish stats via gh CLI

    skill/polymarket-paper-trader/SKILL.md:145

    The bundled SKILL.md (also served by the MCP server as the trading_playbook prompt and skill://trading-playbook resource) tells the agent to run trading routines every session without waiting for instructions and, for leaderboard entry, instructs it to directly run the gh CLI to open a public GitHub issue containing the user's account stats if gh is installed. This directly contradicts the skill's own Security & Privacy section, which states that local data is never uploaded.

    Fix: Update SKILL.md so the agent only trades when asked by the user and always asks for explicit confirmation before running external tools like gh to post data publicly.

  3. LowCLI mcp subcommand ignores PM_TRADER_AUTH_* environment variables

    pm_trader/cli.py:1037

    The documentation states that pm-trader mcp --transport streamable-http is equivalent to pm-trader-mcp --transport streamable-http and that remote OAuth authentication can be configured via PM_TRADER_AUTH_ISSUER, PM_TRADER_AUTH_AUDIENCE, and PM_TRADER_RESOURCE_URL environment variables. However, the CLI mcp subcommand calls mcp_run(transport, host, port) without reading those environment variables, silently starting the HTTP server without authentication or per-user isolation.

    Fix: Load RemoteAuthConfig from the PM_TRADER_AUTH_* environment variables (and expose the matching --auth-* flags) in the CLI mcp command, or delegate directly to pm_trader.mcp_server.main.

  4. LowDocker HTTP mode binds to 0.0.0.0 without authentication or DNS-rebinding protection

    Dockerfile:22

    The Dockerfile runs pm-trader-mcp over streamable-http bound to 0.0.0.0 with no authentication. Passing --host 0.0.0.0 disables the MCP SDK's localhost Host and Origin DNS-rebinding checks. Even when the user follows the README and publishes the port only on 127.0.0.1:8000, any malicious website the user visits in a browser can use DNS rebinding to call tools on 127.0.0.1:8000/mcp and read, trade, or wipe local paper-trading accounts.

    Fix: Enforce Host and Origin allowlists (e.g., localhost/127.0.0.1) or require authentication tokens even when binding to 0.0.0.0 inside a container.

  5. LowUnpinned PyPI package version in plugin and extension manifests

    .claude-plugin/plugin.json:18

    Both .claude-plugin/plugin.json and gemini-extension.json launch the MCP server using uvx --from polymarket-paper-trader without pinning the exact version (unlike mcpb/pyproject.toml, which pins ==0.4.13). When uvx resolves or refreshes the package, it can download and execute a newer, unreviewed version from PyPI.

    Fix: Pin the package specifier in .claude-plugin/plugin.json and gemini-extension.json to match the manifest version (for example, polymarket-paper-trader==0.4.13).