@relipay/mcp 0.1.0-beta.0
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/AGENTS.md +67 -0
- package/README.md +58 -0
- package/dist/client.d.ts +25 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +45 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +113 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/zod-to-json-schema.d.ts +20 -0
- package/dist/lib/zod-to-json-schema.d.ts.map +1 -0
- package/dist/lib/zod-to-json-schema.js +60 -0
- package/dist/lib/zod-to-json-schema.js.map +1 -0
- package/dist/tools.d.ts +18 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +71 -0
- package/dist/tools.js.map +1 -0
- package/package.json +48 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# AGENTS.md — `@relipay/mcp`
|
|
2
|
+
|
|
3
|
+
You are an AI agent connected to ReliPay via this MCP server. This file tells you what's safe to do and what's deliberately not exposed.
|
|
4
|
+
|
|
5
|
+
## What this server is
|
|
6
|
+
|
|
7
|
+
A [Model Context Protocol](https://modelcontextprotocol.io) server that lets you introspect a ReliPay deployment over stdio. Wired into Claude Desktop / Cursor / Claude Code via:
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"mcpServers": {
|
|
12
|
+
"relipay": {
|
|
13
|
+
"command": "npx",
|
|
14
|
+
"args": ["-y", "@relipay/mcp"],
|
|
15
|
+
"env": {
|
|
16
|
+
"RELIPAY_URL": "https://relipay.example.com",
|
|
17
|
+
"SUPER_ADMIN_KEY": "..."
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The server reads `RELIPAY_URL` and `SUPER_ADMIN_KEY` from its env. Both are required — the server exits with a clear stderr message if either is missing.
|
|
25
|
+
|
|
26
|
+
## Tools today (read-only by design)
|
|
27
|
+
|
|
28
|
+
| Tool | What it does |
|
|
29
|
+
|---|---|
|
|
30
|
+
| `list_tenants` | All Tenants in the deployment |
|
|
31
|
+
| `list_applications` | Applications, optionally filtered by `tenantId` |
|
|
32
|
+
| `get_application` | One Application by id (with authConfig + billingConfig, no secrets) |
|
|
33
|
+
| `list_plans` | Plans for an Application; `includeInactive` for archived ones |
|
|
34
|
+
| `list_coupons` | Coupons for an Application; `includeInactive` for deactivated ones |
|
|
35
|
+
| `list_api_keys` | Active API keys for an Application — metadata only, hash never returned |
|
|
36
|
+
|
|
37
|
+
## Why no write tools yet
|
|
38
|
+
|
|
39
|
+
Production agents shouldn't accidentally mint a live API key, refund a real payment, or deactivate a plan that's currently selling. Write tools (mint API key, create plan, refund payment, deactivate coupon) ship behind explicit opt-in scopes in a future commit. For now: introspection only.
|
|
40
|
+
|
|
41
|
+
If a user asks you to *do* a thing that's not a `list_*` / `get_*` here, your job is to:
|
|
42
|
+
|
|
43
|
+
1. Help them figure out what to do via the read-only tools.
|
|
44
|
+
2. Tell them to run the operation via `relipay <command>` (the CLI) or the Panel.
|
|
45
|
+
3. Never suggest they manually craft API calls if a CLI command exists for it.
|
|
46
|
+
|
|
47
|
+
## Errors
|
|
48
|
+
|
|
49
|
+
Every tool error is a JSON object with `error: { code, message, fix?, statusCode? }` in the response content (with `isError: true`). The `fix` field is the most useful — read it first, surface it to the user.
|
|
50
|
+
|
|
51
|
+
Notable codes:
|
|
52
|
+
|
|
53
|
+
- `TOOL_NOT_FOUND` — name doesn't match the registry. Call `list_tools`.
|
|
54
|
+
- `TOOL_ARGS_INVALID` — your input failed Zod validation. Check `inputSchema`.
|
|
55
|
+
- `APPLICATION_NOT_FOUND`, `TENANT_NOT_FOUND` — ids don't exist; list first.
|
|
56
|
+
- `ADMIN_AUTH_INVALID` — `SUPER_ADMIN_KEY` env is wrong. Tell the user to check their MCP config.
|
|
57
|
+
|
|
58
|
+
## Money rule
|
|
59
|
+
|
|
60
|
+
`amount` fields throughout ReliPay are **integers in the smallest currency unit** (cents/paise/sen). If you render `999 USD/MONTH`, format it as `$9.99/month`. Never assume a `.00` decimal — `100` is `$1.00` in USD but `¥100` (a hundred whole yen) in JPY.
|
|
61
|
+
|
|
62
|
+
## What NOT to do
|
|
63
|
+
|
|
64
|
+
- Don't combine multiple read calls into a single response without telling the user what you ran. Be explicit ("ran list_applications, then list_plans for app_xyz").
|
|
65
|
+
- Don't suggest mutating operations as inline `curl` commands. The CLI exists.
|
|
66
|
+
- Don't leak `metadata` content as commentary — it may contain operator-private notes.
|
|
67
|
+
- Don't try to enumerate other Tenants when the user asks about "their" data. Restrict to the Tenant they identified themselves with.
|
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# @relipay/mcp
|
|
2
|
+
|
|
3
|
+
A [Model Context Protocol](https://modelcontextprotocol.io) server for ReliPay. Lets Claude Desktop, Cursor, and Claude Code introspect a deployment directly — no screenshots, no copy-paste from the panel.
|
|
4
|
+
|
|
5
|
+
> **For AI agents**: see [AGENTS.md](./AGENTS.md) for what's safe to call.
|
|
6
|
+
|
|
7
|
+
## Install in Claude Desktop
|
|
8
|
+
|
|
9
|
+
`~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or the equivalent on your platform:
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"mcpServers": {
|
|
14
|
+
"relipay": {
|
|
15
|
+
"command": "npx",
|
|
16
|
+
"args": ["-y", "@relipay/mcp"],
|
|
17
|
+
"env": {
|
|
18
|
+
"RELIPAY_URL": "https://relipay.example.com",
|
|
19
|
+
"SUPER_ADMIN_KEY": "your-admin-key-here"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Restart Claude Desktop. The server appears under "MCP servers"; tools are available as `mcp__relipay__list_applications`, etc.
|
|
27
|
+
|
|
28
|
+
## Install in Cursor
|
|
29
|
+
|
|
30
|
+
Settings → MCP → Add Server. Same `command` / `args` / `env` shape.
|
|
31
|
+
|
|
32
|
+
## Install in Claude Code
|
|
33
|
+
|
|
34
|
+
`.claude/mcp.json` in your repo:
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"mcpServers": {
|
|
39
|
+
"relipay": {
|
|
40
|
+
"command": "npx",
|
|
41
|
+
"args": ["-y", "@relipay/mcp"],
|
|
42
|
+
"env": { "RELIPAY_URL": "...", "SUPER_ADMIN_KEY": "..." }
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Tools (read-only)
|
|
49
|
+
|
|
50
|
+
- `list_tenants`
|
|
51
|
+
- `list_applications`, `get_application`
|
|
52
|
+
- `list_plans`, `list_coupons`, `list_api_keys`
|
|
53
|
+
|
|
54
|
+
Write tools (mint key, create plan, refund) deliberately deferred — see [AGENTS.md](./AGENTS.md).
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
MIT.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
adminKey: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class AdminApiError extends Error {
|
|
10
|
+
readonly code: string;
|
|
11
|
+
readonly fix: string | undefined;
|
|
12
|
+
readonly statusCode: number;
|
|
13
|
+
constructor(args: {
|
|
14
|
+
code: string;
|
|
15
|
+
message: string;
|
|
16
|
+
fix?: string;
|
|
17
|
+
statusCode: number;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export declare class AdminClient {
|
|
21
|
+
private readonly cfg;
|
|
22
|
+
constructor(cfg: AdminClientConfig);
|
|
23
|
+
request<T>(method: string, path: string, body?: unknown): Promise<T>;
|
|
24
|
+
}
|
|
25
|
+
//# 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,QAAQ,EAAE,MAAM,CAAC;CAClB;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;IAK7C,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;CAqB3E"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
if (!cfg.adminKey)
|
|
24
|
+
throw new Error('AdminClient: adminKey is required.');
|
|
25
|
+
}
|
|
26
|
+
async request(method, path, body) {
|
|
27
|
+
const res = await fetch(`${this.cfg.apiUrl.replace(/\/$/, '')}${path}`, {
|
|
28
|
+
method,
|
|
29
|
+
headers: {
|
|
30
|
+
Authorization: `Bearer ${this.cfg.adminKey}`,
|
|
31
|
+
...(body !== undefined ? { 'Content-Type': 'application/json' } : {}),
|
|
32
|
+
},
|
|
33
|
+
...(body !== undefined ? { body: JSON.stringify(body) } : {}),
|
|
34
|
+
});
|
|
35
|
+
const json = (await res.json().catch(() => ({})));
|
|
36
|
+
if (!res.ok || ('success' in json && json.success === false)) {
|
|
37
|
+
const err = 'error' in json
|
|
38
|
+
? json.error
|
|
39
|
+
: { code: 'UNKNOWN_ERROR', message: `HTTP ${res.status}` };
|
|
40
|
+
throw new AdminApiError({ ...err, statusCode: res.status });
|
|
41
|
+
}
|
|
42
|
+
return json.data;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,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,IAA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,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,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @relipay/mcp — Model Context Protocol server.
|
|
4
|
+
*
|
|
5
|
+
* Speaks MCP over stdio, exposing read-only tools for ReliPay introspection
|
|
6
|
+
* (Applications, Plans, Coupons, API keys, Tenants). Designed to be wired
|
|
7
|
+
* into Claude Desktop, Cursor, and Claude Code so an AI agent can answer
|
|
8
|
+
* "what plans does this app have?" or "is this user's API key revoked?"
|
|
9
|
+
* without screenshots.
|
|
10
|
+
*
|
|
11
|
+
* Read-only by design — write tools (mint key, refund payment, create plan)
|
|
12
|
+
* ship behind explicit opt-in scopes in a future commit. Production agents
|
|
13
|
+
* shouldn't accidentally mutate state.
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;GAYG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @relipay/mcp — Model Context Protocol server.
|
|
4
|
+
*
|
|
5
|
+
* Speaks MCP over stdio, exposing read-only tools for ReliPay introspection
|
|
6
|
+
* (Applications, Plans, Coupons, API keys, Tenants). Designed to be wired
|
|
7
|
+
* into Claude Desktop, Cursor, and Claude Code so an AI agent can answer
|
|
8
|
+
* "what plans does this app have?" or "is this user's API key revoked?"
|
|
9
|
+
* without screenshots.
|
|
10
|
+
*
|
|
11
|
+
* Read-only by design — write tools (mint key, refund payment, create plan)
|
|
12
|
+
* ship behind explicit opt-in scopes in a future commit. Production agents
|
|
13
|
+
* shouldn't accidentally mutate state.
|
|
14
|
+
*/
|
|
15
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
16
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
17
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
18
|
+
import { zodToJsonSchema } from './lib/zod-to-json-schema.js';
|
|
19
|
+
import { AdminClient, AdminApiError } from './client.js';
|
|
20
|
+
import { tools } from './tools.js';
|
|
21
|
+
const apiUrl = process.env.RELIPAY_URL ?? '';
|
|
22
|
+
const adminKey = process.env.SUPER_ADMIN_KEY ?? '';
|
|
23
|
+
if (!apiUrl || !adminKey) {
|
|
24
|
+
process.stderr.write(`[relipay-mcp] missing required env: RELIPAY_URL and SUPER_ADMIN_KEY must both be set.\n` +
|
|
25
|
+
`[relipay-mcp] fix: configure these in the MCP client (Claude Desktop config, Cursor MCP settings, …)\n`);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
const client = new AdminClient({ apiUrl, adminKey });
|
|
29
|
+
const server = new Server({ name: 'relipay-mcp', version: '0.0.0' }, { capabilities: { tools: {} } });
|
|
30
|
+
server.setRequestHandler(ListToolsRequestSchema, () => ({
|
|
31
|
+
tools: tools.map((t) => ({
|
|
32
|
+
name: t.name,
|
|
33
|
+
description: t.description,
|
|
34
|
+
inputSchema: zodToJsonSchema(t.inputSchema),
|
|
35
|
+
})),
|
|
36
|
+
}));
|
|
37
|
+
server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
38
|
+
const tool = tools.find((t) => t.name === req.params.name);
|
|
39
|
+
if (!tool) {
|
|
40
|
+
return {
|
|
41
|
+
content: [
|
|
42
|
+
{
|
|
43
|
+
type: 'text',
|
|
44
|
+
text: JSON.stringify({
|
|
45
|
+
error: {
|
|
46
|
+
code: 'TOOL_NOT_FOUND',
|
|
47
|
+
message: `Unknown tool: ${req.params.name}`,
|
|
48
|
+
fix: 'Call list_tools to see what is available.',
|
|
49
|
+
},
|
|
50
|
+
}, null, 2),
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
isError: true,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const parsed = tool.inputSchema.safeParse(req.params.arguments ?? {});
|
|
57
|
+
if (!parsed.success) {
|
|
58
|
+
return {
|
|
59
|
+
content: [
|
|
60
|
+
{
|
|
61
|
+
type: 'text',
|
|
62
|
+
text: JSON.stringify({
|
|
63
|
+
error: {
|
|
64
|
+
code: 'TOOL_ARGS_INVALID',
|
|
65
|
+
message: 'Tool arguments failed validation.',
|
|
66
|
+
fix: 'Re-call with arguments matching inputSchema. Issues: ' +
|
|
67
|
+
parsed.error.issues.map((i) => `${i.path.join('.')}: ${i.message}`).join('; '),
|
|
68
|
+
},
|
|
69
|
+
}, null, 2),
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
isError: true,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
const result = await tool.execute(client, parsed.data);
|
|
77
|
+
return {
|
|
78
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
if (err instanceof AdminApiError) {
|
|
83
|
+
return {
|
|
84
|
+
content: [
|
|
85
|
+
{
|
|
86
|
+
type: 'text',
|
|
87
|
+
text: JSON.stringify({
|
|
88
|
+
error: { code: err.code, message: err.message, fix: err.fix, statusCode: err.statusCode },
|
|
89
|
+
}, null, 2),
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
isError: true,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
content: [
|
|
97
|
+
{
|
|
98
|
+
type: 'text',
|
|
99
|
+
text: JSON.stringify({
|
|
100
|
+
error: {
|
|
101
|
+
code: 'TOOL_EXECUTION_FAILED',
|
|
102
|
+
message: err instanceof Error ? err.message : String(err),
|
|
103
|
+
},
|
|
104
|
+
}, null, 2),
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
isError: true,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
const transport = new StdioServerTransport();
|
|
112
|
+
void server.connect(transport);
|
|
113
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;GAYG;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;AAC9D,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC;AAC7C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,EAAE,CAAC;AAEnD,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;IACzB,OAAO,C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CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE;yBAC1F,EACD,IAAI,EACJ,CAAC,CACF;qBACF;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;QACD,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;wBACE,KAAK,EAAE;4BACL,IAAI,EAAE,uBAAuB;4BAC7B,OAAO,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;yBAC1D;qBACF,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,KAAK,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
}
|
|
18
|
+
export declare function zodToJsonSchema(schema: z.ZodTypeAny): JsonSchema;
|
|
19
|
+
export {};
|
|
20
|
+
//# 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;CACpB;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,GAAG,UAAU,CA0BhE"}
|
|
@@ -0,0 +1,60 @@
|
|
|
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.ZodNumber)
|
|
34
|
+
return { type: 'number' };
|
|
35
|
+
if (schema instanceof z.ZodBoolean)
|
|
36
|
+
return { type: 'boolean' };
|
|
37
|
+
if (schema instanceof z.ZodArray) {
|
|
38
|
+
return { type: 'array', items: zodToJsonSchema(schema.element) };
|
|
39
|
+
}
|
|
40
|
+
// Fallback — let MCP receive an open object.
|
|
41
|
+
return { type: 'object' };
|
|
42
|
+
}
|
|
43
|
+
function unwrap(s) {
|
|
44
|
+
let optional = false;
|
|
45
|
+
let description;
|
|
46
|
+
let cur = s;
|
|
47
|
+
// Unwrap z.optional() and pick up .describe() metadata.
|
|
48
|
+
while (true) {
|
|
49
|
+
description = description ?? cur.description;
|
|
50
|
+
if (cur instanceof z.ZodOptional) {
|
|
51
|
+
optional = true;
|
|
52
|
+
cur = cur.unwrap();
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return { schema: cur, optional, description };
|
|
59
|
+
}
|
|
60
|
+
//# 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;AAUxB,MAAM,UAAU,eAAe,CAAC,MAAoB;IA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6CAA6C;IAC7C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAC5B,CAAC;AAED,SAAS,MAAM,CAAC,CAAe;IAK7B,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,IAAI,WAA+B,CAAC;IACpC,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,wDAAwD;IACxD,OAAO,IAAI,EAAE,CAAC;QACZ,WAAW,GAAG,WAAW,IAAI,GAAG,CAAC,WAAW,CAAC;QAC7C,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,18 @@
|
|
|
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
|
+
* Today every tool is **read-only** by design — write tools (mint API key,
|
|
6
|
+
* create plan, refund payment) ship behind an explicit opt-in scope so an
|
|
7
|
+
* agent can't accidentally mutate production. See AGENTS.md.
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
import type { AdminClient } from './client.js';
|
|
11
|
+
export interface ToolDefinition<TArgs extends z.ZodRawShape> {
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
inputSchema: z.ZodObject<TArgs>;
|
|
15
|
+
execute: (client: AdminClient, args: z.infer<z.ZodObject<TArgs>>) => Promise<unknown>;
|
|
16
|
+
}
|
|
17
|
+
export declare const tools: Array<ToolDefinition<z.ZodRawShape>>;
|
|
18
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;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;AA0BD,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW,CAAC,CAiEtD,CAAC"}
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
* Today every tool is **read-only** by design — write tools (mint API key,
|
|
6
|
+
* create plan, refund payment) ship behind an explicit opt-in scope so an
|
|
7
|
+
* agent can't accidentally mutate production. See AGENTS.md.
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
const ListApplicationsArgs = z.object({
|
|
11
|
+
tenantId: z.string().optional().describe('Optional Tenant id to filter by.'),
|
|
12
|
+
});
|
|
13
|
+
const GetApplicationArgs = z.object({
|
|
14
|
+
applicationId: z.string().describe('Application id (cuid).'),
|
|
15
|
+
});
|
|
16
|
+
const ListPlansArgs = z.object({
|
|
17
|
+
applicationId: z.string().describe('Application id to list plans for.'),
|
|
18
|
+
includeInactive: z.boolean().optional().describe('If true, include deactivated plans.'),
|
|
19
|
+
});
|
|
20
|
+
const ListCouponsArgs = z.object({
|
|
21
|
+
applicationId: z.string().describe('Application id to list coupons for.'),
|
|
22
|
+
includeInactive: z.boolean().optional(),
|
|
23
|
+
});
|
|
24
|
+
const ListApiKeysArgs = z.object({
|
|
25
|
+
applicationId: z.string().describe('Application id to list active API keys for.'),
|
|
26
|
+
});
|
|
27
|
+
const ListTenantsArgs = z.object({});
|
|
28
|
+
export const tools = [
|
|
29
|
+
{
|
|
30
|
+
name: 'list_tenants',
|
|
31
|
+
description: 'List all Tenants. Tenants are the outer multi-tenancy unit (one per ReliPay customer). Use this when the user asks "what tenants exist" or to find a tenantId to drill into.',
|
|
32
|
+
inputSchema: ListTenantsArgs,
|
|
33
|
+
execute: (c) => c.request('GET', '/api/v1/admin/tenants'),
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'list_applications',
|
|
37
|
+
description: 'List Applications, optionally filtered by Tenant. An Application is one project under a Tenant; every domain row in ReliPay carries an applicationId. Use this to find the applicationId for subsequent calls.',
|
|
38
|
+
inputSchema: ListApplicationsArgs,
|
|
39
|
+
execute: (c, args) => {
|
|
40
|
+
const path = args.tenantId
|
|
41
|
+
? `/api/v1/admin/applications?tenantId=${encodeURIComponent(args.tenantId)}`
|
|
42
|
+
: '/api/v1/admin/applications';
|
|
43
|
+
return c.request('GET', path);
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'get_application',
|
|
48
|
+
description: 'Fetch one Application by id, including its authConfig and billingConfig (no secrets).',
|
|
49
|
+
inputSchema: GetApplicationArgs,
|
|
50
|
+
execute: (c, args) => c.request('GET', `/api/v1/admin/applications/${encodeURIComponent(args.applicationId)}`),
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'list_plans',
|
|
54
|
+
description: 'List Plans for an Application. Amount is always in the smallest currency unit (cents/paise/sen) — never floats.',
|
|
55
|
+
inputSchema: ListPlansArgs,
|
|
56
|
+
execute: (c, args) => c.request('GET', `/api/v1/admin/applications/${encodeURIComponent(args.applicationId)}/plans${args.includeInactive ? '?includeInactive=true' : ''}`),
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'list_coupons',
|
|
60
|
+
description: 'List discount coupons for an Application. PERCENT discounts use basis-points × 10 (1500 = 15%); AMOUNT discounts use the smallest currency unit.',
|
|
61
|
+
inputSchema: ListCouponsArgs,
|
|
62
|
+
execute: (c, args) => c.request('GET', `/api/v1/admin/applications/${encodeURIComponent(args.applicationId)}/coupons${args.includeInactive ? '?includeInactive=true' : ''}`),
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'list_api_keys',
|
|
66
|
+
description: 'List active API keys for an Application. Returns metadata only — the raw key value is unrecoverable after creation, by design.',
|
|
67
|
+
inputSchema: ListApiKeysArgs,
|
|
68
|
+
execute: (c, args) => c.request('GET', `/api/v1/admin/applications/${encodeURIComponent(args.applicationId)}/api-keys`),
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;CAC7E,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;CAC7D,CAAC,CAAC;AAEH,MAAM,aAAa,GAAG,CAAC,C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Model Context Protocol server for ReliPay — lets Claude Desktop / Cursor / Claude Code introspect a deployment.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"relipay-mcp": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"AGENTS.md",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
22
|
+
"keywords": [
|
|
23
|
+
"relipay",
|
|
24
|
+
"mcp",
|
|
25
|
+
"model-context-protocol",
|
|
26
|
+
"ai"
|
|
27
|
+
],
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@modelcontextprotocol/sdk": "^1.0.4",
|
|
30
|
+
"zod": "^3.23.8",
|
|
31
|
+
"@relipay/shared-types": "0.1.0-beta.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/node": "^22.9.0",
|
|
35
|
+
"typescript": "^5.6.3",
|
|
36
|
+
"vitest": "^2.1.5"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public",
|
|
40
|
+
"tag": "beta"
|
|
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
|
+
}
|