tru-mcp 0.1.1 → 0.3.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/README.md +84 -18
- package/dist/api-client.d.ts +28 -0
- package/dist/api-client.js +50 -0
- package/dist/api-client.js.map +1 -1
- package/dist/init.js +51 -96
- package/dist/init.js.map +1 -1
- package/dist/server.js +10 -2
- package/dist/server.js.map +1 -1
- package/dist/tools/connect_stripe.d.ts +23 -0
- package/dist/tools/connect_stripe.js +74 -0
- package/dist/tools/connect_stripe.js.map +1 -0
- package/dist/tools/discover_api.d.ts +23 -0
- package/dist/tools/discover_api.js +73 -0
- package/dist/tools/discover_api.js.map +1 -0
- package/dist/tools/get_started.d.ts +11 -0
- package/dist/tools/get_started.js +250 -0
- package/dist/tools/get_started.js.map +1 -0
- package/dist/tools/provision_user.d.ts +25 -0
- package/dist/tools/provision_user.js +84 -0
- package/dist/tools/provision_user.js.map +1 -0
- package/dist/tools/register_app.d.ts +2 -0
- package/dist/tools/register_app.js +5 -1
- package/dist/tools/register_app.js.map +1 -1
- package/dist/tools/request_user_data.d.ts +27 -0
- package/dist/tools/request_user_data.js +63 -0
- package/dist/tools/request_user_data.js.map +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# tru MCP Server
|
|
2
2
|
|
|
3
|
-
MCP server for [tru](https://tru-by29.onrender.com) —
|
|
3
|
+
MCP server for [tru](https://tru-by29.onrender.com) — auth and billing API in one. Verify identity, charge users, issue virtual cards, and get risk signals on every user. Payments flow to your existing Stripe account.
|
|
4
4
|
|
|
5
5
|
## Quick Setup
|
|
6
6
|
|
|
@@ -8,7 +8,17 @@ MCP server for [tru](https://tru-by29.onrender.com) — portable identity and bi
|
|
|
8
8
|
npx tru-mcp init
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
This detects your MCP client (Claude Code, Claude Desktop, Cursor) and writes the config automatically.
|
|
11
|
+
No API key needed. This detects your MCP client (Claude Code, Claude Desktop, Cursor) and writes the config automatically. Then tell your agent:
|
|
12
|
+
|
|
13
|
+
> "Run get_started to set up tru"
|
|
14
|
+
|
|
15
|
+
Your agent will register your app, get you an API key, connect Stripe, and discover your API — all in one conversation.
|
|
16
|
+
|
|
17
|
+
If you already have an API key:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx tru-mcp init --key tru_ak_your_key_here
|
|
21
|
+
```
|
|
12
22
|
|
|
13
23
|
### Manual Config
|
|
14
24
|
|
|
@@ -21,8 +31,7 @@ Add to your `.mcp.json` (Claude Code) or equivalent:
|
|
|
21
31
|
"command": "npx",
|
|
22
32
|
"args": ["-y", "tru-mcp"],
|
|
23
33
|
"env": {
|
|
24
|
-
"TRU_API_URL": "https://tru-by29.onrender.com"
|
|
25
|
-
"TRU_API_KEY": "your_api_key_here"
|
|
34
|
+
"TRU_API_URL": "https://tru-by29.onrender.com"
|
|
26
35
|
}
|
|
27
36
|
}
|
|
28
37
|
}
|
|
@@ -33,42 +42,99 @@ Add to your `.mcp.json` (Claude Code) or equivalent:
|
|
|
33
42
|
|
|
34
43
|
| Variable | Required | Description |
|
|
35
44
|
|----------|----------|-------------|
|
|
36
|
-
| `TRU_API_KEY` |
|
|
45
|
+
| `TRU_API_KEY` | No | Your tru API key (starts with `tru_ak_`). Not needed for initial setup — `register_app` will create one. |
|
|
37
46
|
| `TRU_API_URL` | No | tru server URL (default: `https://tru-by29.onrender.com`) |
|
|
38
47
|
|
|
48
|
+
## Getting Started
|
|
49
|
+
|
|
50
|
+
The MCP tools walk you through setup step by step:
|
|
51
|
+
|
|
52
|
+
1. **`get_started`** — Full guide: what tru is, why it matters, risk signals, setup walkthrough
|
|
53
|
+
2. **`register_app`** — Create your app, get an API key
|
|
54
|
+
3. **`connect_stripe`** — Link your Stripe account to receive payments
|
|
55
|
+
|
|
56
|
+
After that, you're live. All the tools below work immediately.
|
|
57
|
+
|
|
39
58
|
## Tools
|
|
40
59
|
|
|
41
60
|
| Tool | Description |
|
|
42
61
|
|------|-------------|
|
|
43
|
-
|
|
|
44
|
-
| `
|
|
62
|
+
| **Setup** | |
|
|
63
|
+
| `get_started` | Full setup guide — what tru is, how to integrate, risk signals explained |
|
|
64
|
+
| `register_app` | Register a new app on tru and get an API key |
|
|
65
|
+
| `connect_stripe` | Link your existing Stripe account to receive payments |
|
|
66
|
+
| `discover_api` | Crawl your site and generate an agent skill (SKILL.md) |
|
|
67
|
+
| **Identity & Data** | |
|
|
68
|
+
| `check_identity` | Verify a user + get risk signals (level, score, card funding, country) |
|
|
69
|
+
| `request_user_data` | Request verified data from a user's vault (name, email, phone, address) |
|
|
45
70
|
| `check_request_status` | Poll the status of a credential request |
|
|
71
|
+
| **Billing** | |
|
|
46
72
|
| `create_charge` | Create a direct charge or subscription |
|
|
47
73
|
| `check_charge_status` | Check the status of a charge request |
|
|
48
74
|
| `request_virtual_card` | Issue a single-use virtual card for agent purchases |
|
|
75
|
+
| **Provisioning** | |
|
|
76
|
+
| `provision_user` | Auto-create a user account on a third-party app |
|
|
77
|
+
| **Discovery** | |
|
|
49
78
|
| `discover_apps` | Browse registered apps on the tru platform |
|
|
50
79
|
| `read_skill` | Read an app's agent skill guide |
|
|
51
80
|
| `initiate_oauth` | Start an OAuth login flow with a tru-registered app |
|
|
52
|
-
| `register_app` | [Developer] Register a new app on the tru platform |
|
|
53
81
|
|
|
54
|
-
##
|
|
82
|
+
## Why tru?
|
|
83
|
+
|
|
84
|
+
- **Risk signals from day one** — every user carries a risk profile built from Stripe Radar. Use risk level, score, card funding type, country, and fingerprint reuse to set trial length, spending limits, and feature access.
|
|
85
|
+
- **Auth + billing in one API** — stop stitching together Stripe, an identity provider, a KYC vendor, and your own spending controls.
|
|
86
|
+
- **Payments to your Stripe** — connect via OAuth, money flows to your existing account. Same dashboard, same bank, same everything.
|
|
87
|
+
- **Users control spending** — they set per-app rules ("auto-approve under $10"), which builds trust and increases conversion.
|
|
88
|
+
|
|
89
|
+
## Example: Developer Setup
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
Developer: I want to integrate tru into my app
|
|
93
|
+
|
|
94
|
+
Agent: → get_started()
|
|
95
|
+
Here's how tru works...
|
|
96
|
+
|
|
97
|
+
Agent: Let's register your app.
|
|
98
|
+
→ register_app(service_name: "my-app", display_name: "My App", owner_email: "dev@example.com")
|
|
99
|
+
✓ App created — API key: tru_ak_...
|
|
100
|
+
|
|
101
|
+
Agent: Now let's connect your Stripe account.
|
|
102
|
+
→ connect_stripe(service_name: "my-app")
|
|
103
|
+
Open this URL to authorize: https://connect.stripe.com/oauth/authorize?...
|
|
104
|
+
|
|
105
|
+
Agent: You're live. Charges approved by tru users will flow to your Stripe account.
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Example: Auto-Provisioning
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
User: Sign me up for clayking
|
|
112
|
+
|
|
113
|
+
Agent: → check_identity(email: "user@example.com")
|
|
114
|
+
✓ Verified — risk: low
|
|
55
115
|
|
|
116
|
+
Agent: → provision_user(email: "user@example.com", service_name: "clayking")
|
|
117
|
+
✓ Provisioned — got API key and account ID
|
|
118
|
+
|
|
119
|
+
Agent: Now using clayking API on behalf of user...
|
|
56
120
|
```
|
|
57
|
-
User: "Sign me up for that new service"
|
|
58
|
-
Agent: Let me check your tru identity first.
|
|
59
|
-
→ check_identity(email: "user@example.com")
|
|
60
|
-
✓ Verified
|
|
61
121
|
|
|
62
|
-
|
|
63
|
-
|
|
122
|
+
## Example: End User Flow
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
User: Sign me up for that new service
|
|
126
|
+
|
|
127
|
+
Agent: → check_identity(email: "user@example.com")
|
|
128
|
+
✓ Verified — risk: low, score: 12, debit card, US
|
|
129
|
+
|
|
130
|
+
Agent: → request_user_data(email: "user@example.com", fields: ["name", "email"])
|
|
64
131
|
⏳ Pending — approve on your tru dashboard
|
|
65
132
|
|
|
66
133
|
Agent: → check_request_status(request_id: "req_abc123")
|
|
67
134
|
✓ Approved — got name and email
|
|
68
135
|
|
|
69
|
-
Agent:
|
|
70
|
-
|
|
71
|
-
✓ Auto-approved by your spending rules
|
|
136
|
+
Agent: → create_charge(email: "user@example.com", amount_cents: 999, description: "Monthly plan")
|
|
137
|
+
✓ Auto-approved by spending rules
|
|
72
138
|
```
|
|
73
139
|
|
|
74
140
|
## License
|
package/dist/api-client.d.ts
CHANGED
|
@@ -79,6 +79,7 @@ export interface RegisterAppParams {
|
|
|
79
79
|
website?: string;
|
|
80
80
|
allowed_fields?: string[];
|
|
81
81
|
redirect_uris?: string[];
|
|
82
|
+
provision_url?: string;
|
|
82
83
|
}
|
|
83
84
|
export interface RegisterAppResponse {
|
|
84
85
|
app: {
|
|
@@ -103,5 +104,32 @@ export interface ChargeStatusResponse {
|
|
|
103
104
|
[key: string]: unknown;
|
|
104
105
|
}
|
|
105
106
|
export declare function getChargeStatus(id: string): Promise<ChargeStatusResponse>;
|
|
107
|
+
export interface ConnectOAuthResponse {
|
|
108
|
+
already_connected: boolean;
|
|
109
|
+
app_id: string;
|
|
110
|
+
display_name: string;
|
|
111
|
+
url?: string;
|
|
112
|
+
status?: string;
|
|
113
|
+
charges_enabled?: boolean;
|
|
114
|
+
payouts_enabled?: boolean;
|
|
115
|
+
}
|
|
116
|
+
export declare function getConnectOAuthUrl(serviceName: string): Promise<ConnectOAuthResponse>;
|
|
117
|
+
export interface DiscoverApiResponse {
|
|
118
|
+
endpoints_found: number;
|
|
119
|
+
pages_crawled: number;
|
|
120
|
+
skill_url: string;
|
|
121
|
+
skill_preview: string;
|
|
122
|
+
}
|
|
123
|
+
export declare function discoverApi(serviceName: string): Promise<DiscoverApiResponse>;
|
|
124
|
+
export interface ProvisionResponse {
|
|
125
|
+
credentials: Record<string, unknown>;
|
|
126
|
+
provisioned: boolean;
|
|
127
|
+
}
|
|
128
|
+
export interface AppCredentialsResponse {
|
|
129
|
+
status: "active" | "not_provisioned";
|
|
130
|
+
credentials?: Record<string, unknown>;
|
|
131
|
+
}
|
|
132
|
+
export declare function provisionUser(email: string, serviceName: string): Promise<ProvisionResponse>;
|
|
133
|
+
export declare function getAppCredentials(email: string, serviceName: string): Promise<AppCredentialsResponse>;
|
|
106
134
|
export declare function requestAgentCard(email: string, amountCents: number, description?: string, targetService?: string, currency?: string, action?: string): Promise<AgentCardResponse>;
|
|
107
135
|
export {};
|
package/dist/api-client.js
CHANGED
|
@@ -59,6 +59,56 @@ export async function registerApp(params) {
|
|
|
59
59
|
export async function getChargeStatus(id) {
|
|
60
60
|
return (await request(`/api/billing/charges/${encodeURIComponent(id)}`));
|
|
61
61
|
}
|
|
62
|
+
export async function getConnectOAuthUrl(serviceName) {
|
|
63
|
+
return (await request(`/api/connect/by-service/${encodeURIComponent(serviceName)}/oauth-url`));
|
|
64
|
+
}
|
|
65
|
+
export async function discoverApi(serviceName) {
|
|
66
|
+
const url = `${BASE_URL}/apps/${encodeURIComponent(serviceName)}/discover`;
|
|
67
|
+
const res = await fetch(url, {
|
|
68
|
+
method: "POST",
|
|
69
|
+
headers: {
|
|
70
|
+
"Content-Type": "application/json",
|
|
71
|
+
"X-API-Key": API_KEY,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
if (!res.ok) {
|
|
75
|
+
const body = await res.text();
|
|
76
|
+
throw new Error(`API error ${res.status}: ${body}`);
|
|
77
|
+
}
|
|
78
|
+
// The response is NDJSON — read all lines and extract the final results
|
|
79
|
+
const text = await res.text();
|
|
80
|
+
const lines = text.trim().split("\n");
|
|
81
|
+
let endpointsFound = 0;
|
|
82
|
+
let pagesCrawled = 0;
|
|
83
|
+
let skillContent = "";
|
|
84
|
+
for (const line of lines) {
|
|
85
|
+
try {
|
|
86
|
+
const event = JSON.parse(line);
|
|
87
|
+
if (event.type === "endpoints")
|
|
88
|
+
endpointsFound = event.count;
|
|
89
|
+
if (event.type === "pages")
|
|
90
|
+
pagesCrawled = event.count;
|
|
91
|
+
if (event.type === "skill")
|
|
92
|
+
skillContent = event.content;
|
|
93
|
+
}
|
|
94
|
+
catch { }
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
endpoints_found: endpointsFound,
|
|
98
|
+
pages_crawled: pagesCrawled,
|
|
99
|
+
skill_url: `${BASE_URL}/apps/${encodeURIComponent(serviceName)}/SKILL.md`,
|
|
100
|
+
skill_preview: skillContent.slice(0, 2000),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
export async function provisionUser(email, serviceName) {
|
|
104
|
+
return (await request(`/api/apps/by-service/${encodeURIComponent(serviceName)}/provision`, {
|
|
105
|
+
method: "POST",
|
|
106
|
+
body: JSON.stringify({ email }),
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
export async function getAppCredentials(email, serviceName) {
|
|
110
|
+
return (await request(`/api/apps/by-service/${encodeURIComponent(serviceName)}/credentials/${encodeURIComponent(email)}`));
|
|
111
|
+
}
|
|
62
112
|
export async function requestAgentCard(email, amountCents, description, targetService, currency, action) {
|
|
63
113
|
return (await request("/api/billing/agent-card", {
|
|
64
114
|
method: "POST",
|
package/dist/api-client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,uBAAuB,CAAC;AACpE,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC;AA8B9C,KAAK,UAAU,OAAO,CAAC,IAAY,EAAE,UAAuB,EAAE;IAC5D,MAAM,GAAG,GAAG,GAAG,QAAQ,GAAG,IAAI,EAAE,CAAC;IACjC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAC3B,GAAG,OAAO;QACV,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,WAAW,EAAE,OAAO;YACpB,GAAG,OAAO,CAAC,OAAO;S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AAE;QAC/C,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,KAAK;YACL,YAAY,EAAE,WAAW;YACzB,QAAQ,EAAE,QAAQ,IAAI,KAAK;YAC3B,WAAW;YACX,cAAc,EAAE,aAAa;YAC7B,MAAM;SACP,CAAC;KACH,CAAC,CAAsB,CAAC;AAC3B,CAAC"}
|
package/dist/init.js
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { readFile, writeFile, access } from "node:fs/promises";
|
|
5
|
-
import { join } from "node:path";
|
|
2
|
+
import { readFile, writeFile, access, mkdir } from "node:fs/promises";
|
|
3
|
+
import { join, dirname } from "node:path";
|
|
6
4
|
import { homedir } from "node:os";
|
|
7
5
|
const DEFAULT_URL = "https://tru-by29.onrender.com";
|
|
8
6
|
function detectTargets() {
|
|
9
7
|
const targets = [];
|
|
10
8
|
const cwd = process.cwd();
|
|
11
|
-
// Claude Code — .mcp.json in current directory
|
|
12
|
-
targets.push({
|
|
13
|
-
name: "Claude Code",
|
|
14
|
-
path: join(cwd, ".mcp.json"),
|
|
15
|
-
});
|
|
16
|
-
// Claude Desktop
|
|
17
9
|
const home = homedir();
|
|
18
10
|
const platform = process.platform;
|
|
11
|
+
targets.push({ name: "Claude Code", path: join(cwd, ".mcp.json") });
|
|
19
12
|
if (platform === "darwin") {
|
|
20
13
|
targets.push({
|
|
21
14
|
name: "Claude Desktop",
|
|
@@ -34,119 +27,81 @@ function detectTargets() {
|
|
|
34
27
|
path: join(home, ".config", "Claude", "claude_desktop_config.json"),
|
|
35
28
|
});
|
|
36
29
|
}
|
|
37
|
-
|
|
38
|
-
targets.push({
|
|
39
|
-
name: "Cursor",
|
|
40
|
-
path: join(cwd, ".cursor", "mcp.json"),
|
|
41
|
-
});
|
|
30
|
+
targets.push({ name: "Cursor", path: join(cwd, ".cursor", "mcp.json") });
|
|
42
31
|
return targets;
|
|
43
32
|
}
|
|
44
|
-
async function fileExists(
|
|
33
|
+
async function fileExists(p) {
|
|
45
34
|
try {
|
|
46
|
-
await access(
|
|
35
|
+
await access(p);
|
|
47
36
|
return true;
|
|
48
37
|
}
|
|
49
38
|
catch {
|
|
50
39
|
return false;
|
|
51
40
|
}
|
|
52
41
|
}
|
|
53
|
-
async function readJsonFile(
|
|
42
|
+
async function readJsonFile(p) {
|
|
54
43
|
try {
|
|
55
|
-
const raw = await readFile(
|
|
44
|
+
const raw = await readFile(p, "utf-8");
|
|
56
45
|
return JSON.parse(raw);
|
|
57
46
|
}
|
|
58
47
|
catch {
|
|
59
48
|
return {};
|
|
60
49
|
}
|
|
61
50
|
}
|
|
62
|
-
function
|
|
63
|
-
|
|
51
|
+
function buildEntry(apiKey) {
|
|
52
|
+
const entry = {
|
|
64
53
|
command: "npx",
|
|
65
54
|
args: ["-y", "tru-mcp"],
|
|
66
|
-
env: {
|
|
67
|
-
TRU_API_URL: apiUrl,
|
|
68
|
-
TRU_API_KEY: apiKey,
|
|
69
|
-
},
|
|
70
55
|
};
|
|
56
|
+
if (apiKey) {
|
|
57
|
+
entry.env = { TRU_API_URL: DEFAULT_URL, TRU_API_KEY: apiKey };
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
entry.env = { TRU_API_URL: DEFAULT_URL };
|
|
61
|
+
}
|
|
62
|
+
return entry;
|
|
71
63
|
}
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
rl.close();
|
|
81
|
-
process.exit(1);
|
|
64
|
+
function parseArgs() {
|
|
65
|
+
const args = process.argv.slice(2).filter((a) => a !== "init");
|
|
66
|
+
let key;
|
|
67
|
+
for (let i = 0; i < args.length; i++) {
|
|
68
|
+
if (args[i] === "--key" && args[i + 1]) {
|
|
69
|
+
key = args[i + 1];
|
|
70
|
+
i++;
|
|
71
|
+
}
|
|
82
72
|
}
|
|
83
|
-
|
|
73
|
+
return { key };
|
|
74
|
+
}
|
|
75
|
+
async function main() {
|
|
76
|
+
const { key } = parseArgs();
|
|
77
|
+
console.log("\n tru MCP — setting up...\n");
|
|
84
78
|
const targets = detectTargets();
|
|
85
|
-
const
|
|
86
|
-
const
|
|
79
|
+
const written = [];
|
|
80
|
+
const entry = buildEntry(key);
|
|
87
81
|
for (const t of targets) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
82
|
+
// Write to existing config files, or create .mcp.json for Claude Code
|
|
83
|
+
const exists = await fileExists(t.path);
|
|
84
|
+
if (!exists && t.name !== "Claude Code")
|
|
85
|
+
continue;
|
|
86
|
+
// Ensure parent dir exists
|
|
87
|
+
await mkdir(dirname(t.path), { recursive: true });
|
|
88
|
+
const config = exists ? await readJsonFile(t.path) : {};
|
|
89
|
+
if (!config.mcpServers)
|
|
90
|
+
config.mcpServers = {};
|
|
91
|
+
config.mcpServers.tru = entry;
|
|
92
|
+
await writeFile(t.path, JSON.stringify(config, null, 2) + "\n");
|
|
93
|
+
written.push(t.name);
|
|
98
94
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
console.log("\n No MCP client config files detected. Add this to your config:\n");
|
|
103
|
-
printManualConfig(apiUrl, apiKey);
|
|
104
|
-
rl.close();
|
|
95
|
+
if (written.length === 0) {
|
|
96
|
+
console.log(" No MCP client detected. Add this to your config:\n");
|
|
97
|
+
console.log(JSON.stringify({ mcpServers: { tru: entry } }, null, 2) + "\n");
|
|
105
98
|
return;
|
|
106
99
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
available.forEach((t, i) => {
|
|
110
|
-
const tag = existing.includes(t) ? "(existing)" : "(will create)";
|
|
111
|
-
console.log(` ${i + 1}. ${t.name} ${tag} — ${t.path}`);
|
|
112
|
-
});
|
|
113
|
-
const choice = (await rl.question(`\n Configure which? [1-${available.length}, or "all"]: `)).trim();
|
|
114
|
-
let selected;
|
|
115
|
-
if (choice.toLowerCase() === "all") {
|
|
116
|
-
selected = available;
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
const idx = parseInt(choice, 10) - 1;
|
|
120
|
-
if (isNaN(idx) || idx < 0 || idx >= available.length) {
|
|
121
|
-
console.log("\n Invalid choice. Here's the manual config instead:\n");
|
|
122
|
-
printManualConfig(apiUrl, apiKey);
|
|
123
|
-
rl.close();
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
selected = [available[idx]];
|
|
127
|
-
}
|
|
128
|
-
// Write configs
|
|
129
|
-
const entry = buildTruEntry(apiUrl, apiKey);
|
|
130
|
-
for (const target of selected) {
|
|
131
|
-
const config = await readJsonFile(target.path);
|
|
132
|
-
if (!config.mcpServers) {
|
|
133
|
-
config.mcpServers = {};
|
|
134
|
-
}
|
|
135
|
-
config.mcpServers.tru = entry;
|
|
136
|
-
await writeFile(target.path, JSON.stringify(config, null, 2) + "\n");
|
|
137
|
-
console.log(` ✓ Updated ${target.name} — ${target.path}`);
|
|
100
|
+
for (const name of written) {
|
|
101
|
+
console.log(` ✓ ${name}`);
|
|
138
102
|
}
|
|
139
|
-
console.log("\n Done
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
function printManualConfig(apiUrl, apiKey) {
|
|
143
|
-
const snippet = {
|
|
144
|
-
mcpServers: {
|
|
145
|
-
tru: buildTruEntry(apiUrl, apiKey),
|
|
146
|
-
},
|
|
147
|
-
};
|
|
148
|
-
console.log(JSON.stringify(snippet, null, 2));
|
|
149
|
-
console.log();
|
|
103
|
+
console.log("\n Done. Restart your MCP client, then tell your agent:\n");
|
|
104
|
+
console.log(' "Run get_started to set up tru"\n');
|
|
150
105
|
}
|
|
151
106
|
main().catch((err) => {
|
|
152
107
|
console.error("Error:", err);
|
package/dist/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,WAAW,GAAG,+BAA+B,CAAC;AAkBpD,SAAS,aAAa;IACpB,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAElC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;IAEpE,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC1B,OAAO,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,IAAI,CACR,IAAI,EACJ,SAAS,EACT,qBAAqB,EACrB,QAAQ,EACR,4BAA4B,CAC7B;SACF,CAAC,CAAC;IACL,CAAC;SAAM,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QAChC,OAAO,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,IAAI,CACR,IAAI,EACJ,SAAS,EACT,SAAS,EACT,QAAQ,EACR,4BAA4B,CAC7B;SACF,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,IAAI,CAAC;YACX,IAAI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,GAAG,EAAE,CAAC;QAC/C,MAAM,CAAC,UAAU,CAAC,GAAG,GAAG,KAAK,CAAC;QAC9B,MAAM,SAAS,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;QAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,sDAAsD,CAAC,CAAC;QACpE,OAAO,CAAC,GAAG,CACT,IAAI,CAAC,SAAS,CAAC,EAAE,UAAU,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAC/D,CAAC;QACF,OAAO;IACT,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,4DAA4D,CAAC,CAAC;IAC1E,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;AACvD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAC7B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
3
|
import { checkIdentityTool } from "./tools/check_identity.js";
|
|
4
|
-
import {
|
|
4
|
+
import { requestUserDataTool } from "./tools/request_user_data.js";
|
|
5
5
|
import { checkRequestStatusTool } from "./tools/check_request_status.js";
|
|
6
6
|
import { requestVirtualCardTool } from "./tools/request_virtual_card.js";
|
|
7
7
|
import { discoverAppsTool } from "./tools/discover_apps.js";
|
|
@@ -10,13 +10,17 @@ import { createChargeTool } from "./tools/create_charge.js";
|
|
|
10
10
|
import { checkChargeStatusTool } from "./tools/check_charge_status.js";
|
|
11
11
|
import { registerAppTool } from "./tools/register_app.js";
|
|
12
12
|
import { initiateOAuthTool } from "./tools/initiate_oauth.js";
|
|
13
|
+
import { connectStripeTool } from "./tools/connect_stripe.js";
|
|
14
|
+
import { getStartedTool } from "./tools/get_started.js";
|
|
15
|
+
import { discoverApiTool } from "./tools/discover_api.js";
|
|
16
|
+
import { provisionUserTool } from "./tools/provision_user.js";
|
|
13
17
|
const server = new McpServer({
|
|
14
18
|
name: "tru-identity",
|
|
15
19
|
version: "0.1.0",
|
|
16
20
|
});
|
|
17
21
|
// Register tools
|
|
18
22
|
server.tool(checkIdentityTool.name, checkIdentityTool.description, checkIdentityTool.inputSchema, checkIdentityTool.handler);
|
|
19
|
-
server.tool(
|
|
23
|
+
server.tool(requestUserDataTool.name, requestUserDataTool.description, requestUserDataTool.inputSchema, requestUserDataTool.handler);
|
|
20
24
|
server.tool(checkRequestStatusTool.name, checkRequestStatusTool.description, checkRequestStatusTool.inputSchema, checkRequestStatusTool.handler);
|
|
21
25
|
server.tool(requestVirtualCardTool.name, requestVirtualCardTool.description, requestVirtualCardTool.inputSchema, requestVirtualCardTool.handler);
|
|
22
26
|
server.tool(discoverAppsTool.name, discoverAppsTool.description, discoverAppsTool.inputSchema, discoverAppsTool.handler);
|
|
@@ -25,6 +29,10 @@ server.tool(createChargeTool.name, createChargeTool.description, createChargeToo
|
|
|
25
29
|
server.tool(checkChargeStatusTool.name, checkChargeStatusTool.description, checkChargeStatusTool.inputSchema, checkChargeStatusTool.handler);
|
|
26
30
|
server.tool(registerAppTool.name, registerAppTool.description, registerAppTool.inputSchema, registerAppTool.handler);
|
|
27
31
|
server.tool(initiateOAuthTool.name, initiateOAuthTool.description, initiateOAuthTool.inputSchema, initiateOAuthTool.handler);
|
|
32
|
+
server.tool(connectStripeTool.name, connectStripeTool.description, connectStripeTool.inputSchema, connectStripeTool.handler);
|
|
33
|
+
server.tool(getStartedTool.name, getStartedTool.description, getStartedTool.inputSchema, getStartedTool.handler);
|
|
34
|
+
server.tool(discoverApiTool.name, discoverApiTool.description, discoverApiTool.inputSchema, discoverApiTool.handler);
|
|
35
|
+
server.tool(provisionUserTool.name, provisionUserTool.description, provisionUserTool.inputSchema, provisionUserTool.handler);
|
|
28
36
|
export async function run() {
|
|
29
37
|
const transport = new StdioServerTransport();
|
|
30
38
|
await server.connect(transport);
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE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WAAW,EAC7B,iBAAiB,CAAC,WAAW,EAC7B,iBAAiB,CAAC,OAAO,CAC1B,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,GAAG;IACvB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const connectStripeTool: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
service_name: z.ZodString;
|
|
7
|
+
};
|
|
8
|
+
handler: (args: {
|
|
9
|
+
service_name: string;
|
|
10
|
+
}) => Promise<{
|
|
11
|
+
content: {
|
|
12
|
+
type: "text";
|
|
13
|
+
text: string;
|
|
14
|
+
}[];
|
|
15
|
+
isError?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
content: {
|
|
18
|
+
type: "text";
|
|
19
|
+
text: string;
|
|
20
|
+
}[];
|
|
21
|
+
isError: boolean;
|
|
22
|
+
}>;
|
|
23
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { getConnectOAuthUrl } from "../api-client.js";
|
|
3
|
+
export const connectStripeTool = {
|
|
4
|
+
name: "connect_stripe",
|
|
5
|
+
description: "Generate a Stripe Connect OAuth URL for an app developer to link their existing Stripe account to tru. " +
|
|
6
|
+
"Once connected, charges approved by tru users are routed directly to the developer's Stripe account via destination charges. " +
|
|
7
|
+
"The developer keeps full access to their Stripe dashboard, refunds, disputes, Radar, and all Stripe features. " +
|
|
8
|
+
"Nothing about their existing Stripe setup changes — tru simply becomes another source of payments flowing into their account.",
|
|
9
|
+
inputSchema: {
|
|
10
|
+
service_name: z
|
|
11
|
+
.string()
|
|
12
|
+
.describe("The service_name of the app to connect to Stripe"),
|
|
13
|
+
},
|
|
14
|
+
handler: async (args) => {
|
|
15
|
+
try {
|
|
16
|
+
const result = await getConnectOAuthUrl(args.service_name);
|
|
17
|
+
if (result.already_connected) {
|
|
18
|
+
const lines = [
|
|
19
|
+
`## ${result.display_name} — Stripe Already Connected`,
|
|
20
|
+
"",
|
|
21
|
+
`This app's Stripe account is already linked to tru.`,
|
|
22
|
+
"",
|
|
23
|
+
`- **Status:** ${result.status}`,
|
|
24
|
+
`- **Charges enabled:** ${result.charges_enabled ? "Yes" : "No"}`,
|
|
25
|
+
`- **Payouts enabled:** ${result.payouts_enabled ? "Yes" : "No"}`,
|
|
26
|
+
"",
|
|
27
|
+
"Charges approved by tru users will be routed to this Stripe account automatically.",
|
|
28
|
+
];
|
|
29
|
+
return {
|
|
30
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const lines = [
|
|
34
|
+
`## Connect Stripe to ${result.display_name}`,
|
|
35
|
+
"",
|
|
36
|
+
"Open this URL in your browser to link your Stripe account:",
|
|
37
|
+
"",
|
|
38
|
+
result.url,
|
|
39
|
+
"",
|
|
40
|
+
"### What happens when you click this link:",
|
|
41
|
+
"",
|
|
42
|
+
"1. You'll be taken to Stripe and asked to authorize the connection",
|
|
43
|
+
"2. **Log in with your existing Stripe account** — no new account needed",
|
|
44
|
+
"3. Stripe redirects you back to tru, and the connection is saved",
|
|
45
|
+
"",
|
|
46
|
+
"### What this means for your business:",
|
|
47
|
+
"",
|
|
48
|
+
"- **Payments flow to your existing Stripe account** — same dashboard, same bank, same payouts",
|
|
49
|
+
"- **You keep full Stripe access** — refunds, disputes, Radar, reporting, webhooks, everything",
|
|
50
|
+
"- **Nothing changes about your current setup** — tru is just another source of payments",
|
|
51
|
+
"- **You can still charge customers directly** outside of tru at the same time",
|
|
52
|
+
"- tru uses Stripe's destination charge model, so your Stripe account retains full ownership",
|
|
53
|
+
"",
|
|
54
|
+
"Once connected, any charges approved by tru users will be routed directly to your Stripe account.",
|
|
55
|
+
];
|
|
56
|
+
return {
|
|
57
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
62
|
+
return {
|
|
63
|
+
content: [
|
|
64
|
+
{
|
|
65
|
+
type: "text",
|
|
66
|
+
text: `Error generating Stripe Connect URL: ${message}`,
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
isError: true,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=connect_stripe.js.map
|