@rekey.dev/mcp 1.1.2
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/LICENSE +21 -0
- package/README.md +110 -0
- package/dist/client.d.ts +48 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +73 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +127 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/zod-to-json-schema.d.ts +21 -0
- package/dist/lib/zod-to-json-schema.d.ts.map +1 -0
- package/dist/lib/zod-to-json-schema.js +62 -0
- package/dist/lib/zod-to-json-schema.js.map +1 -0
- package/dist/tools.d.ts +20 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +153 -0
- package/dist/tools.js.map +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ReliPay
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# `@rekey.dev/mcp`
|
|
2
|
+
|
|
3
|
+
A [Model Context Protocol](https://modelcontextprotocol.io) server for [Rekey](https://relipay.dev). Lets Claude Desktop, Cursor, and Claude Code introspect a deployment — and mint API keys — directly, without screenshots or copy-paste from the panel.
|
|
4
|
+
|
|
5
|
+
> **For AI agents connected through this server:** see [AGENTS.md](./AGENTS.md) for what's safe to call and the write-tool safety model.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Run on demand (no global install needed):
|
|
9
|
+
npx -y @rekey.dev/mcp
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
It's a stdio MCP server — you don't run it by hand. Wire it into your MCP client's config (below) and the client launches it.
|
|
13
|
+
|
|
14
|
+
## Setup
|
|
15
|
+
|
|
16
|
+
The server reads three env vars (set them in your MCP client config, not your shell):
|
|
17
|
+
|
|
18
|
+
| Env var | Required | What it's for | Where to get it |
|
|
19
|
+
| --- | --- | --- | --- |
|
|
20
|
+
| `RELIPAY_URL` | yes | Base URL of the deployment, e.g. `https://api.relipay.dev`. | Your Rekey deployment |
|
|
21
|
+
| `SUPER_ADMIN_KEY` | for **read** tools | Authenticates the global read/introspection tools. | Deployment admin |
|
|
22
|
+
| `RELIPAY_OPERATOR_TOKEN` | for `mint_api_key` | A scoped operator **personal-access-token** (`rp_op_…`). | Panel → operator API tokens (or `POST /api/v1/tenant/auth/api-tokens`), scoped to `keys:mint` |
|
|
23
|
+
|
|
24
|
+
`RELIPAY_URL` plus **at least one** credential is required. Set `SUPER_ADMIN_KEY` for the read tools, `RELIPAY_OPERATOR_TOKEN` for the `keys:mint` write tool, or both. An agent that should only mint keys can run with the operator token alone (no master key) — the read tools then fail closed with `READ_REQUIRES_ADMIN_KEY`. The server exits with a clear stderr message if `RELIPAY_URL` or every credential is missing.
|
|
25
|
+
|
|
26
|
+
> The `mint_api_key` write tool does **not** use the all-powerful
|
|
27
|
+
> `SUPER_ADMIN_KEY`. It authenticates as a **scoped operator** via
|
|
28
|
+
> `RELIPAY_OPERATOR_TOKEN`, which must carry the `keys:mint` scope and belong to
|
|
29
|
+
> the workspace that owns the target Application — default-deny, so an agent
|
|
30
|
+
> can't mutate production unless you explicitly grant it.
|
|
31
|
+
|
|
32
|
+
## Quickstart
|
|
33
|
+
|
|
34
|
+
### Claude Desktop
|
|
35
|
+
|
|
36
|
+
`~/Library/Application Support/Claude/claude_desktop_config.json` (macOS), or the equivalent on your platform:
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"mcpServers": {
|
|
41
|
+
"rekey": {
|
|
42
|
+
"command": "npx",
|
|
43
|
+
"args": ["-y", "@rekey.dev/mcp"],
|
|
44
|
+
"env": {
|
|
45
|
+
"RELIPAY_URL": "https://api.relipay.dev",
|
|
46
|
+
"SUPER_ADMIN_KEY": "your-admin-key",
|
|
47
|
+
"RELIPAY_OPERATOR_TOKEN": "rp_op_…"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Restart Claude Desktop. Tools appear as `mcp__relipay__list_applications`, etc.
|
|
55
|
+
|
|
56
|
+
### Cursor
|
|
57
|
+
|
|
58
|
+
Settings → MCP → Add Server. Same `command` / `args` / `env` shape.
|
|
59
|
+
|
|
60
|
+
### Claude Code
|
|
61
|
+
|
|
62
|
+
`.claude/mcp.json` in your repo (same shape). Omit `RELIPAY_OPERATOR_TOKEN` if you only need read tools, or omit `SUPER_ADMIN_KEY` if the agent only needs the `mint_api_key` write tool.
|
|
63
|
+
|
|
64
|
+
## Tools
|
|
65
|
+
|
|
66
|
+
**Read tools** (authenticated with `SUPER_ADMIN_KEY`):
|
|
67
|
+
|
|
68
|
+
| Tool | What it does |
|
|
69
|
+
| --- | --- |
|
|
70
|
+
| `list_tenants` | All Tenants in the deployment. |
|
|
71
|
+
| `list_applications` | Applications, optionally filtered by `tenantId`. |
|
|
72
|
+
| `get_application` | One Application by id (with authConfig + billingConfig — no secrets). |
|
|
73
|
+
| `list_plans` | Plans for an Application; `includeInactive` for archived ones. |
|
|
74
|
+
| `list_coupons` | Coupons for an Application; `includeInactive` for deactivated ones. |
|
|
75
|
+
| `list_api_keys` | Active API keys for an Application — metadata only; the hash is never returned. |
|
|
76
|
+
| `list_payments` | Recent payments (newest first), filterable by `applicationId` / `status` (`PENDING`/`SUCCEEDED`/`FAILED`/`REFUNDED`), exact-match `q` (payment id / provider payment id / end-user id), `sort` (`createdAt`/`amount`), `order`, `limit` (≤200). Amounts are integers in the smallest currency unit. |
|
|
77
|
+
| `get_payment_stats_by_app` | Per-application payment health over the last 30 days — succeeded/failed/pending/refunded counts, success rate, SUCCEEDED volume (`volumeCents`). The panel's richer per-app Billing Overview (`MRR`, 12-month series) lives at the **panel-session-only** endpoint `/api/v1/tenant/applications/:id/billing/stats` and is not reachable with this server's credentials. |
|
|
78
|
+
|
|
79
|
+
**Write tools** (authenticated with the scoped `RELIPAY_OPERATOR_TOKEN`):
|
|
80
|
+
|
|
81
|
+
| Tool | What it does |
|
|
82
|
+
| --- | --- |
|
|
83
|
+
| `mint_api_key` | Mint a new secret key (`rp_live_…` / `rp_test_…`) for an Application. Args: `applicationId`, `name`, `mode?` (`live`/`test`), `scopes?`. The raw key is returned **exactly once** — surface it immediately and warn it's unrecoverable. |
|
|
84
|
+
|
|
85
|
+
### `mint_api_key` failure modes (default-deny)
|
|
86
|
+
|
|
87
|
+
| Condition | Error |
|
|
88
|
+
| --- | --- |
|
|
89
|
+
| No `RELIPAY_OPERATOR_TOKEN` configured | `OPERATOR_TOKEN_MISSING` — never falls back to the admin key. |
|
|
90
|
+
| PAT lacks the `keys:mint` scope | `OPERATOR_SCOPE_INSUFFICIENT` (403). |
|
|
91
|
+
| PAT bound to a different workspace than the Application | `APPLICATION_NOT_FOUND` (404) — no cross-tenant oracle. |
|
|
92
|
+
| PAT revoked / expired | `OPERATOR_TOKEN_INVALID` (401). |
|
|
93
|
+
|
|
94
|
+
## Errors
|
|
95
|
+
|
|
96
|
+
Every tool error is a JSON object — `error: { code, message, fix?, statusCode? }` — in the response content (with `isError: true`). Read `fix` first. Common codes: `TOOL_NOT_FOUND`, `TOOL_ARGS_INVALID`, `APPLICATION_NOT_FOUND`, `ADMIN_AUTH_INVALID`.
|
|
97
|
+
|
|
98
|
+
## Gotchas
|
|
99
|
+
|
|
100
|
+
- **Money is integers in the smallest currency unit** (cents/paise/sen). Render `999 USD/MONTH` as `$9.99/month` — never assume a `.00` decimal (`¥100` is a hundred whole yen).
|
|
101
|
+
- **Only call `mint_api_key` when the user explicitly asks** to create/mint a key. For other mutations (create plan, refund, deactivate coupon — not yet exposed), use the read tools to figure out what to do, then the `rekey` CLI or the Panel.
|
|
102
|
+
- **Coupon discounts**: PERCENT uses basis-points × 10 (`1500` = 15%); AMOUNT uses the smallest currency unit.
|
|
103
|
+
|
|
104
|
+
## Links
|
|
105
|
+
|
|
106
|
+
- Docs: [/docs](https://relipay.dev/docs) · [SDK guide](https://relipay.dev/docs/sdk) · [API reference](https://relipay.dev/docs/api) · [agent prompt](https://relipay.dev/docs/prompt)
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
MIT
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin-API client used by every MCP tool. Mirrors `packages/cli/src/lib/api.ts`
|
|
3
|
+
* but is decoupled (the MCP server doesn't depend on the CLI).
|
|
4
|
+
*/
|
|
5
|
+
export interface AdminClientConfig {
|
|
6
|
+
apiUrl: string;
|
|
7
|
+
/**
|
|
8
|
+
* Global super-admin key. Authenticates the (global-scope) READ tools.
|
|
9
|
+
* Optional: when unset, the server can still run for the scoped write tool —
|
|
10
|
+
* read tools then fail closed with `READ_REQUIRES_ADMIN_KEY` rather than
|
|
11
|
+
* silently using a lesser credential.
|
|
12
|
+
*/
|
|
13
|
+
adminKey?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Operator personal-access-token (`rp_op_…`), if configured. Used ONLY by
|
|
16
|
+
* write tools, which authenticate as a scoped operator rather than with the
|
|
17
|
+
* all-powerful `adminKey`. Read tools never touch this. Optional: when unset,
|
|
18
|
+
* write tools refuse to run with a clear `OPERATOR_TOKEN_MISSING` error.
|
|
19
|
+
*/
|
|
20
|
+
operatorToken?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare class AdminApiError extends Error {
|
|
23
|
+
readonly code: string;
|
|
24
|
+
readonly fix: string | undefined;
|
|
25
|
+
readonly statusCode: number;
|
|
26
|
+
constructor(args: {
|
|
27
|
+
code: string;
|
|
28
|
+
message: string;
|
|
29
|
+
fix?: string;
|
|
30
|
+
statusCode: number;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export declare class AdminClient {
|
|
34
|
+
private readonly cfg;
|
|
35
|
+
constructor(cfg: AdminClientConfig);
|
|
36
|
+
/** Read-path request — authenticated with the admin key. */
|
|
37
|
+
request<T>(method: string, path: string, body?: unknown): Promise<T>;
|
|
38
|
+
/**
|
|
39
|
+
* Write-path request — authenticated with the configured operator PAT
|
|
40
|
+
* (`rp_op_…`). Used by write tools so an agent acts as a SCOPED operator, not
|
|
41
|
+
* as the global super-admin. Throws `OPERATOR_TOKEN_MISSING` if no PAT was
|
|
42
|
+
* configured — write tools must fail closed, never silently fall back to the
|
|
43
|
+
* admin key.
|
|
44
|
+
*/
|
|
45
|
+
requestAsOperator<T>(method: string, path: string, body?: unknown): Promise<T>;
|
|
46
|
+
private send;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,SAAgB,UAAU,EAAE,MAAM,CAAC;gBACvB,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE;CAOtF;AAED,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,iBAAiB;IAInD,4DAA4D;IACtD,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAY1E;;;;;;OAMG;IACG,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;YAYtE,IAAI;CA0BnB"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin-API client used by every MCP tool. Mirrors `packages/cli/src/lib/api.ts`
|
|
3
|
+
* but is decoupled (the MCP server doesn't depend on the CLI).
|
|
4
|
+
*/
|
|
5
|
+
export class AdminApiError extends Error {
|
|
6
|
+
code;
|
|
7
|
+
fix;
|
|
8
|
+
statusCode;
|
|
9
|
+
constructor(args) {
|
|
10
|
+
super(args.message);
|
|
11
|
+
this.name = 'AdminApiError';
|
|
12
|
+
this.code = args.code;
|
|
13
|
+
this.fix = args.fix;
|
|
14
|
+
this.statusCode = args.statusCode;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export class AdminClient {
|
|
18
|
+
cfg;
|
|
19
|
+
constructor(cfg) {
|
|
20
|
+
this.cfg = cfg;
|
|
21
|
+
if (!cfg.apiUrl)
|
|
22
|
+
throw new Error('AdminClient: apiUrl is required.');
|
|
23
|
+
}
|
|
24
|
+
/** Read-path request — authenticated with the admin key. */
|
|
25
|
+
async request(method, path, body) {
|
|
26
|
+
if (!this.cfg.adminKey) {
|
|
27
|
+
throw new AdminApiError({
|
|
28
|
+
code: 'READ_REQUIRES_ADMIN_KEY',
|
|
29
|
+
message: 'This read/introspection tool requires the global SUPER_ADMIN_KEY.',
|
|
30
|
+
fix: 'Set SUPER_ADMIN_KEY in the MCP server env to enable read tools. (The keys:mint write tool only needs RELIPAY_OPERATOR_TOKEN.)',
|
|
31
|
+
statusCode: 400,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return this.send(method, path, this.cfg.adminKey, body);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Write-path request — authenticated with the configured operator PAT
|
|
38
|
+
* (`rp_op_…`). Used by write tools so an agent acts as a SCOPED operator, not
|
|
39
|
+
* as the global super-admin. Throws `OPERATOR_TOKEN_MISSING` if no PAT was
|
|
40
|
+
* configured — write tools must fail closed, never silently fall back to the
|
|
41
|
+
* admin key.
|
|
42
|
+
*/
|
|
43
|
+
async requestAsOperator(method, path, body) {
|
|
44
|
+
if (!this.cfg.operatorToken) {
|
|
45
|
+
throw new AdminApiError({
|
|
46
|
+
code: 'OPERATOR_TOKEN_MISSING',
|
|
47
|
+
message: 'This write tool requires an operator personal-access-token.',
|
|
48
|
+
fix: 'Set RELIPAY_OPERATOR_TOKEN (an rp_op_… token minted in the Panel, scoped to keys:mint) in the MCP server env.',
|
|
49
|
+
statusCode: 400,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return this.send(method, path, this.cfg.operatorToken, body);
|
|
53
|
+
}
|
|
54
|
+
async send(method, path, bearer, body) {
|
|
55
|
+
const res = await fetch(`${this.cfg.apiUrl.replace(/\/$/, '')}${path}`, {
|
|
56
|
+
method,
|
|
57
|
+
headers: {
|
|
58
|
+
Authorization: `Bearer ${bearer}`,
|
|
59
|
+
...(body !== undefined ? { 'Content-Type': 'application/json' } : {}),
|
|
60
|
+
},
|
|
61
|
+
...(body !== undefined ? { body: JSON.stringify(body) } : {}),
|
|
62
|
+
});
|
|
63
|
+
const json = (await res.json().catch(() => ({})));
|
|
64
|
+
if (!res.ok || ('success' in json && json.success === false)) {
|
|
65
|
+
const err = 'error' in json
|
|
66
|
+
? json.error
|
|
67
|
+
: { code: 'UNKNOWN_ERROR', message: `HTTP ${res.status}` };
|
|
68
|
+
throw new AdminApiError({ ...err, statusCode: res.status });
|
|
69
|
+
}
|
|
70
|
+
return json.data;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAyBH,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtB,IAAI,CAAS;IACb,GAAG,CAAqB;IACxB,UAAU,CAAS;IACnC,YAAY,IAAyE;QACnF,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU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CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE;YACtE,MAAM;YACN,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,MAAM,EAAE;gBACjC,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACtE;YACD,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9D,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAE/B,CAAC;QAClB,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,SAAS,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,EAAE,CAAC;YAC7D,MAAM,GAAG,GACP,OAAO,IAAI,IAAI;gBACb,CAAC,CAAC,IAAI,CAAC,KAAK;gBACZ,CAAC,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,QAAQ,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC;YAC/D,MAAM,IAAI,aAAa,CAAC,EAAE,GAAG,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;QAC9D,CAAC;QACD,OAAQ,IAAmC,CAAC,IAAI,CAAC;IACnD,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @rekey.dev/mcp — Model Context Protocol server.
|
|
4
|
+
*
|
|
5
|
+
* Speaks MCP over stdio, exposing introspection tools for Rekey
|
|
6
|
+
* (Applications, Plans, Coupons, API keys, Tenants) plus a single guarded
|
|
7
|
+
* WRITE tool (`mint_api_key`). Designed to be wired into Claude Desktop,
|
|
8
|
+
* Cursor, and Claude Code so an AI agent can answer "what plans does this app
|
|
9
|
+
* have?" or mint a fresh API key without screenshots.
|
|
10
|
+
*
|
|
11
|
+
* Read tools use `SUPER_ADMIN_KEY` (global scope). The write tool uses a SCOPED
|
|
12
|
+
* operator personal-access-token (`RELIPAY_OPERATOR_TOKEN`, an `rp_op_…` token)
|
|
13
|
+
* and is rejected server-side unless that PAT carries the `keys:mint` scope —
|
|
14
|
+
* default-deny, so an agent can't mutate production unless explicitly granted.
|
|
15
|
+
*
|
|
16
|
+
* At least ONE credential is required. An agent that should only mint keys can
|
|
17
|
+
* run with `RELIPAY_OPERATOR_TOKEN` alone (no master key) — read tools then fail
|
|
18
|
+
* closed with `READ_REQUIRES_ADMIN_KEY`. Configure `SUPER_ADMIN_KEY` too to
|
|
19
|
+
* enable the global read/introspection tools.
|
|
20
|
+
*/
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;GAkBG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @rekey.dev/mcp — Model Context Protocol server.
|
|
4
|
+
*
|
|
5
|
+
* Speaks MCP over stdio, exposing introspection tools for Rekey
|
|
6
|
+
* (Applications, Plans, Coupons, API keys, Tenants) plus a single guarded
|
|
7
|
+
* WRITE tool (`mint_api_key`). Designed to be wired into Claude Desktop,
|
|
8
|
+
* Cursor, and Claude Code so an AI agent can answer "what plans does this app
|
|
9
|
+
* have?" or mint a fresh API key without screenshots.
|
|
10
|
+
*
|
|
11
|
+
* Read tools use `SUPER_ADMIN_KEY` (global scope). The write tool uses a SCOPED
|
|
12
|
+
* operator personal-access-token (`RELIPAY_OPERATOR_TOKEN`, an `rp_op_…` token)
|
|
13
|
+
* and is rejected server-side unless that PAT carries the `keys:mint` scope —
|
|
14
|
+
* default-deny, so an agent can't mutate production unless explicitly granted.
|
|
15
|
+
*
|
|
16
|
+
* At least ONE credential is required. An agent that should only mint keys can
|
|
17
|
+
* run with `RELIPAY_OPERATOR_TOKEN` alone (no master key) — read tools then fail
|
|
18
|
+
* closed with `READ_REQUIRES_ADMIN_KEY`. Configure `SUPER_ADMIN_KEY` too to
|
|
19
|
+
* enable the global read/introspection tools.
|
|
20
|
+
*/
|
|
21
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
22
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
23
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
24
|
+
import { zodToJsonSchema } from './lib/zod-to-json-schema.js';
|
|
25
|
+
import { AdminClient, AdminApiError } from './client.js';
|
|
26
|
+
import { tools } from './tools.js';
|
|
27
|
+
const apiUrl = process.env.RELIPAY_URL ?? '';
|
|
28
|
+
const adminKey = process.env.SUPER_ADMIN_KEY ?? '';
|
|
29
|
+
// Optional: only required by the `mint_api_key` write tool. Read tools work
|
|
30
|
+
// without it. When absent, the write tool fails closed with a clear error.
|
|
31
|
+
const operatorToken = process.env.RELIPAY_OPERATOR_TOKEN ?? '';
|
|
32
|
+
if (!apiUrl || (!adminKey && !operatorToken)) {
|
|
33
|
+
process.stderr.write(`[rekey-mcp] missing required env: RELIPAY_URL plus at least one credential ` +
|
|
34
|
+
`(SUPER_ADMIN_KEY for read tools and/or RELIPAY_OPERATOR_TOKEN for the keys:mint write tool).\n` +
|
|
35
|
+
`[rekey-mcp] fix: configure these in the MCP client (Claude Desktop config, Cursor MCP settings, …)\n`);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
const client = new AdminClient({
|
|
39
|
+
apiUrl,
|
|
40
|
+
...(adminKey ? { adminKey } : {}),
|
|
41
|
+
...(operatorToken ? { operatorToken } : {}),
|
|
42
|
+
});
|
|
43
|
+
const server = new Server({ name: 'rekey-mcp', version: '0.0.0' }, { capabilities: { tools: {} } });
|
|
44
|
+
server.setRequestHandler(ListToolsRequestSchema, () => ({
|
|
45
|
+
tools: tools.map((t) => ({
|
|
46
|
+
name: t.name,
|
|
47
|
+
description: t.description,
|
|
48
|
+
inputSchema: zodToJsonSchema(t.inputSchema),
|
|
49
|
+
})),
|
|
50
|
+
}));
|
|
51
|
+
server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
52
|
+
const tool = tools.find((t) => t.name === req.params.name);
|
|
53
|
+
if (!tool) {
|
|
54
|
+
return {
|
|
55
|
+
content: [
|
|
56
|
+
{
|
|
57
|
+
type: 'text',
|
|
58
|
+
text: JSON.stringify({
|
|
59
|
+
error: {
|
|
60
|
+
code: 'TOOL_NOT_FOUND',
|
|
61
|
+
message: `Unknown tool: ${req.params.name}`,
|
|
62
|
+
fix: 'Call list_tools to see what is available.',
|
|
63
|
+
},
|
|
64
|
+
}, null, 2),
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
isError: true,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const parsed = tool.inputSchema.safeParse(req.params.arguments ?? {});
|
|
71
|
+
if (!parsed.success) {
|
|
72
|
+
return {
|
|
73
|
+
content: [
|
|
74
|
+
{
|
|
75
|
+
type: 'text',
|
|
76
|
+
text: JSON.stringify({
|
|
77
|
+
error: {
|
|
78
|
+
code: 'TOOL_ARGS_INVALID',
|
|
79
|
+
message: 'Tool arguments failed validation.',
|
|
80
|
+
fix: 'Re-call with arguments matching inputSchema. Issues: ' +
|
|
81
|
+
parsed.error.issues.map((i) => `${i.path.join('.')}: ${i.message}`).join('; '),
|
|
82
|
+
},
|
|
83
|
+
}, null, 2),
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
isError: true,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
const result = await tool.execute(client, parsed.data);
|
|
91
|
+
return {
|
|
92
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
if (err instanceof AdminApiError) {
|
|
97
|
+
return {
|
|
98
|
+
content: [
|
|
99
|
+
{
|
|
100
|
+
type: 'text',
|
|
101
|
+
text: JSON.stringify({
|
|
102
|
+
error: { code: err.code, message: err.message, fix: err.fix, statusCode: err.statusCode },
|
|
103
|
+
}, null, 2),
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
isError: true,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
content: [
|
|
111
|
+
{
|
|
112
|
+
type: 'text',
|
|
113
|
+
text: JSON.stringify({
|
|
114
|
+
error: {
|
|
115
|
+
code: 'TOOL_EXECUTION_FAILED',
|
|
116
|
+
message: err instanceof Error ? err.message : String(err),
|
|
117
|
+
},
|
|
118
|
+
}, null, 2),
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
isError: true,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
const transport = new StdioServerTransport();
|
|
126
|
+
void server.connect(transport);
|
|
127
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;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AACH,CAAC,CAAC,CAAC;AAEH,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,KAAK,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiny Zod → JSON Schema shim sufficient for MCP tool input descriptors.
|
|
3
|
+
*
|
|
4
|
+
* The MCP `tools/list` response wants each tool's `inputSchema` as a JSON
|
|
5
|
+
* Schema object. We only use a small Zod subset (objects of strings /
|
|
6
|
+
* booleans / optionals with descriptions), so reaching for `zod-to-json-schema`
|
|
7
|
+
* as a full dependency is overkill — this 30-line implementation covers it
|
|
8
|
+
* and stays auditable. If the tool surface grows, swap in the npm package.
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
interface JsonSchema {
|
|
12
|
+
type: string;
|
|
13
|
+
properties?: Record<string, JsonSchema>;
|
|
14
|
+
required?: string[];
|
|
15
|
+
description?: string;
|
|
16
|
+
items?: JsonSchema;
|
|
17
|
+
enum?: string[];
|
|
18
|
+
}
|
|
19
|
+
export declare function zodToJsonSchema(schema: z.ZodTypeAny): JsonSchema;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=zod-to-json-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod-to-json-schema.d.ts","sourceRoot":"","sources":["../../src/lib/zod-to-json-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,GAAG,UAAU,CA2BhE"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiny Zod → JSON Schema shim sufficient for MCP tool input descriptors.
|
|
3
|
+
*
|
|
4
|
+
* The MCP `tools/list` response wants each tool's `inputSchema` as a JSON
|
|
5
|
+
* Schema object. We only use a small Zod subset (objects of strings /
|
|
6
|
+
* booleans / optionals with descriptions), so reaching for `zod-to-json-schema`
|
|
7
|
+
* as a full dependency is overkill — this 30-line implementation covers it
|
|
8
|
+
* and stays auditable. If the tool surface grows, swap in the npm package.
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
export function zodToJsonSchema(schema) {
|
|
12
|
+
// Object — the common top-level case for tool args.
|
|
13
|
+
if (schema instanceof z.ZodObject) {
|
|
14
|
+
const shape = schema.shape;
|
|
15
|
+
const properties = {};
|
|
16
|
+
const required = [];
|
|
17
|
+
for (const [key, value] of Object.entries(shape)) {
|
|
18
|
+
const inner = unwrap(value);
|
|
19
|
+
properties[key] = zodToJsonSchema(inner.schema);
|
|
20
|
+
if (inner.description)
|
|
21
|
+
properties[key].description = inner.description;
|
|
22
|
+
if (!inner.optional)
|
|
23
|
+
required.push(key);
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
type: 'object',
|
|
27
|
+
properties,
|
|
28
|
+
...(required.length > 0 && { required }),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
if (schema instanceof z.ZodString)
|
|
32
|
+
return { type: 'string' };
|
|
33
|
+
if (schema instanceof z.ZodEnum)
|
|
34
|
+
return { type: 'string', enum: [...schema.options] };
|
|
35
|
+
if (schema instanceof z.ZodNumber)
|
|
36
|
+
return { type: 'number' };
|
|
37
|
+
if (schema instanceof z.ZodBoolean)
|
|
38
|
+
return { type: 'boolean' };
|
|
39
|
+
if (schema instanceof z.ZodArray) {
|
|
40
|
+
return { type: 'array', items: zodToJsonSchema(schema.element) };
|
|
41
|
+
}
|
|
42
|
+
// Fallback — let MCP receive an open object.
|
|
43
|
+
return { type: 'object' };
|
|
44
|
+
}
|
|
45
|
+
function unwrap(s) {
|
|
46
|
+
let optional = false;
|
|
47
|
+
let description;
|
|
48
|
+
let cur = s;
|
|
49
|
+
// Unwrap z.optional() and pick up .describe() metadata.
|
|
50
|
+
while (true) {
|
|
51
|
+
description = description ?? cur.description;
|
|
52
|
+
if (cur instanceof z.ZodOptional) {
|
|
53
|
+
optional = true;
|
|
54
|
+
cur = cur.unwrap();
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return { schema: cur, optional, description };
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=zod-to-json-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod-to-json-schema.js","sourceRoot":"","sources":["../../src/lib/zod-to-json-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,MAAM,UAAU,eAAe,CAAC,MAAoB;IAClD,oDAAoD;IACpD,IAAI,MAAM,YAAY,CAAC,CAAC,SAAS,EAAE,CAAC;QAClC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAqC,CAAC;QAC3D,MAAM,UAAU,GAA+B,EAAE,CAAC;QAClD,MAAM,QAAQ,GAAa,EAAE,CAAC;QAC9B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACjD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YAC5B,UAAU,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAChD,IAAI,KAAK,CA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C7C,IAAI,GAAG,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC;YACjC,QAAQ,GAAG,IAAI,CAAC;YAChB,GAAG,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC;QACrB,CAAC;aAAM,CAAC;YACN,MAAM;QACR,CAAC;IACH,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;AAChD,CAAC"}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP tool registry. Each tool is a `(client, args) → result` function with
|
|
3
|
+
* a Zod-described input schema. The server (index.ts) wires them up.
|
|
4
|
+
*
|
|
5
|
+
* Read tools authenticate with the admin key. The one WRITE tool
|
|
6
|
+
* (`mint_api_key`) authenticates instead with a SCOPED operator
|
|
7
|
+
* personal-access-token (`RELIPAY_OPERATOR_TOKEN`) and is rejected server-side
|
|
8
|
+
* unless that PAT carries the `keys:mint` scope — default-deny, so an agent
|
|
9
|
+
* can't mint production keys unless explicitly granted. See AGENTS.md.
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
import type { AdminClient } from './client.js';
|
|
13
|
+
export interface ToolDefinition<TArgs extends z.ZodRawShape> {
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
inputSchema: z.ZodObject<TArgs>;
|
|
17
|
+
execute: (client: AdminClient, args: z.infer<z.ZodObject<TArgs>>) => Promise<unknown>;
|
|
18
|
+
}
|
|
19
|
+
export declare const tools: Array<ToolDefinition<z.ZodRawShape>>;
|
|
20
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,cAAc,CAAC,KAAK,SAAS,CAAC,CAAC,WAAW;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAChC,OAAO,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACvF;AA4DD,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW,CAAC,CAuHtD,CAAC"}
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP tool registry. Each tool is a `(client, args) → result` function with
|
|
3
|
+
* a Zod-described input schema. The server (index.ts) wires them up.
|
|
4
|
+
*
|
|
5
|
+
* Read tools authenticate with the admin key. The one WRITE tool
|
|
6
|
+
* (`mint_api_key`) authenticates instead with a SCOPED operator
|
|
7
|
+
* personal-access-token (`RELIPAY_OPERATOR_TOKEN`) and is rejected server-side
|
|
8
|
+
* unless that PAT carries the `keys:mint` scope — default-deny, so an agent
|
|
9
|
+
* can't mint production keys unless explicitly granted. See AGENTS.md.
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
const ListApplicationsArgs = z.object({
|
|
13
|
+
tenantId: z.string().optional().describe('Optional Tenant id to filter by.'),
|
|
14
|
+
});
|
|
15
|
+
const GetApplicationArgs = z.object({
|
|
16
|
+
applicationId: z.string().describe('Application id (cuid).'),
|
|
17
|
+
});
|
|
18
|
+
const ListPlansArgs = z.object({
|
|
19
|
+
applicationId: z.string().describe('Application id to list plans for.'),
|
|
20
|
+
includeInactive: z.boolean().optional().describe('If true, include deactivated plans.'),
|
|
21
|
+
});
|
|
22
|
+
const ListCouponsArgs = z.object({
|
|
23
|
+
applicationId: z.string().describe('Application id to list coupons for.'),
|
|
24
|
+
includeInactive: z.boolean().optional(),
|
|
25
|
+
});
|
|
26
|
+
const ListApiKeysArgs = z.object({
|
|
27
|
+
applicationId: z.string().describe('Application id to list active API keys for.'),
|
|
28
|
+
});
|
|
29
|
+
const MintApiKeyArgs = z.object({
|
|
30
|
+
applicationId: z
|
|
31
|
+
.string()
|
|
32
|
+
.describe('Application id to mint a secret key for. Must belong to the operator PAT\'s workspace.'),
|
|
33
|
+
name: z
|
|
34
|
+
.string()
|
|
35
|
+
.describe('Human label for the key, shown in lists (e.g. "ci-deploy", "agent-worker").'),
|
|
36
|
+
mode: z
|
|
37
|
+
.enum(['live', 'test'])
|
|
38
|
+
.optional()
|
|
39
|
+
.describe('"live" (default) or "test". Test keys hit sandbox billing providers.'),
|
|
40
|
+
scopes: z
|
|
41
|
+
.array(z.string())
|
|
42
|
+
.optional()
|
|
43
|
+
.describe('Application-key scopes (e.g. ["auth:read"]). Omit for the default ["*"].'),
|
|
44
|
+
});
|
|
45
|
+
const ListTenantsArgs = z.object({});
|
|
46
|
+
const ListPaymentsArgs = z.object({
|
|
47
|
+
applicationId: z.string().optional().describe('Filter to one Application id.'),
|
|
48
|
+
status: z
|
|
49
|
+
.enum(['PENDING', 'SUCCEEDED', 'FAILED', 'REFUNDED'])
|
|
50
|
+
.optional()
|
|
51
|
+
.describe('Filter by payment status.'),
|
|
52
|
+
q: z
|
|
53
|
+
.string()
|
|
54
|
+
.optional()
|
|
55
|
+
.describe('Exact-match search: payment id, provider payment id, or end-user id.'),
|
|
56
|
+
sort: z.enum(['createdAt', 'amount']).optional().describe('Sort field. Default createdAt.'),
|
|
57
|
+
order: z.enum(['asc', 'desc']).optional().describe('Sort direction. Default desc.'),
|
|
58
|
+
limit: z.number().int().min(1).max(200).optional().describe('Page size, 1–200. Default 50.'),
|
|
59
|
+
});
|
|
60
|
+
const PaymentStatsByAppArgs = z.object({});
|
|
61
|
+
export const tools = [
|
|
62
|
+
{
|
|
63
|
+
name: 'list_tenants',
|
|
64
|
+
description: 'List all Tenants. Tenants are the outer multi-tenancy unit (one per Rekey customer). Use this when the user asks "what tenants exist" or to find a tenantId to drill into.',
|
|
65
|
+
inputSchema: ListTenantsArgs,
|
|
66
|
+
execute: (c) => c.request('GET', '/api/v1/admin/tenants'),
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'list_applications',
|
|
70
|
+
description: 'List Applications, optionally filtered by Tenant. An Application is one project under a Tenant; every domain row in Rekey carries an applicationId. Use this to find the applicationId for subsequent calls.',
|
|
71
|
+
inputSchema: ListApplicationsArgs,
|
|
72
|
+
execute: (c, args) => {
|
|
73
|
+
const path = args.tenantId
|
|
74
|
+
? `/api/v1/admin/applications?tenantId=${encodeURIComponent(args.tenantId)}`
|
|
75
|
+
: '/api/v1/admin/applications';
|
|
76
|
+
return c.request('GET', path);
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'get_application',
|
|
81
|
+
description: 'Fetch one Application by id, including its authConfig and billingConfig (no secrets).',
|
|
82
|
+
inputSchema: GetApplicationArgs,
|
|
83
|
+
execute: (c, args) => c.request('GET', `/api/v1/admin/applications/${encodeURIComponent(args.applicationId)}`),
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'list_plans',
|
|
87
|
+
description: 'List Plans for an Application. Amount is always in the smallest currency unit (cents/paise/sen) — never floats.',
|
|
88
|
+
inputSchema: ListPlansArgs,
|
|
89
|
+
execute: (c, args) => c.request('GET', `/api/v1/admin/applications/${encodeURIComponent(args.applicationId)}/plans${args.includeInactive ? '?includeInactive=true' : ''}`),
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: 'list_coupons',
|
|
93
|
+
description: 'List discount coupons for an Application. PERCENT discounts use basis-points × 10 (1500 = 15%); AMOUNT discounts use the smallest currency unit.',
|
|
94
|
+
inputSchema: ListCouponsArgs,
|
|
95
|
+
execute: (c, args) => c.request('GET', `/api/v1/admin/applications/${encodeURIComponent(args.applicationId)}/coupons${args.includeInactive ? '?includeInactive=true' : ''}`),
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: 'list_api_keys',
|
|
99
|
+
description: 'List active API keys for an Application. Returns metadata only — the raw key value is unrecoverable after creation, by design.',
|
|
100
|
+
inputSchema: ListApiKeysArgs,
|
|
101
|
+
execute: (c, args) => c.request('GET', `/api/v1/admin/applications/${encodeURIComponent(args.applicationId)}/api-keys`),
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'list_payments',
|
|
105
|
+
description: 'List recent payments (newest first), optionally filtered to one Application and/or status. ' +
|
|
106
|
+
'Each row carries applicationId, applicationSlug, endUserId, amount, currency, status, createdAt. ' +
|
|
107
|
+
'Amounts are integers in the smallest currency unit (cents/paise/sen) — never floats.',
|
|
108
|
+
inputSchema: ListPaymentsArgs,
|
|
109
|
+
execute: async (c, args) => {
|
|
110
|
+
const p = new URLSearchParams();
|
|
111
|
+
if (args.applicationId !== undefined)
|
|
112
|
+
p.set('applicationId', args.applicationId);
|
|
113
|
+
if (args.status !== undefined)
|
|
114
|
+
p.set('status', args.status);
|
|
115
|
+
if (args.q !== undefined)
|
|
116
|
+
p.set('q', args.q);
|
|
117
|
+
if (args.sort !== undefined)
|
|
118
|
+
p.set('sort', args.sort);
|
|
119
|
+
if (args.order !== undefined)
|
|
120
|
+
p.set('order', args.order);
|
|
121
|
+
if (args.limit !== undefined)
|
|
122
|
+
p.set('limit', String(args.limit));
|
|
123
|
+
const qs = p.toString();
|
|
124
|
+
// /admin/metrics/payments returns a paginated Page<T> envelope
|
|
125
|
+
// ({ items, total, limit, offset }). This tool's contract is a bare
|
|
126
|
+
// payments array (bounded by `limit`), so unwrap to `.items`.
|
|
127
|
+
const page = await c.request('GET', `/api/v1/admin/metrics/payments${qs ? `?${qs}` : ''}`);
|
|
128
|
+
return page.items;
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: 'get_payment_stats_by_app',
|
|
133
|
+
description: 'Billing/payment health per Application over the last 30 days: succeeded/failed/pending/refunded ' +
|
|
134
|
+
'counts, success rate, and SUCCEEDED volume (volumeCents, smallest currency unit). Use this for ' +
|
|
135
|
+
'"which apps are earning / failing payments" questions. (The richer per-app Billing Overview — MRR, ' +
|
|
136
|
+
"12-month revenue series — lives at the panel-session-only endpoint /api/v1/tenant/applications/:id/billing/stats and isn't reachable with this server's credentials.)",
|
|
137
|
+
inputSchema: PaymentStatsByAppArgs,
|
|
138
|
+
execute: (c) => c.request('GET', '/api/v1/admin/metrics/payments-by-app'),
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
name: 'mint_api_key',
|
|
142
|
+
description: 'WRITE: Mint a new secret API key (rp_live_…/rp_test_…) for an Application. The raw key is returned exactly ONCE — surface it to the user immediately and tell them it cannot be recovered. ' +
|
|
143
|
+
'Authenticates as a SCOPED operator via RELIPAY_OPERATOR_TOKEN (not the admin key); the token must carry the `keys:mint` scope and belong to the workspace that owns the Application, or the call is rejected. ' +
|
|
144
|
+
'Use this only when the user explicitly asks to create/mint an API key.',
|
|
145
|
+
inputSchema: MintApiKeyArgs,
|
|
146
|
+
execute: (c, args) => c.requestAsOperator('POST', `/api/v1/tenant/operator/applications/${encodeURIComponent(args.applicationId)}/api-keys`, {
|
|
147
|
+
name: args.name,
|
|
148
|
+
...(args.mode !== undefined ? { mode: args.mode } : {}),
|
|
149
|
+
...(args.scopes !== undefined ? { scopes: args.scopes } : {}),
|
|
150
|
+
}),
|
|
151
|
+
},
|
|
152
|
+
];
|
|
153
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,M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48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rekey.dev/mcp",
|
|
3
|
+
"version": "1.1.2",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "Model Context Protocol server for Rekey — lets Claude Desktop / Cursor / Claude Code introspect a deployment.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"rekey-mcp": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"AGENTS.md",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
23
|
+
"keywords": [
|
|
24
|
+
"rekey",
|
|
25
|
+
"mcp",
|
|
26
|
+
"model-context-protocol",
|
|
27
|
+
"ai"
|
|
28
|
+
],
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@modelcontextprotocol/sdk": "^1.0.4",
|
|
31
|
+
"zod": "^3.23.8",
|
|
32
|
+
"@rekey.dev/shared-types": "1.1.2"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/node": "^22.9.0",
|
|
36
|
+
"typescript": "^5.6.3",
|
|
37
|
+
"vitest": "^2.1.5"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsc -p tsconfig.json && chmod +x dist/index.js",
|
|
44
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
45
|
+
"lint": "echo \"(eslint not yet wired)\"",
|
|
46
|
+
"test": "vitest run"
|
|
47
|
+
}
|
|
48
|
+
}
|