Skip to content

feat(cli,mcp): one operations catalogue renders both the CLI and the MCP tools - #45

Merged
PancheI merged 9 commits into
mainfrom
feat/cli-mcp-parity
Sep 9, 2026
Merged

PancheI merged 9 commits into
mainfrom
feat/cli-mcp-parity

Conversation

@PancheI

@PancheI PancheI commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Why

The CLI and the MCP server had drifted: seven hand-written MCP tools against a CLI with status, audit, verification, products, checkouts, subscriptions, customers and invoices. Panche's rule: whatever the CLI can do, the MCP can do, managed as one thing so they cannot diverge again.

What

One operations catalogue (packages/wallet/src/ops/, 19 operations) rendered into both surfaces:

  • CLI: commander commands generated from each operation's input schema. Every existing command, flag, short flag, default and help text is preserved verbatim (26 of 28 help pages byte-identical with the published 3.0.0; the two differences are intended: audit request --delivery now lists the four values the server accepts, and the root banner gained example lines).
  • MCP: tools agenta_<group>_<op> with the same schema; each returns a merchant-readable sentence as content (money as €29.00, dates, states as plain sentences) and the API JSON as structuredContent. registerAgentaTools (alias registerPayTools for the Worker).
  • Parity test fails the build if either surface lacks an operation or their input keys differ.
  • SDK (@agentaos/pay, minor): goLive.get(), accountReview.get/submit/resubmit/requestAudit(), an orgId option for session users (sent for a session token only; a key never carries it, the server binds a key to its org), plan-change types exported.
  • Skill (plugin): MCP-first, every recipe names the tool and ends with what to tell the user; CLI kept as the fallback for terminals and CI. The site's SKILL.md stays CLI-first on purpose.

Verified

Unit: pay 121, wallet 153 (77 parity), Worker 9; typecheck and lint clean. Live against the local API: every CLI command with a session; eight operations through the stdio MCP server with a key (plain-language text confirmed). Changesets: agentaos minor, @agentaos/pay minor.

After merge

Release workflow → agentaos 3.1.0 + @agentaos/pay 2.3.0 → wrangler deploy so mcp.agentaos.ai serves the 19 tools.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KdSgWa5Lf9mnHxY3x76Fy1

PancheI and others added 9 commits September 9, 2026 18:27
Add client.goLive.get() and client.accountReview.get/submit/resubmit/
requestAudit() so the CLI and the MCP tools can share one client for
merchant onboarding. Types mirror the server's GoLiveReadiness and
AccountReviewResponse; request bodies mirror SubmitAccountReviewDto and
RequestAuditDto.

BaseResource's protected get/post helpers become getJson/postJson so a
resource can expose a public get() without an incompatible override.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KdSgWa5Lf9mnHxY3x76Fy1
A session token (agenta login) can belong to several organizations, and
the server resolves the one to act for from ?orgId=. The client option
stamps it on every request so the CLI can use the SDK for go-live and
account-review calls instead of its own fetch helper. API keys are
org-bound and ignore it.

Also exports the plan-change types the subscriptions resource already
returns.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KdSgWa5Lf9mnHxY3x76Fy1
…MCP tools

Whatever `agenta` can do, the MCP server can do, with the same names,
inputs and outputs, and neither can change without the other.

- ops/: one Operation per merchant action {name, description, zod input,
  run(sdk, input), describe(result)}. Exactly today's CLI surface: status,
  audit, verify, products, pay, subscriptions, customers, invoices. Every
  operation calls the SDK only (no fetch, env or console); `describe` is
  the merchant-facing text, money as "€29.00", dates as "22 Sep 2026".
- cli/from-operation.ts renders commander commands off the zod input:
  positional id, --kebab flags, today's short flags kept (-n -a -c -d -o),
  --no-download, enum values and defaults in --help. The go-live fetch
  helper is gone: the CLI uses the SDK with the new orgId option. The
  audit report and receipt downloads stay CLI-only side effects.
