tru-mcp 0.4.0 → 0.5.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/dist/api-client.d.ts +1 -0
- package/dist/api-client.js +7 -0
- package/dist/api-client.js.map +1 -1
- package/dist/config.d.ts +7 -0
- package/dist/config.js +13 -0
- package/dist/config.js.map +1 -1
- package/dist/server.js +152 -0
- package/dist/server.js.map +1 -1
- package/dist/tools/authenticate.js +15 -23
- package/dist/tools/authenticate.js.map +1 -1
- package/dist/tools/connect_stripe.d.ts +4 -4
- package/dist/tools/connect_stripe.js +56 -30
- package/dist/tools/connect_stripe.js.map +1 -1
- package/dist/tools/discover_api.d.ts +6 -4
- package/dist/tools/discover_api.js +42 -13
- package/dist/tools/discover_api.js.map +1 -1
- package/dist/tools/get_started.js +90 -183
- package/dist/tools/get_started.js.map +1 -1
- package/dist/tools/initiate_oauth.js +1 -4
- package/dist/tools/initiate_oauth.js.map +1 -1
- package/dist/tools/register_app.js +13 -3
- package/dist/tools/register_app.js.map +1 -1
- package/package.json +1 -1
package/dist/api-client.d.ts
CHANGED
|
@@ -114,6 +114,7 @@ export interface ConnectOAuthResponse {
|
|
|
114
114
|
payouts_enabled?: boolean;
|
|
115
115
|
}
|
|
116
116
|
export declare function getConnectOAuthUrl(serviceName: string): Promise<ConnectOAuthResponse>;
|
|
117
|
+
export declare function updateAppWebsite(appId: string, website: string): Promise<void>;
|
|
117
118
|
export interface DiscoverApiResponse {
|
|
118
119
|
endpoints_found: number;
|
|
119
120
|
pages_crawled: number;
|
package/dist/api-client.js
CHANGED
|
@@ -67,6 +67,13 @@ export async function getChargeStatus(id) {
|
|
|
67
67
|
export async function getConnectOAuthUrl(serviceName) {
|
|
68
68
|
return (await request(`/api/connect/by-service/${encodeURIComponent(serviceName)}/oauth-url`));
|
|
69
69
|
}
|
|
70
|
+
// ─── App Update ─────────────────────────────────────────────────
|
|
71
|
+
export async function updateAppWebsite(appId, website) {
|
|
72
|
+
await request(`/api/apps/${encodeURIComponent(appId)}`, {
|
|
73
|
+
method: "PUT",
|
|
74
|
+
body: JSON.stringify({ website }),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
70
77
|
export async function discoverApi(serviceName) {
|
|
71
78
|
const url = `${BASE_URL}/apps/${encodeURIComponent(serviceName)}/discover`;
|
|
72
79
|
const res = await fetch(url, {
|
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;AAEpE,oEAAoE;AACpE,SAAS,SAAS;IAChB,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC;AACvC,CAAC;AA8BD,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,SAAS,EAAE;YACxB,GAAG,OAAO,CAAC,OAAO;SACnB;KACF,CAAC,CAAC;IAEH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,aAAa,GAAG,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAa;IAC/C,OAAO,CAAC,MAAM,OAAO,CAAC,0BAA0B,kBAAkB,CAAC,KAAK,CAAC,EA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AAC;AAClG,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,KAAa;IAC5C,MAAM,GAAG,GAAG,GAAG,QAAQ,cAAc,CAAC;IACtC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAC3B,OAAO,EAAE;YACP,eAAe,EAAE,UAAU,KAAK,EAAE;SACnC;KACF,CAAC,CAAC;IACH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,6BAA6B,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,MAA8C,EAC9C,KAAa;IAEb,MAAM,GAAG,GAAG,GAAG,QAAQ,WAAW,CAAC;IACnC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAC3B,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,eAAe,EAAE,UAAU,KAAK,EAAE;SACnC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;KAC7B,CAAC,CAAC;IACH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,aAAa,GAAG,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -5,6 +5,13 @@ export declare function getStoredAuth(): {
|
|
|
5
5
|
email: string;
|
|
6
6
|
} | null;
|
|
7
7
|
export declare function saveAuth(token: string, email: string): void;
|
|
8
|
+
export interface StoredApp {
|
|
9
|
+
id: string;
|
|
10
|
+
service_name: string;
|
|
11
|
+
display_name: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function getStoredApp(): StoredApp | null;
|
|
14
|
+
export declare function saveApp(app: StoredApp): void;
|
|
8
15
|
export declare function setClientName(name: string): void;
|
|
9
16
|
export declare function getSourceLabel(): string | null;
|
|
10
17
|
export declare function saveSourceLabel(label: string): void;
|
package/dist/config.js
CHANGED
|
@@ -31,6 +31,19 @@ export function saveAuth(token, email) {
|
|
|
31
31
|
config.auth = { token, email };
|
|
32
32
|
writeConfig(config);
|
|
33
33
|
}
|
|
34
|
+
export function getStoredApp() {
|
|
35
|
+
const config = readConfig();
|
|
36
|
+
const app = config.app;
|
|
37
|
+
if (app?.id && app?.service_name) {
|
|
38
|
+
return app;
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
export function saveApp(app) {
|
|
43
|
+
const config = readConfig();
|
|
44
|
+
config.app = app;
|
|
45
|
+
writeConfig(config);
|
|
46
|
+
}
|
|
34
47
|
// ─── Source label helpers ────────────────────────────────────────
|
|
35
48
|
function getComputerName() {
|
|
36
49
|
try {
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;AAEnE,MAAM,UAAU,UAAU;IACxB,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;IAC3D,CAAC;IAAC,MAAM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
|
38
38
|
server.tool(getStartedTool.name, getStartedTool.description, getStartedTool.inputSchema, getStartedTool.handler);
|
|
39
39
|
server.tool(discoverApiTool.name, discoverApiTool.description, discoverApiTool.inputSchema, discoverApiTool.handler);
|
|
40
40
|
server.tool(provisionUserTool.name, provisionUserTool.description, provisionUserTool.inputSchema, provisionUserTool.handler);
|
|
41
|
+
// ─── Prompts (show up as /tru:prompt-name in Claude Code) ──────
|
|
42
|
+
const BASE_URL = process.env.TRU_API_URL || "http://localhost:3000";
|
|
43
|
+
server.prompt("get-started", "Full walkthrough for integrating tru into your app — auth, billing, identity verification, and agent discoverability", async () => {
|
|
44
|
+
let guide;
|
|
45
|
+
try {
|
|
46
|
+
const res = await fetch(`${BASE_URL}/agent.md`);
|
|
47
|
+
guide = await res.text();
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
guide =
|
|
51
|
+
"Could not fetch agent guide. Visit the tru dashboard for documentation.";
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
messages: [
|
|
55
|
+
{
|
|
56
|
+
role: "user",
|
|
57
|
+
content: {
|
|
58
|
+
type: "text",
|
|
59
|
+
text: `Follow this guide to integrate tru into the current project. Explore the codebase first to understand the stack, then apply each step.\n\n${guide}`,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
server.prompt("add-login", "Add 'Login with tru' OAuth to your app — redirect-based auth with popup flow", async () => ({
|
|
66
|
+
messages: [
|
|
67
|
+
{
|
|
68
|
+
role: "user",
|
|
69
|
+
content: {
|
|
70
|
+
type: "text",
|
|
71
|
+
text: `You are adding "Login with tru" to this project. tru uses OAuth 2.0 with a simplified flow — redirect_uri is configured server-side, never passed in URLs.
|
|
72
|
+
|
|
73
|
+
## Steps
|
|
74
|
+
|
|
75
|
+
1. **Register the app on tru** (if not already done)
|
|
76
|
+
- Use the register_app tool or visit the tru dashboard
|
|
77
|
+
- Set redirect_uris to your OAuth callback URL (e.g. /api/auth/callback/tru)
|
|
78
|
+
|
|
79
|
+
2. **Add environment variables**
|
|
80
|
+
- TRU_API_URL — the tru instance URL
|
|
81
|
+
- TRU_CLIENT_ID — your app's ID from tru
|
|
82
|
+
- TRU_CLIENT_SECRET — your API key (same as TRU_API_KEY)
|
|
83
|
+
|
|
84
|
+
3. **Add a login button** that opens tru's authorize endpoint:
|
|
85
|
+
\`\`\`javascript
|
|
86
|
+
const url = new URL(\`\${TRU_URL}/api/oauth/authorize\`);
|
|
87
|
+
url.searchParams.set('client_id', TRU_CLIENT_ID);
|
|
88
|
+
url.searchParams.set('state', crypto.randomUUID());
|
|
89
|
+
window.open(url, 'tru-login', 'width=480,height=640');
|
|
90
|
+
\`\`\`
|
|
91
|
+
Note: redirect_uri is NOT passed in the URL — it's configured in your app settings on tru.
|
|
92
|
+
|
|
93
|
+
4. **Add a callback route** (e.g. /api/auth/callback/tru):
|
|
94
|
+
- Receives ?code=AUTH_CODE&state=STATE
|
|
95
|
+
- Exchanges code for user info:
|
|
96
|
+
POST {TRU_URL}/api/oauth/token
|
|
97
|
+
Body: { "code": "...", "client_id": "...", "client_secret": "..." }
|
|
98
|
+
Response: { "user": { "id": "...", "email": "...", "name": "..." } }
|
|
99
|
+
- Creates/finds local user, sets session, closes popup
|
|
100
|
+
|
|
101
|
+
5. **Add agent auth (403 response)** for bot detection:
|
|
102
|
+
Return a 403 with signup_url pointing to tru's authorize endpoint
|
|
103
|
+
|
|
104
|
+
Explore the codebase to understand the existing auth setup, then implement these steps.`,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
}));
|
|
109
|
+
server.prompt("add-billing", "Add tru billing to your app — one-time charges and subscriptions via Stripe Connect", async () => ({
|
|
110
|
+
messages: [
|
|
111
|
+
{
|
|
112
|
+
role: "user",
|
|
113
|
+
content: {
|
|
114
|
+
type: "text",
|
|
115
|
+
text: `You are adding tru billing to this project. tru handles payments via Stripe Connect — money goes to the developer's Stripe account.
|
|
116
|
+
|
|
117
|
+
## Prerequisites
|
|
118
|
+
- App must be registered on tru (use register_app tool)
|
|
119
|
+
- Stripe must be connected (use connect_stripe tool)
|
|
120
|
+
|
|
121
|
+
## Creating charges
|
|
122
|
+
|
|
123
|
+
POST {TRU_URL}/api/billing/charges
|
|
124
|
+
Headers: X-API-Key: {api_key}, Content-Type: application/json
|
|
125
|
+
Body: {
|
|
126
|
+
"email": "user@example.com",
|
|
127
|
+
"amount_cents": 2999,
|
|
128
|
+
"description": "Pro Plan",
|
|
129
|
+
"type": "one_time"
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
For subscriptions: "type": "recurring", "interval": "month"
|
|
133
|
+
|
|
134
|
+
## Checking charge status
|
|
135
|
+
|
|
136
|
+
GET {TRU_URL}/api/billing/charges/{id}
|
|
137
|
+
Headers: X-API-Key: {api_key}
|
|
138
|
+
|
|
139
|
+
Returns: pending → approved → completed (or rejected/cancelled)
|
|
140
|
+
|
|
141
|
+
## User experience
|
|
142
|
+
Users approve charges on their tru wallet dashboard. They can set auto-approve rules (e.g. "auto-approve charges under $10 from this app").
|
|
143
|
+
|
|
144
|
+
Explore the codebase to find where billing should be integrated, then implement.`,
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
}));
|
|
149
|
+
server.prompt("check-user", "Add tru identity verification — check if a user is verified and access risk signals", async () => ({
|
|
150
|
+
messages: [
|
|
151
|
+
{
|
|
152
|
+
role: "user",
|
|
153
|
+
content: {
|
|
154
|
+
type: "text",
|
|
155
|
+
text: `You are adding tru identity verification to this project. tru lets you check if a user is verified and access their risk signals — no user action needed.
|
|
156
|
+
|
|
157
|
+
## Check identity (free, instant)
|
|
158
|
+
|
|
159
|
+
GET {TRU_URL}/api/credentials/check/{email}
|
|
160
|
+
Headers: X-API-Key: {api_key}
|
|
161
|
+
|
|
162
|
+
Response: {
|
|
163
|
+
"verified": true,
|
|
164
|
+
"name": "Jane Doe",
|
|
165
|
+
"risk": {
|
|
166
|
+
"level": "low",
|
|
167
|
+
"score": 12,
|
|
168
|
+
"card_funding": "debit",
|
|
169
|
+
"card_country": "US",
|
|
170
|
+
"fingerprint_reuse": false
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
## Request credentials (user approval required)
|
|
175
|
+
|
|
176
|
+
POST {TRU_URL}/api/credentials
|
|
177
|
+
Headers: X-API-Key: {api_key}
|
|
178
|
+
Body: { "email": "user@example.com", "fields": ["name", "email", "phone"] }
|
|
179
|
+
|
|
180
|
+
Then poll GET /api/credentials/{id} until status is "approved" or "rejected".
|
|
181
|
+
|
|
182
|
+
## Use cases
|
|
183
|
+
- Gate features by risk level
|
|
184
|
+
- Set trial length based on risk score
|
|
185
|
+
- Block duplicate signups via fingerprint_reuse
|
|
186
|
+
- Verify identity before high-value actions
|
|
187
|
+
|
|
188
|
+
Explore the codebase to find where identity checks should be added, then implement.`,
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
}));
|
|
41
193
|
export async function run() {
|
|
42
194
|
const transport = new StdioServerTransport();
|
|
43
195
|
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,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,MAAM,uBA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redAuth, saveAuth } from "../config.js";
|
|
2
3
|
import { createMcpSession, pollMcpSession, verifyAuth } from "../api-client.js";
|
|
3
4
|
function sleep(ms) {
|
|
4
5
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
5
6
|
}
|
|
7
|
+
function openBrowser(url) {
|
|
8
|
+
const platform = process.platform;
|
|
9
|
+
const cmd = platform === "darwin" ? "open" :
|
|
10
|
+
platform === "win32" ? "start" :
|
|
11
|
+
"xdg-open";
|
|
12
|
+
exec(`${cmd} "${url}"`);
|
|
13
|
+
}
|
|
6
14
|
export const authenticateTool = {
|
|
7
15
|
name: "authenticate",
|
|
8
|
-
description: "
|
|
9
|
-
"Opens a
|
|
16
|
+
description: "Authenticate with tru via the browser. " +
|
|
17
|
+
"Opens a browser window where you verify your identity, then waits until authentication is complete. " +
|
|
10
18
|
"Credentials are stored locally for future sessions.",
|
|
11
19
|
inputSchema: {},
|
|
12
20
|
handler: async (_args) => {
|
|
@@ -31,18 +39,11 @@ export const authenticateTool = {
|
|
|
31
39
|
}
|
|
32
40
|
// Create a new MCP session
|
|
33
41
|
const session = await createMcpSession();
|
|
42
|
+
// Auto-open the browser
|
|
43
|
+
openBrowser(session.login_url);
|
|
34
44
|
// Poll for completion (every 2s, up to 5 min)
|
|
35
|
-
const maxAttempts = 150;
|
|
45
|
+
const maxAttempts = 150;
|
|
36
46
|
let attempts = 0;
|
|
37
|
-
// Return the URL immediately with polling
|
|
38
|
-
const lines = [
|
|
39
|
-
`Open this URL in your browser to authenticate:`,
|
|
40
|
-
``,
|
|
41
|
-
`${session.login_url}`,
|
|
42
|
-
``,
|
|
43
|
-
`Waiting for authentication...`,
|
|
44
|
-
];
|
|
45
|
-
// We need to poll synchronously within the handler
|
|
46
47
|
while (attempts < maxAttempts) {
|
|
47
48
|
await sleep(2000);
|
|
48
49
|
attempts++;
|
|
@@ -54,12 +55,7 @@ export const authenticateTool = {
|
|
|
54
55
|
content: [
|
|
55
56
|
{
|
|
56
57
|
type: "text",
|
|
57
|
-
text:
|
|
58
|
-
...lines,
|
|
59
|
-
``,
|
|
60
|
-
`Authenticated successfully as ${status.user.email}.`,
|
|
61
|
-
`Credentials saved locally. You can now register apps.`,
|
|
62
|
-
].join("\n"),
|
|
58
|
+
text: `Authenticated successfully as ${status.user.email}. Credentials saved locally.`,
|
|
63
59
|
},
|
|
64
60
|
],
|
|
65
61
|
};
|
|
@@ -73,11 +69,7 @@ export const authenticateTool = {
|
|
|
73
69
|
content: [
|
|
74
70
|
{
|
|
75
71
|
type: "text",
|
|
76
|
-
text:
|
|
77
|
-
...lines,
|
|
78
|
-
``,
|
|
79
|
-
`Authentication timed out after 5 minutes. Please try again.`,
|
|
80
|
-
].join("\n"),
|
|
72
|
+
text: `Authentication timed out. If the browser didn't open, go to: ${session.login_url}`,
|
|
81
73
|
},
|
|
82
74
|
],
|
|
83
75
|
isError: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.js","sourceRoot":"","sources":["../../src/tools/authenticate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEhF,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,cAAc;IACpB,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"authenticate.js","sourceRoot":"","sources":["../../src/tools/authenticate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,gBAAgB,E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ACF,CAAC"}
|
|
@@ -3,21 +3,21 @@ export declare const connectStripeTool: {
|
|
|
3
3
|
name: string;
|
|
4
4
|
description: string;
|
|
5
5
|
inputSchema: {
|
|
6
|
-
service_name: z.ZodString
|
|
6
|
+
service_name: z.ZodOptional<z.ZodString>;
|
|
7
7
|
};
|
|
8
8
|
handler: (args: {
|
|
9
|
-
service_name
|
|
9
|
+
service_name?: string;
|
|
10
10
|
}) => Promise<{
|
|
11
11
|
content: {
|
|
12
12
|
type: "text";
|
|
13
13
|
text: string;
|
|
14
14
|
}[];
|
|
15
|
-
isError
|
|
15
|
+
isError: boolean;
|
|
16
16
|
} | {
|
|
17
17
|
content: {
|
|
18
18
|
type: "text";
|
|
19
19
|
text: string;
|
|
20
20
|
}[];
|
|
21
|
-
isError
|
|
21
|
+
isError?: undefined;
|
|
22
22
|
}>;
|
|
23
23
|
};
|
|
@@ -1,19 +1,36 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { exec } from "child_process";
|
|
2
3
|
import { getConnectOAuthUrl } from "../api-client.js";
|
|
4
|
+
import { getStoredApp } from "../config.js";
|
|
5
|
+
function openBrowser(url) {
|
|
6
|
+
const platform = process.platform;
|
|
7
|
+
const cmd = platform === "darwin" ? "open" :
|
|
8
|
+
platform === "win32" ? "start" :
|
|
9
|
+
"xdg-open";
|
|
10
|
+
exec(`${cmd} "${url}"`);
|
|
11
|
+
}
|
|
3
12
|
export const connectStripeTool = {
|
|
4
13
|
name: "connect_stripe",
|
|
5
|
-
description: "
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"Nothing about their existing Stripe setup changes — tru simply becomes another source of payments
|
|
14
|
+
description: "Connect a developer's Stripe account to their tru app. Works with the app's API key — no admin key needed. " +
|
|
15
|
+
"Opens a browser window for the developer to authorize via Stripe Connect OAuth. " +
|
|
16
|
+
"Once connected, charges approved by tru users are routed directly to the developer's Stripe account. " +
|
|
17
|
+
"Nothing about their existing Stripe setup changes — tru simply becomes another source of payments.",
|
|
9
18
|
inputSchema: {
|
|
10
19
|
service_name: z
|
|
11
20
|
.string()
|
|
12
|
-
.
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("The service_name of the app to connect. If omitted, uses the app from ~/.tru/config.json (set by register_app)."),
|
|
13
23
|
},
|
|
14
24
|
handler: async (args) => {
|
|
15
25
|
try {
|
|
16
|
-
const
|
|
26
|
+
const serviceName = args.service_name || getStoredApp()?.service_name;
|
|
27
|
+
if (!serviceName) {
|
|
28
|
+
return {
|
|
29
|
+
content: [{ type: "text", text: "No service_name provided and no app found in ~/.tru/config.json. Run register_app first." }],
|
|
30
|
+
isError: true,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const result = await getConnectOAuthUrl(serviceName);
|
|
17
34
|
if (result.already_connected) {
|
|
18
35
|
const lines = [
|
|
19
36
|
`## ${result.display_name} — Stripe Already Connected`,
|
|
@@ -30,31 +47,40 @@ export const connectStripeTool = {
|
|
|
30
47
|
content: [{ type: "text", text: lines.join("\n") }],
|
|
31
48
|
};
|
|
32
49
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
openBrowser(result.url);
|
|
51
|
+
// Poll until Stripe Connect OAuth completes (up to 5 minutes)
|
|
52
|
+
const POLL_INTERVAL = 3000;
|
|
53
|
+
const TIMEOUT = 5 * 60 * 1000;
|
|
54
|
+
const start = Date.now();
|
|
55
|
+
while (Date.now() - start < TIMEOUT) {
|
|
56
|
+
await new Promise((r) => setTimeout(r, POLL_INTERVAL));
|
|
57
|
+
try {
|
|
58
|
+
const check = await getConnectOAuthUrl(serviceName);
|
|
59
|
+
if (check.already_connected) {
|
|
60
|
+
const lines = [
|
|
61
|
+
`Stripe connected to ${check.display_name}.`,
|
|
62
|
+
``,
|
|
63
|
+
`- **Status:** ${check.status}`,
|
|
64
|
+
`- **Charges enabled:** ${check.charges_enabled ? "Yes" : "No"}`,
|
|
65
|
+
`- **Payouts enabled:** ${check.payouts_enabled ? "Yes" : "No"}`,
|
|
66
|
+
``,
|
|
67
|
+
`Charges approved by tru users will be routed to your Stripe account automatically.`,
|
|
68
|
+
];
|
|
69
|
+
return {
|
|
70
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// Ignore transient errors, keep polling
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// Timeout — give manual instructions
|
|
56
79
|
return {
|
|
57
|
-
content: [{
|
|
80
|
+
content: [{
|
|
81
|
+
type: "text",
|
|
82
|
+
text: `A browser window was opened to connect Stripe to ${result.display_name}, but authorization wasn't completed within 5 minutes.\n\nTo try again: ${result.url}\n\nOr run connect_stripe again after completing the Stripe authorization.`,
|
|
83
|
+
}],
|
|
58
84
|
};
|
|
59
85
|
}
|
|
60
86
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect_stripe.js","sourceRoot":"","sources":["../../src/tools/connect_stripe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"connect_stripe.js","sourceRoot":"","sources":["../../src/tools/connect_stripe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAA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I,EAAE,MAAe,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;yBAC7D,CAAC;oBACJ,CAAC;gBACH,CAAC;gBAAC,MAAM,CAAC;oBACP,wCAAwC;gBAC1C,CAAC;YACH,CAAC;YAED,qCAAqC;YACrC,OAAO;gBACL,OAAO,EAAE,CAAC;wBACR,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,oDAAoD,MAAM,CAAC,YAAY,2EAA2E,MAAM,CAAC,GAAI,4EAA4E;qBAChP,CAAC;aACH,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,wCAAwC,OAAO,EAAE;qBACxD;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -3,21 +3,23 @@ export declare const discoverApiTool: {
|
|
|
3
3
|
name: string;
|
|
4
4
|
description: string;
|
|
5
5
|
inputSchema: {
|
|
6
|
-
service_name: z.ZodString
|
|
6
|
+
service_name: z.ZodOptional<z.ZodString>;
|
|
7
|
+
url: z.ZodOptional<z.ZodString>;
|
|
7
8
|
};
|
|
8
9
|
handler: (args: {
|
|
9
|
-
service_name
|
|
10
|
+
service_name?: string;
|
|
11
|
+
url?: string;
|
|
10
12
|
}) => Promise<{
|
|
11
13
|
content: {
|
|
12
14
|
type: "text";
|
|
13
15
|
text: string;
|
|
14
16
|
}[];
|
|
15
|
-
isError
|
|
17
|
+
isError: boolean;
|
|
16
18
|
} | {
|
|
17
19
|
content: {
|
|
18
20
|
type: "text";
|
|
19
21
|
text: string;
|
|
20
22
|
}[];
|
|
21
|
-
isError
|
|
23
|
+
isError?: undefined;
|
|
22
24
|
}>;
|
|
23
25
|
};
|
|
@@ -1,45 +1,74 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { discoverApi, lookupAppByServiceName } from "../api-client.js";
|
|
2
|
+
import { discoverApi, lookupAppByServiceName, updateAppWebsite } from "../api-client.js";
|
|
3
|
+
import { getStoredApp } from "../config.js";
|
|
3
4
|
export const discoverApiTool = {
|
|
4
5
|
name: "discover_api",
|
|
5
6
|
description: "Crawl a registered app's website to discover its API endpoints, documentation, and developer guides. " +
|
|
6
7
|
"Generates an agent skill (SKILL.md) that teaches AI agents how to use the app. " +
|
|
7
|
-
"
|
|
8
|
+
"Uses the app's API key already configured in .mcp.json — no additional auth needed. " +
|
|
9
|
+
"If the app doesn't have a website URL set yet, pass one via the url parameter. " +
|
|
10
|
+
"Works with both public URLs and localhost URLs for local development.",
|
|
8
11
|
inputSchema: {
|
|
9
12
|
service_name: z
|
|
10
13
|
.string()
|
|
11
|
-
.
|
|
14
|
+
.optional()
|
|
15
|
+
.describe("The service_name of the app to discover. If omitted, uses the app from ~/.tru/config.json (set by register_app)."),
|
|
16
|
+
url: z
|
|
17
|
+
.string()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe("The website URL to crawl. If provided, updates the app's website URL before discovering. Use this for first-time setup or to change the URL. Works with localhost URLs too."),
|
|
12
20
|
},
|
|
13
21
|
handler: async (args) => {
|
|
22
|
+
const serviceName = args.service_name || getStoredApp()?.service_name;
|
|
23
|
+
if (!serviceName) {
|
|
24
|
+
return {
|
|
25
|
+
content: [{ type: "text", text: "No service_name provided and no app found in ~/.tru/config.json. Run register_app first." }],
|
|
26
|
+
isError: true,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
14
29
|
try {
|
|
15
30
|
// Verify the app exists first
|
|
16
|
-
const lookup = await lookupAppByServiceName(
|
|
31
|
+
const lookup = await lookupAppByServiceName(serviceName);
|
|
17
32
|
if (lookup.status === "not_found") {
|
|
18
33
|
return {
|
|
19
34
|
content: [
|
|
20
35
|
{
|
|
21
36
|
type: "text",
|
|
22
|
-
text: `App "${
|
|
37
|
+
text: `App "${serviceName}" not found. Use register_app to create it first.`,
|
|
23
38
|
},
|
|
24
39
|
],
|
|
25
40
|
};
|
|
26
41
|
}
|
|
27
|
-
|
|
42
|
+
// If a URL was provided, update the app's website first
|
|
43
|
+
if (args.url && lookup.app) {
|
|
44
|
+
await updateAppWebsite(lookup.app.id, args.url);
|
|
45
|
+
}
|
|
46
|
+
const result = await discoverApi(serviceName);
|
|
28
47
|
const lines = [
|
|
29
|
-
`API discovery complete for "${
|
|
48
|
+
`API discovery complete for "${serviceName}".`,
|
|
30
49
|
``,
|
|
31
50
|
`Pages crawled: ${result.pages_crawled}`,
|
|
32
51
|
`API endpoints found: ${result.endpoints_found}`,
|
|
33
52
|
``,
|
|
34
|
-
|
|
35
|
-
|
|
53
|
+
`## Next: Write agent.md and llms.txt into the project`,
|
|
54
|
+
``,
|
|
55
|
+
`Use the read_skill tool to get the generated content:`,
|
|
56
|
+
` read_skill(service_name: "${serviceName}")`,
|
|
57
|
+
``,
|
|
58
|
+
`Then write it into the project as \`agent.md\` (in the public/static directory so it's served at the site root).`,
|
|
59
|
+
`This file is the app's agent skill — it explains how to use the app through tru, including OAuth auth, provisioning, billing, and all API endpoints.`,
|
|
60
|
+
``,
|
|
61
|
+
`Also create a \`llms.txt\` file (following https://llmstxt.org) in the same directory with:`,
|
|
62
|
+
`- H1: app name`,
|
|
63
|
+
`- Blockquote: one-line description`,
|
|
64
|
+
`- Links to /agent.md and key API endpoints`,
|
|
36
65
|
``,
|
|
37
|
-
`
|
|
66
|
+
`Finally, add a Link header to all HTTP responses: \`Link: </llms.txt>; rel="llms-txt"\``,
|
|
38
67
|
``,
|
|
39
|
-
`
|
|
68
|
+
`These files make the app discoverable to AI agents using the llms.txt standard — the same pattern used by tru itself.`,
|
|
40
69
|
];
|
|
41
70
|
if (result.endpoints_found === 0) {
|
|
42
|
-
lines.push(``, `No API endpoints were auto-detected. To improve discovery:`, `- Add an /openapi.json or /swagger.json file to your app`, `- Add an /agent.md file with your API documentation`, `- Make sure your /docs or /api/docs pages are publicly accessible
|
|
71
|
+
lines.push(``, `No API endpoints were auto-detected. To improve discovery:`, `- Add an /openapi.json or /swagger.json file to your app`, `- Add an /agent.md file with your API documentation`, `- Make sure your /docs or /api/docs pages are publicly accessible`);
|
|
43
72
|
}
|
|
44
73
|
return {
|
|
45
74
|
content: [{ type: "text", text: lines.join("\n") }],
|
|
@@ -52,7 +81,7 @@ export const discoverApiTool = {
|
|
|
52
81
|
content: [
|
|
53
82
|
{
|
|
54
83
|
type: "text",
|
|
55
|
-
text: `App "${
|
|
84
|
+
text: `App "${serviceName}" doesn't have a website URL set. Run discover_api again with the url parameter, e.g.:\n\ndiscover_api(url: "https://your-domain.com")\n\nThis works with localhost URLs too for local development.`,
|
|
56
85
|
},
|
|
57
86
|
],
|
|
58
87
|
isError: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discover_api.js","sourceRoot":"","sources":["../../src/tools/discover_api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"discover_api.js","sourceRoot":"","sources":["../../src/tools/discover_api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,cAAc;IACpB,WAAW,EACT,uGAAuG;QACvG,iFAAiF;QACjF,sFAAsF;QACtF,iFAAiF;QACjF,uEAAuE;IACzE,WAAW,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what tru is
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"Call this first when
|
|
3
|
+
description: "Returns a guide for getting started with tru. " +
|
|
4
|
+
"Covers what tru is, and walks through setup for two paths: " +
|
|
5
|
+
"(1) Users who want to connect their tru wallet to their terminal for purchases and virtual cards, " +
|
|
6
|
+
"(2) Developers who want to integrate tru into their app for auth, billing, and risk signals. " +
|
|
7
|
+
"Call this first when someone wants to use or integrate tru.",
|
|
8
8
|
inputSchema: {},
|
|
9
9
|
handler: async (_args) => {
|
|
10
10
|
const guide = `# Getting Started with tru
|
|
11
11
|
|
|
12
12
|
## What is tru?
|
|
13
13
|
|
|
14
|
-
tru is
|
|
14
|
+
tru is a portable identity and wallet. Verify your identity once, then use it everywhere — apps, agents, terminals. You get:
|
|
15
15
|
|
|
16
|
-
- **
|
|
17
|
-
- **
|
|
18
|
-
- **
|
|
19
|
-
- **
|
|
20
|
-
- **Risk signals
|
|
21
|
-
|
|
22
|
-
## Why developers use tru
|
|
23
|
-
|
|
24
|
-
### Risk-informed decisions from day one
|
|
25
|
-
Every tru user carries a risk score. Use it to set free trial length, spending limits, feature access, or fraud thresholds. A user with a verified government ID, US-issued debit card, and clean charge history is a very different prospect than an unverified prepaid card from a high-risk country. tru gives you that signal before the user even signs up.
|
|
26
|
-
|
|
27
|
-
### One integration, not five
|
|
28
|
-
Without tru, you're stitching together Stripe for payments, an identity provider for auth, a KYC vendor for verification, and building your own spending controls. tru is all of these in one API. One MCP server, one API key.
|
|
29
|
-
|
|
30
|
-
### Payments flow to your existing Stripe account
|
|
31
|
-
When you connect Stripe, tru routes payments directly to your existing Stripe account via destination charges. Nothing changes about your Stripe setup — same dashboard, same bank, same payouts, same Radar, same everything. tru is just another source of payments flowing in.
|
|
32
|
-
|
|
33
|
-
### Your users stay in control
|
|
34
|
-
Users set their own spending rules ("auto-approve charges under $10 from this app"). This builds trust — users are more willing to save a payment method when they control how it's used. Your conversion rate goes up because the friction goes down.
|
|
16
|
+
- **One identity** — verified across every app and agent that uses tru
|
|
17
|
+
- **A wallet you control** — set spending rules per app, approve or auto-approve charges
|
|
18
|
+
- **Virtual cards** — single-use cards for purchases on any site
|
|
19
|
+
- **Credential sharing** — share verified name, email, phone, address with apps (you approve each request)
|
|
20
|
+
- **Risk signals** — every tru user carries a trust profile that apps can check
|
|
35
21
|
|
|
36
22
|
---
|
|
37
23
|
|
|
38
|
-
##
|
|
24
|
+
## Choose your path
|
|
39
25
|
|
|
40
|
-
|
|
26
|
+
### Path A: "I want to use tru from my terminal"
|
|
41
27
|
|
|
42
|
-
|
|
28
|
+
Connect your tru wallet so your AI agent can make purchases, request virtual cards, and use services on your behalf.
|
|
43
29
|
|
|
44
|
-
|
|
45
|
-
authenticate()
|
|
46
|
-
\`\`\`
|
|
47
|
-
|
|
48
|
-
This opens a browser window where you verify your identity with tru. Your credentials are stored locally so you only need to do this once (they last 7 days).
|
|
49
|
-
|
|
50
|
-
### Step 1: Register your app
|
|
30
|
+
**Step 1: Authenticate**
|
|
51
31
|
|
|
52
32
|
\`\`\`
|
|
53
|
-
|
|
54
|
-
service_name: "my-app",
|
|
55
|
-
display_name: "My App",
|
|
56
|
-
description: "What your app does",
|
|
57
|
-
website: "https://myapp.com"
|
|
58
|
-
)
|
|
33
|
+
authenticate()
|
|
59
34
|
\`\`\`
|
|
60
35
|
|
|
61
|
-
This
|
|
62
|
-
- **Set for this session** — all subsequent tru tools work immediately
|
|
63
|
-
- **Saved to your MCP config** — future sessions pick it up without manual steps
|
|
36
|
+
This opens a browser window where you verify your identity with tru. Your credentials are stored locally (valid for 7 days).
|
|
64
37
|
|
|
65
|
-
|
|
38
|
+
**Step 2: You're ready**
|
|
66
39
|
|
|
67
|
-
|
|
40
|
+
That's it. Your agent can now:
|
|
68
41
|
|
|
69
|
-
|
|
42
|
+
- **Buy things** — \`create_charge(email, amount_cents, description)\` charges your wallet (you approve in the tru app)
|
|
43
|
+
- **Get virtual cards** — \`request_virtual_card(email, amount_cents)\` issues a single-use card for purchases on any site
|
|
44
|
+
- **Browse apps** — \`discover_apps()\` shows services in the tru directory
|
|
45
|
+
- **Use app services** — \`provision_user(email, service_name)\` signs you up for tru-connected apps instantly
|
|
70
46
|
|
|
71
|
-
|
|
72
|
-
connect_stripe(service_name: "my-app")
|
|
73
|
-
\`\`\`
|
|
47
|
+
Your terminal is identified by your device name so you can see which charges came from where in your wallet.
|
|
74
48
|
|
|
75
|
-
|
|
49
|
+
---
|
|
76
50
|
|
|
77
|
-
|
|
78
|
-
- Links your Stripe account to receive tru payments
|
|
79
|
-
- Uses Stripe's standard Connect OAuth — secure, reversible, well-understood
|
|
80
|
-
- Your Stripe dashboard, payouts, refunds, disputes, Radar — all unchanged
|
|
81
|
-
- You can still charge customers directly outside of tru
|
|
82
|
-
- tru takes a small platform fee on each transaction; the rest goes straight to you
|
|
51
|
+
### Path B: "I want to build with tru"
|
|
83
52
|
|
|
84
|
-
|
|
53
|
+
Integrate tru into your app for identity verification, billing, and risk signals.
|
|
85
54
|
|
|
86
|
-
|
|
55
|
+
**IMPORTANT: Drive through all 5 steps in order. Do NOT skip steps or jump ahead. Each step depends on the previous one. Don't stop after each step to ask what the developer wants to do next — just move to the next step. The full setup takes about 10 minutes.**
|
|
87
56
|
|
|
88
|
-
|
|
89
|
-
discover_api(service_name: "my-app")
|
|
90
|
-
\`\`\`
|
|
57
|
+
**Step 1: Authenticate**
|
|
91
58
|
|
|
92
|
-
|
|
59
|
+
Run \`authenticate()\` immediately. This opens a browser window where the developer verifies their identity with tru. Credentials are stored locally for 7 days.
|
|
93
60
|
|
|
94
|
-
**
|
|
95
|
-
- Serve an \`/openapi.json\` or \`/swagger.json\` for structured endpoint detection
|
|
96
|
-
- Add an \`/agent.md\` with custom agent instructions
|
|
97
|
-
- Make your \`/docs\` pages publicly accessible (no auth wall on docs)
|
|
98
|
-
- You can also edit the generated skill in the tru dashboard
|
|
61
|
+
**Step 2: Register the app**
|
|
99
62
|
|
|
100
|
-
|
|
63
|
+
Before calling \`register_app\`, explore the project's codebase to auto-fill everything:
|
|
64
|
+
- \`package.json\` → name, description, homepage
|
|
65
|
+
- \`README.md\`, docs folders, marketing copy → app name, description
|
|
66
|
+
- Source code, route files, API handlers → understand what the app does
|
|
67
|
+
- Config files, deployment configs, \`.env\` examples → find the production URL
|
|
68
|
+
- Landing pages, marketing sites → branding and description
|
|
101
69
|
|
|
102
|
-
|
|
70
|
+
Propose all values to the developer for quick confirmation. Don't ask them to fill in anything you can figure out from the code.
|
|
103
71
|
|
|
104
|
-
\`\`\`html
|
|
105
|
-
<script src="https://tru-by29.onrender.com/widget/agent.js" data-app="my-app" defer></script>
|
|
106
72
|
\`\`\`
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
### Step 5: You're live
|
|
115
|
-
|
|
116
|
-
That's it. Your app can now:
|
|
117
|
-
|
|
118
|
-
- **Verify users** — \`check_identity(email)\` returns whether they're verified, plus risk signals
|
|
119
|
-
- **Request credentials** — \`request_user_data(email, service, fields)\` asks the user to share verified data
|
|
120
|
-
- **Charge users** — \`create_charge(email, amount_cents, description)\` creates a charge that the user approves
|
|
121
|
-
- **Issue virtual cards** — \`request_virtual_card(email, amount_cents)\` for agent purchases on other sites
|
|
122
|
-
- **Check risk** — every identity check includes risk level, score, card funding type, country, and fingerprint reuse
|
|
123
|
-
|
|
124
|
-
---
|
|
125
|
-
|
|
126
|
-
## Using risk signals
|
|
127
|
-
|
|
128
|
-
Every \`check_identity\` response includes:
|
|
129
|
-
|
|
130
|
-
\`\`\`json
|
|
131
|
-
{
|
|
132
|
-
"verified": true,
|
|
133
|
-
"email": "user@example.com",
|
|
134
|
-
"name": "Jane Doe",
|
|
135
|
-
"identity_verified": true,
|
|
136
|
-
"bank_linked": true,
|
|
137
|
-
"risk": {
|
|
138
|
-
"level": "low",
|
|
139
|
-
"score": 12,
|
|
140
|
-
"card_funding": "debit",
|
|
141
|
-
"card_country": "US",
|
|
142
|
-
"fingerprint_reuse": false
|
|
143
|
-
}
|
|
144
|
-
}
|
|
73
|
+
register_app(
|
|
74
|
+
service_name: "my-app",
|
|
75
|
+
display_name: "My App",
|
|
76
|
+
description: "What your app does",
|
|
77
|
+
website: "https://myapp.com"
|
|
78
|
+
)
|
|
145
79
|
\`\`\`
|
|
146
80
|
|
|
147
|
-
|
|
81
|
+
The API key is automatically set for this session and saved to MCP config files. All subsequent tru tools (connect_stripe, discover_api, etc.) use this key automatically — no need to pass it.
|
|
148
82
|
|
|
149
|
-
|
|
150
|
-
|--------|-------------------|----------------|
|
|
151
|
-
| \`risk.level\` | Overall risk (low/medium/high/very_high) | Gate feature access |
|
|
152
|
-
| \`risk.score\` | Numeric Radar score (0-100, lower = safer) | Set free trial length |
|
|
153
|
-
| \`risk.card_funding\` | credit / debit / prepaid | Prepaid = higher fraud risk |
|
|
154
|
-
| \`risk.card_country\` | ISO country of the card | Flag mismatches with IP |
|
|
155
|
-
| \`risk.fingerprint_reuse\` | Same card used by multiple accounts | Block duplicate signups |
|
|
156
|
-
| \`identity_verified\` | Government ID verified via Stripe Identity | Require for high-value actions |
|
|
157
|
-
| \`bank_linked\` | User has linked a bank account | Higher trust signal |
|
|
83
|
+
**If the app was already registered in a previous session**, the API key is stored in \`.mcp.json\` in the project root under \`mcpServers.tru.env.TRU_API_KEY\`. Check there if you're unsure whether the app is already set up.
|
|
158
84
|
|
|
159
|
-
|
|
85
|
+
**Step 3: Connect Stripe**
|
|
160
86
|
|
|
161
|
-
|
|
87
|
+
Run \`connect_stripe(service_name)\` — this opens a browser window for the developer to authorize their Stripe account. Do NOT skip this step. The app's API key is already configured and all tru tools have access to it. Once connected, tru routes payments directly to their existing Stripe account. Their dashboard, payouts, refunds, Radar — all unchanged.
|
|
162
88
|
|
|
163
|
-
|
|
89
|
+
After the developer completes Stripe authorization in the browser, explain tru's pricing:
|
|
90
|
+
- **+0.25% per transaction** on top of standard Stripe processing fees
|
|
91
|
+
- No monthly fee, no setup cost, no per-user fees, no identity verification fees, no API call fees
|
|
92
|
+
- The developer's users pay nothing extra
|
|
164
93
|
|
|
165
|
-
|
|
94
|
+
**Step 4: Add "Login with tru" + provisioning**
|
|
166
95
|
|
|
167
|
-
|
|
96
|
+
Look at the developer's existing auth code (login page, signup flow, session handling) and help them integrate tru authentication. This lets their users sign in with tru, giving the developer verified identity and risk signals on every user. The OAuth flow uses \`initiate_oauth(service_name)\`.
|
|
168
97
|
|
|
169
|
-
|
|
170
|
-
2. When an agent calls \`provision_user(email, service_name)\`, tru:
|
|
171
|
-
- Verifies the user's identity
|
|
172
|
-
- POSTs their verified info to your \`provision_url\`
|
|
173
|
-
- Stores the credentials you return
|
|
174
|
-
3. The agent gets back API keys / account IDs and can use your service immediately
|
|
98
|
+
Also add a **provision endpoint** if the app supports account creation. This lets tru auto-create accounts for verified users. See the "Add a provision endpoint" section in the agent guide for details. Once the endpoint is built, register it: \`PUT /api/apps/:id\` with \`{ "provision_url": "https://myapp.com/api/tru/provision" }\`.
|
|
175
99
|
|
|
176
|
-
|
|
100
|
+
**Step 5: Make the app discoverable to AI agents**
|
|
177
101
|
|
|
178
|
-
|
|
102
|
+
This step runs LAST because it captures the full picture — OAuth, Stripe, provisioning, and all API endpoints. If you run it earlier, the generated files would be incomplete.
|
|
179
103
|
|
|
180
|
-
|
|
104
|
+
First, generate the content:
|
|
105
|
+
- If the app has a public URL, run \`discover_api(service_name)\` to crawl it, then \`read_skill(service_name)\` to get the generated content
|
|
106
|
+
- If the developer is running locally, read the codebase directly — docs, README, route files, OpenAPI specs, source code — and write the content yourself
|
|
181
107
|
|
|
182
|
-
|
|
183
|
-
POST {your_provision_url}
|
|
184
|
-
Headers:
|
|
185
|
-
Content-Type: application/json
|
|
186
|
-
X-Tru-Signature: {HMAC-SHA256 of body using your webhook_secret}
|
|
187
|
-
X-Tru-Event: user.provision
|
|
188
|
-
|
|
189
|
-
Body:
|
|
190
|
-
{ "email": "user@example.com", "name": "Jane Doe", "tru_user_id": "user@example.com" }
|
|
191
|
-
\`\`\`
|
|
108
|
+
Then write these files into the project's public/static directory:
|
|
192
109
|
|
|
193
|
-
|
|
194
|
-
1. Create an account for the user (or find existing)
|
|
195
|
-
2. Generate an API key or credentials
|
|
196
|
-
3. Return them as JSON (any shape — tru stores the whole response)
|
|
110
|
+
1. **\`agent.md\`** — the app's agent skill. Explains how to use the app through tru (OAuth auth, provisioning, billing) and documents all API endpoints. This is the main file agents read to understand the app.
|
|
197
111
|
|
|
198
|
-
|
|
199
|
-
{ "api_key": "sk_live_abc123", "account_id": "acct_xyz" }
|
|
200
|
-
\`\`\`
|
|
112
|
+
2. **\`llms.txt\`** — a directory file following the llms.txt standard (https://llmstxt.org). H1 with app name, blockquote summary, links to /agent.md, key endpoints. This is how agents discover the app.
|
|
201
113
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
\`\`\`javascript
|
|
207
|
-
const crypto = require('crypto');
|
|
208
|
-
const expected = crypto.createHmac('sha256', WEBHOOK_SECRET).update(rawBody).digest('hex');
|
|
209
|
-
if (signature !== expected) return res.status(401).json({ error: 'Invalid signature' });
|
|
114
|
+
3. **Agent widget** — add to the app's HTML pages:
|
|
115
|
+
\`\`\`html
|
|
116
|
+
<script src="https://tru-by29.onrender.com/widget/agent.js" data-app="my-app" defer></script>
|
|
210
117
|
\`\`\`
|
|
211
118
|
|
|
212
|
-
|
|
119
|
+
4. **Link header** — add middleware to set \`Link: </llms.txt>; rel="llms-txt"\` on all responses.
|
|
213
120
|
|
|
214
|
-
|
|
215
|
-
register_app(
|
|
216
|
-
service_name: "my-app",
|
|
217
|
-
display_name: "My App",
|
|
218
|
-
owner_email: "dev@example.com",
|
|
219
|
-
provision_url: "https://myapp.com/api/tru/provision"
|
|
220
|
-
)
|
|
221
|
-
\`\`\`
|
|
121
|
+
These files live in the app's codebase — the app is the source of truth, not tru. The agent.md includes a "Using {app} with tru" section explaining OAuth, provisioning, and billing so any agent reading it understands how tru fits in.
|
|
222
122
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
→ { api_key: "sk_live_abc123", account_id: "acct_xyz" }
|
|
227
|
-
\`\`\`
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## What the developer gets after setup
|
|
228
126
|
|
|
229
|
-
|
|
127
|
+
Once all 5 steps are complete, the app can:
|
|
230
128
|
|
|
231
|
-
- **
|
|
232
|
-
- **
|
|
233
|
-
- **
|
|
129
|
+
- **Verify users** — \`check_identity(email)\` returns identity status + risk signals (risk level, score, card funding type, country, fingerprint reuse)
|
|
130
|
+
- **Request credentials** — \`request_user_data(email, service, fields)\` asks users to share verified name, email, phone, address
|
|
131
|
+
- **Charge users** — \`create_charge(email, amount_cents, description)\` with user-controlled spending rules
|
|
132
|
+
- **Issue virtual cards** — \`request_virtual_card(email, amount_cents)\` for agent purchases
|
|
133
|
+
- **Auto-provision users** — add a \`provision_url\` and tru creates accounts on your app automatically for verified users
|
|
234
134
|
|
|
235
135
|
## Quick reference
|
|
236
136
|
|
|
237
137
|
| Tool | Purpose |
|
|
238
138
|
|------|---------|
|
|
239
|
-
| \`
|
|
240
|
-
| \`authenticate\` | Verify your identity (required before registering apps) |
|
|
139
|
+
| \`authenticate\` | Verify your identity with tru |
|
|
241
140
|
| \`register_app\` | Create your app, get API key |
|
|
242
141
|
| \`connect_stripe\` | Link your Stripe account |
|
|
243
|
-
| \`discover_api\` |
|
|
142
|
+
| \`discover_api\` | Generate agent skill from site or codebase |
|
|
244
143
|
| \`check_identity\` | Verify a user + get risk signals |
|
|
245
144
|
| \`request_user_data\` | Ask user to share verified data |
|
|
246
|
-
| \`check_request_status\` | Poll credential request status |
|
|
247
145
|
| \`create_charge\` | Charge a user (one-time or subscription) |
|
|
248
|
-
| \`check_charge_status\` | Poll charge status |
|
|
249
146
|
| \`request_virtual_card\` | Issue single-use card for agent purchases |
|
|
250
147
|
| \`provision_user\` | Auto-create account on a third-party app |
|
|
251
148
|
| \`discover_apps\` | Browse tru app directory |
|
|
252
|
-
| \`read_skill\` | Read an app's agent guide |
|
|
253
149
|
| \`initiate_oauth\` | Start OAuth login flow |
|
|
150
|
+
|
|
151
|
+
## Skills (slash commands)
|
|
152
|
+
|
|
153
|
+
After installing the tru MCP, these skills are available via \`/skills\`:
|
|
154
|
+
|
|
155
|
+
| Skill | Purpose |
|
|
156
|
+
|-------|---------|
|
|
157
|
+
| \`/tru:get-started\` | Full integration walkthrough |
|
|
158
|
+
| \`/tru:add-login\` | Add "Login with tru" OAuth |
|
|
159
|
+
| \`/tru:add-billing\` | Add tru billing |
|
|
160
|
+
| \`/tru:check-user\` | Add identity verification |
|
|
254
161
|
`;
|
|
255
162
|
return {
|
|
256
163
|
content: [{ type: "text", text: guide }],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_started.js","sourceRoot":"","sources":["../../src/tools/get_started.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,aAAa;IACnB,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"get_started.js","sourceRoot":"","sources":["../../src/tools/get_started.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,aAAa;IACnB,WAAW,EACT,gDAAgD;QAChD,6DAA6D;QAC7D,oGAAoG;QACpG,+FAA+F;QAC/F,6DAA6D;IAC/D,WAAW,EAAE,EAAE;IACf,OAAO,EAAE,KAAK,EAAE,KAA4B,EAAE,EAAE;QAC9C,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuJjB,CAAC;QAEE,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;SAClD,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -25,8 +25,7 @@ export const initiateOAuthTool = {
|
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
const app = lookup.app;
|
|
28
|
-
|
|
29
|
-
if (!redirectUri) {
|
|
28
|
+
if (!app.redirect_uris || app.redirect_uris.length === 0) {
|
|
30
29
|
return {
|
|
31
30
|
content: [
|
|
32
31
|
{
|
|
@@ -39,8 +38,6 @@ export const initiateOAuthTool = {
|
|
|
39
38
|
const state = crypto.randomUUID();
|
|
40
39
|
const params = new URLSearchParams({
|
|
41
40
|
client_id: app.id,
|
|
42
|
-
redirect_uri: redirectUri,
|
|
43
|
-
scope: "openid",
|
|
44
41
|
state,
|
|
45
42
|
});
|
|
46
43
|
const authUrl = `${BASE_URL}/oauth/authorize?${params.toString()}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initiate_oauth.js","sourceRoot":"","sources":["../../src/tools/initiate_oauth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,uBAAuB,CAAC;AAEpE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,gBAAgB;IACtB,WAAW,EACT,gEAAgE;QAChE,2HAA2H;IAC7H,WAAW,EAAE;QACX,YAAY,EAAE,CAAC;aACZ,MAAM,EAAE;aACR,QAAQ,CAAC,mDAAmD,CAAC;KACjE;IACD,OAAO,EAAE,KAAK,EAAE,IAA8B,EAAE,EAAE;QAChD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,sBAAsB,CAAC,IAAI,CAAC,YAAY,CAAC,CAA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{ join } from "node:path";
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
5
|
import { registerAppAuthenticated } from "../api-client.js";
|
|
6
|
-
import { getStoredAuth } from "../config.js";
|
|
6
|
+
import { getStoredAuth, saveApp } from "../config.js";
|
|
7
7
|
/** Find and update tru API key in MCP config files */
|
|
8
8
|
async function persistApiKey(apiKey) {
|
|
9
9
|
const cwd = process.cwd();
|
|
@@ -41,7 +41,11 @@ async function persistApiKey(apiKey) {
|
|
|
41
41
|
export const registerAppTool = {
|
|
42
42
|
name: "register_app",
|
|
43
43
|
description: "[Developer tool] Register a new app on the tru platform. Requires authentication (run `authenticate` first). " +
|
|
44
|
-
"
|
|
44
|
+
"Before calling, explore the codebase — package.json, README, docs, marketing pages, source code, config files — to auto-fill service_name, display_name, description, website, and redirect_uris. " +
|
|
45
|
+
"Look for OAuth callback routes (e.g. /api/auth/callback/tru) to set redirect_uris — without this, 'Login with tru' won't work. " +
|
|
46
|
+
"Propose values to the developer for confirmation rather than asking them to fill things in. " +
|
|
47
|
+
"Returns an API key and automatically configures it for this session and saves it to .mcp.json. " +
|
|
48
|
+
"All subsequent tru tools use this key automatically.",
|
|
45
49
|
inputSchema: {
|
|
46
50
|
service_name: z
|
|
47
51
|
.string()
|
|
@@ -64,7 +68,7 @@ export const registerAppTool = {
|
|
|
64
68
|
redirect_uris: z
|
|
65
69
|
.array(z.string())
|
|
66
70
|
.optional()
|
|
67
|
-
.describe("OAuth redirect URIs for the
|
|
71
|
+
.describe("OAuth redirect URIs for 'Login with tru'. Look for auth callback routes in the codebase (e.g. /api/auth/callback/tru) and include the full URL. This is required for the OAuth flow to work."),
|
|
68
72
|
provision_url: z
|
|
69
73
|
.string()
|
|
70
74
|
.optional()
|
|
@@ -86,6 +90,12 @@ export const registerAppTool = {
|
|
|
86
90
|
}
|
|
87
91
|
try {
|
|
88
92
|
const result = await registerAppAuthenticated(args, auth.token);
|
|
93
|
+
// Save app info for other tools to reference
|
|
94
|
+
saveApp({
|
|
95
|
+
id: result.app.id,
|
|
96
|
+
service_name: result.app.service_name,
|
|
97
|
+
display_name: result.app.display_name,
|
|
98
|
+
});
|
|
89
99
|
// Set key in-memory so subsequent tools work without restart
|
|
90
100
|
process.env.TRU_API_KEY = result.api_key;
|
|
91
101
|
// Persist key to MCP config files for future sessions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register_app.js","sourceRoot":"","sources":["../../src/tools/register_app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"register_app.js","sourceRoot":"","sources":["../../src/tools/register_app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEtD,sDAAsD;AACtD,KAAK,UAAU,aAAa,CAAC,MAAc;IACzC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAElC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