@capxul/mcp 1.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # @capxul/mcp
2
+
3
+ The **Capxul MCP server** — a runnable [Model Context Protocol](https://modelcontextprotocol.io)
4
+ server that exposes Capxul's agent-facing financial-ops tools to MCP clients
5
+ (Claude, Cursor, and other agents) over **Streamable HTTP**.
6
+
7
+ This package ships a CLI, not a library: the published artifact is the
8
+ `capxul-mcp` executable.
9
+
10
+ ## Install & run
11
+
12
+ ```bash
13
+ # one-off, via npx
14
+ npx @capxul/mcp serve --mode live
15
+
16
+ # or install globally
17
+ npm i -g @capxul/mcp
18
+ capxul-mcp serve --mode live
19
+ ```
20
+
21
+ ```
22
+ Usage:
23
+ capxul-mcp serve [--mode live|dev] [--port <port>] [--approval-url <url>]
24
+
25
+ Options:
26
+ --mode live|dev Launch mode. Defaults to live. There is no env-var mode selector.
27
+ --port <port> Bind port. Defaults to CAPXUL_MCP_PORT or 8788.
28
+ --approval-url <url> Approval app base URL. Defaults to CAPXUL_MCP_APPROVAL_URL or http://localhost:5998.
29
+ --help Show this help.
30
+ ```
31
+
32
+ The server speaks MCP over Streamable HTTP at `POST /mcp`. The startup banner
33
+ prints the bound URL and the enabled tool set.
34
+
35
+ ## What it exposes
36
+
37
+ Agent-facing financial-ops tools, composed in `src/registry.ts`:
38
+
39
+ - **`system.ping`** — liveness probe (no auth, no secrets).
40
+ - **`auth.*`** — request/verify an email OTP, exchanging it for an opaque
41
+ session token bound to the MCP session.
42
+ - **`account.*`** — account readiness and on-chain Money balances.
43
+ - **`faucet.fundTestnet`** — testnet faucet (env-gated).
44
+ - **`payments.send`** — send a sponsored stablecoin payment.
45
+
46
+ ## Auth & transport
47
+
48
+ - **Streamable HTTP** transport — a fresh, stateless `McpServer` per `POST /mcp`.
49
+ - **OAuth bearer auth** — an in-memory PKCE OAuth provider gates tool access
50
+ when `CAPXUL_MCP_OAUTH_REQUIRED=1`; a proof-issuer secret can mint bearer
51
+ tokens for automated probes.
52
+ - **Dev-mode custody gate** — `--mode dev` runs against a deterministic dev
53
+ signer seed (`CAPXUL_MCP_DEV_SIGNER_SEED`) so journeys can be exercised
54
+ without live custody; `--mode live` uses the production signer path.
55
+
56
+ ## Runtime configuration
57
+
58
+ Environment is read lazily on the first authenticated tool call, so liveness
59
+ (`system.ping`) needs no secrets. A missing slot surfaces as a structured
60
+ `ENV_MISSING` tool error naming the exact variable. Notable variables:
61
+
62
+ | Variable | Purpose |
63
+ | --- | --- |
64
+ | `CAPXUL_MCP_PORT` | Bind port (default `8788`; `0` = ephemeral). |
65
+ | `CAPXUL_MCP_DEV_SIGNER_SEED` | Deterministic dev signer seed (`--mode dev`). |
66
+ | `CAPXUL_MCP_OAUTH_REQUIRED` | `1` to require an OAuth bearer token. |
67
+ | `CAPXUL_MCP_OAUTH_PROOF_ISSUER_SECRET` | Secret to mint proof bearer tokens. |
68
+ | `CAPXUL_MCP_APPROVAL_URL` | Base URL of the Approval app for deploy approvals. |
69
+
70
+ ## Distribution
71
+
72
+ `@capxul/mcp` is published from the `Xelmar-tech/infrastructure` repo on the
73
+ `alpha` dist-tag. The tarball is **self-contained**: every internal
74
+ `@capxul/*` workspace package the server reaches (`@capxul/sdk`,
75
+ `@capxul/backend`, `@capxul/config`, `@capxul/types`) is bundled into
76
+ `dist/main.mjs` at pack time, while real npm dependencies (`effect`, `convex`,
77
+ `viem`, `zod`, `@modelcontextprotocol/sdk`, …) stay external and are resolved
78
+ from the consumer's lockfile.
package/bin/capxul-mcp ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ cd "$(dirname "$0")/.."
5
+ if [[ "${1:-}" == "serve" ]]; then
6
+ exec vp exec tsx src/main.ts "$@"
7
+ fi
8
+ exec vp exec tsx src/main.ts serve "$@"