- mcp/tools/index.ts registers every operation as agenta_<group>_<op>
  (registerAgentaTools; registerPayTools kept as an alias for one release)
  returning describe() as text and the JSON as structuredContent. The
  seven hand-written pay-*.ts tools are deleted. The Worker uses the new name.
- __tests__/parity.test.ts: for every operation the CLI resolves
  `agenta <group> <op>`, the MCP server lists the tool, and both take
  exactly the catalogue's input keys.
- Fixes a latent bug: `audit request --delivery` offered seven values,
  the server accepts four.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KdSgWa5Lf9mnHxY3x76Fy1
A key is bound to one org server-side and the guard ignores the query for
keys; not sending it keeps the two credential modes distinct on the wire.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KdSgWa5Lf9mnHxY3x76Fy1
- cli/flags.ts: the flag spellings agentaos@3.0.0 published, keyed by
  input key (`-a, --amount <amount>`, `--to <linkId>`, `--limit <n>` with
  its printed default, `--description <text>` on the onboarding commands,
  `--no-download` with its own help line). The renderer uses them and
  generates `--kebab-case <value>` only for a flag no release promised.
- Option help texts, command descriptions and subcommand order match
  3.0.0 verbatim; `agenta status` keeps its usage line. The one remaining
  help difference is deliberate: `audit request --delivery` lists the four
  values the server accepts, not seven.
- The session's org is resolved once (GET /orgs on first use) and stored in
  session.json next to the token; ensureSession returns it, connect() hands
  it to the SDK, and no command looks it up again. The change-plan test is
  back to exactly its 3.0.0 mocks.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KdSgWa5Lf9mnHxY3x76Fy1
… for both surfaces

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KdSgWa5Lf9mnHxY3x76Fy1
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KdSgWa5Lf9mnHxY3x76Fy1
@PancheI
PancheI merged commit 967b34f into main Sep 9, 2026
1 check passed
@PancheI
PancheI deleted the feat/cli-mcp-parity branch September 9, 2026 17:28
@github-actions github-actions Bot mentioned this pull request Sep 9, 2026
PancheI pushed a commit that referenced this pull request Sep 9, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @agentaos/pay@2.3.0

### Minor Changes

- [#45](#45)
[`967b34f`](967b34f)
Thanks [@PancheI](https://github.com/PancheI)! - Add `goLive.get()` and
`accountReview.get/submit/resubmit/requestAudit()` so the CLI and the
MCP tools share one client for onboarding.
Add the `orgId` client option: a session-token user who belongs to
several organizations names the one to act for, and it goes on every
request as `?orgId=`.
Export the plan-change types (`PlanChangePreview`, `ChangePlanParams`,
`ChangePlanResult`, `PlanChangeDirection`, `PendingPlanChange`) that
`subscriptions.previewPlanChange/changePlan` already return.
## agentaos@3.1.0

### Minor Changes

- [#45](#45)
[`967b34f`](967b34f)
Thanks [@PancheI](https://github.com/PancheI)! - The CLI and the MCP
server are one operations catalogue: every command is a tool (19), with
merchant-readable output on both. New tools: status, audit, verify,
products, invoices; `registerAgentaTools` (alias `registerPayTools`).

### Patch Changes

- Updated dependencies
[[`967b34f`](967b34f)]:
  - @agentaos/pay@2.3.0
## @agentaos/chains@3.1.0

### Patch Changes

- Updated dependencies []:
  - @agentaos/core@3.1.0
## @agentaos/engine@3.1.0

### Patch Changes

- Updated dependencies []:
  - @agentaos/core@3.1.0
  - @agentaos/crypto@3.1.0
## @agentaos/sdk@3.1.0

### Patch Changes

- Updated dependencies []:
  - @agentaos/core@3.1.0
  - @agentaos/engine@3.1.0
## @agentaos/core@3.1.0


## @agentaos/crypto@3.1.0

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

1 participant