Skip to content

fix: MCP scaffold/validate/metrics, agent allowlists, versions - #173

Merged
ds1 merged 1 commit into
masterfrom
fix/sdk-mcp-cli
Oct 30, 2026
Merged

ds1 merged 1 commit into
masterfrom
fix/sdk-mcp-cli

Conversation

@ds1

@ds1 ds1 commented Oct 30, 2026

Copy link
Copy Markdown
Owner

Closes #166, closes #167. Addresses #169 items 1 and 3.

MCP (#166)

  • Metrics: get-settlement-metrics called /v1/metrics, which falls under the /v1/* auth guard (401). FACILITATOR_ROUTES.metrics is now /metrics (unversioned, unauthenticated, like /health) and FacilitatorClient.getMetrics uses the constant.
  • Scaffold: every route pointed at a hard-coded app.get("/example"), so a paid request settled and then 404'd. The scaffold now generates one handler per route with matching keys. With basePath("/api"), the middleware sees the full path, so the key is GET /api/weather and the handler is app.get("/weather"). Patterns outside /api are moved under it (and the note says so). Interpolated strings are escaped with JSON.stringify; PATCH is exported too.
  • Scaffold multi-chain note now says the hosted facilitator settles only to the account's registered wallet until per-chain wallets ship (S1 Phase B: per-chain merchant wallets (payTo check accepts multi-chain) #172).
  • Validate: schema errors no longer short-circuit the route checks, so all problems are reported in one pass. Unknown chains, missing wallets, wrong-format addresses and malformed route keys are now errors (the middleware throws or never matches), and an invalid config returns isError: true.

Agent (#167)

  • checkPolicy(amount, { payTo, network }) enforces allowedMerchants (EVM case-insensitive) and allowedChains (shorthand or CAIP-2, via resolveChain). With an allowlist set and the target unknown, the payment is refused. The pre-payment hook passes selectedRequirements.payTo / .network.
  • AgentConfig.facilitatorUrl marked @deprecated (unused; not removed to avoid a breaking change). README updated.

Versions (#169.1)

  • CLI --version printed 0.1.0; the MCP server reported 0.4.0. Both now read package.json at runtime via createRequire (a static JSON import would fall outside rootDir). CLI version moved to src/version.ts.

#169.3 (npm search)

@pincerpay/solana has the same maintainer, repository and publishConfig as its siblings, so the missing search result is npm-side indexing; no code change.

Tests

  • New packages/mcp/src/__tests__/tool-handlers.test.ts (captures tool handlers with a recording fake server): scaffold keys/handlers match, normalization, escaping, validate collects errors, metrics URL. The validate and metrics tests (4) fail on the previous code.
  • packages/agent: allowlist tests incl. the pre-payment hook. 4 fail on the previous client.ts.
  • packages/cli: PACKAGE_VERSION matches package.json.
  • pnpm build 13/13. pnpm test 15/16 on the first run; the failure was the known facilitator shutdown-load flake (Flaky test: shutdown-load concurrent requests under full suite #161), which passed on rerun (this PR doesn't touch the facilitator).

Changeset: patch for core, agent, mcp, cli.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NbrZHvYoDo9HCJXRGkVjCF

- MCP get-settlement-metrics uses /metrics (was /v1/metrics, 401).
- scaffold-x402-middleware emits a matching handler per route.
- validate-payment-config reports schema + route errors together.
- Agent enforces allowedMerchants/allowedChains; facilitatorUrl
  deprecated.
- CLI --version and MCP server version read from package.json.

Closes #166, closes #167

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NbrZHvYoDo9HCJXRGkVjCF
@vercel

vercel Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
pincerpay-agent-demo Ready Ready Preview Oct 30, 2026 5:17am UTC
pincerpay-dashboard Ready Ready Preview Oct 30, 2026 5:17am UTC

Request Review

This branch was successfully deployed

2 active deployments
Preview – pincerpay-dashboard — c4ecadc9 Deployed Oct 30, 2026 by vercel[bot]
Preview – pincerpay-agent-demo — c4ecadc9 Deployed Oct 30, 2026 by vercel[bot]
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.

Agent SDK ignores allowedMerchants/allowedChains spending policy MCP tools: metrics path 401, scaffold handler path mismatch, validate short-circuit

1 participant