tru-mcp 0.1.1 → 0.2.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # tru MCP Server
2
2
 
3
- MCP server for [tru](https://tru-by29.onrender.com) — portable identity and billing for AI agents. Lets any MCP-compatible agent (Claude, Cursor, etc.) verify users, request credentials, create charges, and issue virtual cards.
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
 
@@ -10,6 +10,8 @@ npx tru-mcp init
10
10
 
11
11
  This detects your MCP client (Claude Code, Claude Desktop, Cursor) and writes the config automatically.
12
12
 
13
+ Don't have an API key yet? That's fine — add the MCP server first, then ask your agent to run `get_started`. It walks you through the entire setup.
14
+
13
15
  ### Manual Config
14
16
 
15
17
  Add to your `.mcp.json` (Claude Code) or equivalent:
@@ -36,39 +38,79 @@ Add to your `.mcp.json` (Claude Code) or equivalent:
36
38
  | `TRU_API_KEY` | Yes | Your tru API key (starts with `tru_ak_`) |
37
39
  | `TRU_API_URL` | No | tru server URL (default: `https://tru-by29.onrender.com`) |
38
40
 
41
+ ## Getting Started
42
+
43
+ The MCP tools walk you through setup step by step:
44
+
45
+ 1. **`get_started`** — Full guide: what tru is, why it matters, risk signals, setup walkthrough
46
+ 2. **`register_app`** — Create your app, get an API key
47
+ 3. **`connect_stripe`** — Link your Stripe account to receive payments
48
+
49
+ After that, you're live. All the tools below work immediately.
50
+
39
51
  ## Tools
40
52
 
41
53
  | Tool | Description |
42
54
  |------|-------------|
43
- | `check_identity` | Check if a user has a verified tru identity |
44
- | `request_credentials` | Request verified credential data from a user's vault |
55
+ | **Setup** | |
56
+ | `get_started` | Full setup guide what tru is, how to integrate, risk signals explained |
57
+ | `register_app` | Register a new app on tru and get an API key |
58
+ | `connect_stripe` | Link your existing Stripe account to receive payments |
59
+ | **Identity & Credentials** | |
60
+ | `check_identity` | Verify a user + get risk signals (level, score, card funding, country) |
61
+ | `request_credentials` | Request verified data from a user's vault (name, email, phone, address) |
45
62
  | `check_request_status` | Poll the status of a credential request |
63
+ | **Billing** | |
46
64
  | `create_charge` | Create a direct charge or subscription |
47
65
  | `check_charge_status` | Check the status of a charge request |
48
66
  | `request_virtual_card` | Issue a single-use virtual card for agent purchases |
67
+ | **Discovery** | |
49
68
  | `discover_apps` | Browse registered apps on the tru platform |
50
69
  | `read_skill` | Read an app's agent skill guide |
51
70
  | `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
71
 
54
- ## Example Agent Conversation
72
+ ## Why tru?
73
+
74
+ - **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.
75
+ - **Auth + billing in one API** — stop stitching together Stripe, an identity provider, a KYC vendor, and your own spending controls.
76
+ - **Payments to your Stripe** — connect via OAuth, money flows to your existing account. Same dashboard, same bank, same everything.
77
+ - **Users control spending** — they set per-app rules ("auto-approve under $10"), which builds trust and increases conversion.
78
+
79
+ ## Example: Developer Setup
80
+
81
+ ```
82
+ Developer: I want to integrate tru into my app
83
+
84
+ Agent: → get_started()
85
+ Here's how tru works...
86
+
87
+ Agent: Let's register your app.
88
+ → register_app(service_name: "my-app", display_name: "My App", owner_email: "dev@example.com")
89
+ ✓ App created — API key: tru_ak_...
90
+
91
+ Agent: Now let's connect your Stripe account.
92
+ → connect_stripe(service_name: "my-app")
93
+ Open this URL to authorize: https://connect.stripe.com/oauth/authorize?...
55
94
 
95
+ Agent: You're live. Charges approved by tru users will flow to your Stripe account.
56
96
  ```
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
97
 
62
- Agent: I'll request your credentials for signup.
63
- → request_credentials(email: "user@example.com", fields: ["name", "email"])
98
+ ## Example: End User Flow
99
+
100
+ ```
101
+ User: Sign me up for that new service
102
+
103
+ Agent: → check_identity(email: "user@example.com")
104
+ ✓ Verified — risk: low, score: 12, debit card, US
105
+
106
+ Agent: → request_credentials(email: "user@example.com", fields: ["name", "email"])
64
107
  ⏳ Pending — approve on your tru dashboard
65
108
 
66
109
  Agent: → check_request_status(request_id: "req_abc123")
67
110
  ✓ Approved — got name and email
68
111
 
69
- Agent: Now let me create the account and handle payment.
70
- create_charge(email: "user@example.com", amount_cents: 999, description: "Monthly plan")
71
- ✓ Auto-approved by your spending rules
112
+ Agent: create_charge(email: "user@example.com", amount_cents: 999, description: "Monthly plan")
113
+ Auto-approved by spending rules
72
114
  ```
73
115
 
74
116
  ## License
@@ -103,5 +103,15 @@ export interface ChargeStatusResponse {
103
103
  [key: string]: unknown;
104
104
  }
105
105
  export declare function getChargeStatus(id: string): Promise<ChargeStatusResponse>;
106
+ export interface ConnectOAuthResponse {
107
+ already_connected: boolean;
108
+ app_id: string;
109
+ display_name: string;
110
+ url?: string;
111
+ status?: string;
112
+ charges_enabled?: boolean;
113
+ payouts_enabled?: boolean;
114
+ }
115
+ export declare function getConnectOAuthUrl(serviceName: string): Promise<ConnectOAuthResponse>;
106
116
  export declare function requestAgentCard(email: string, amountCents: number, description?: string, targetService?: string, currency?: string, action?: string): Promise<AgentCardResponse>;
107
117
  export {};
@@ -59,6 +59,9 @@ 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
+ }
62
65
  export async function requestAgentCard(email, amountCents, description, targetService, currency, action) {
63
66
  return (await request("/api/billing/agent-card", {
64
67
  method: "POST",
@@ -1 +1 @@
1
- {"version":3,"file":"api-client.js","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":"A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C;KAC7B,CAAC,CAAwB,CAAC;AAC7B,CAAC;AAgBD,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,EAAU;IAC9C,OAAO,CAAC,MAAM,OAAO,CAAC,wBAAwB,kBAAkB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAyB,CAAC;AACnG,CAAC;AAcD,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,WAAmB;IAC1D,OAAO,CAAC,MAAM,OAAO,CAAC,2BAA2B,kBAAkB,CAAC,WAAW,CAAC,YAAY,CAAC,CAAyB,CAAC;AACzH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,KAAa,EACb,WAAmB,EACnB,WAAoB,EACpB,aAAsB,EACtB,QAAiB,EACjB,MAAe;IAEf,OAAO,CAAC,MAAM,OAAO,CAAC,yBAAyB,EAAE;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/server.js CHANGED
@@ -10,6 +10,8 @@ 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";
13
15
  const server = new McpServer({
14
16
  name: "tru-identity",
15
17
  version: "0.1.0",
@@ -25,6 +27,8 @@ server.tool(createChargeTool.name, createChargeTool.description, createChargeToo
25
27
  server.tool(checkChargeStatusTool.name, checkChargeStatusTool.description, checkChargeStatusTool.inputSchema, checkChargeStatusTool.handler);
26
28
  server.tool(registerAppTool.name, registerAppTool.description, registerAppTool.inputSchema, registerAppTool.handler);
27
29
  server.tool(initiateOAuthTool.name, initiateOAuthTool.description, initiateOAuthTool.inputSchema, initiateOAuthTool.handler);
30
+ server.tool(connectStripeTool.name, connectStripeTool.description, connectStripeTool.inputSchema, connectStripeTool.handler);
31
+ server.tool(getStartedTool.name, getStartedTool.description, getStartedTool.inputSchema, getStartedTool.handler);
28
32
  export async function run() {
29
33
  const transport = new StdioServerTransport();
30
34
  await server.connect(transport);
@@ -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,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,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,uBAAuB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IAC3B,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,iBAAiB;AACjB,MAAM,CAAC,IAAI,CACT,iBAAiB,CAAC,IAAI,EACtB,iBAAiB,CAAC,WAAW,EAC7B,iBAAiB,CAAC,WAAW,EA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ACxB,CAAC;AAEF,MAAM,CAAC,IAAI,CACT,iBAAiB,CAAC,IAAI,EACtB,iBAAiB,CAAC,WAAW,EAC7B,iBAAiB,CAAC,WAAW,EAC7B,iBAAiB,CAAC,OAAO,CAC1B,CAAC;AAEF,MAAM,CAAC,IAAI,CACT,iBAAiB,CAAC,IAAI,EACtB,iBAAiB,CAAC,WAAW,EAC7B,iBAAiB,CAAC,WAAW,EAC7B,iBAAiB,CAAC,OAAO,CAC1B,CAAC;AAEF,MAAM,CAAC,IAAI,CACT,cAAc,CAAC,IAAI,EACnB,cAAc,CAAC,WAAW,EAC1B,cAAc,CAAC,WAAW,EAC1B,cAAc,CAAC,OAAO,CACvB,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
@@ -0,0 +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;AAEtD,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,gBAAgB;IACtB,WAAW,EACT,yGAAyG;QACzG,+HAA+H;QAC/H,gHAAgH;QAChH,+HAA+H;IACjI,WAAW,EAAE;QACX,YAAY,EAAE,CAAC;aACZ,MAAM,EAAE;aACR,QAAQ,CAAC,kDAAkD,CAAC;KAChE;IACD,OAAO,EAAE,KAAK,EAAE,IAA8B,EAAE,EAAE;QAChD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAE3D,IAAI,MAAM,CAAC,iBAAiB,EAAE,CAAC;gBAC7B,MAAM,KAAK,GAAG;oBACZ,MAAM,MAAM,CAAC,YAAY,6BAA6B;oBACtD,EAAE;oBACF,qDAAqD;oBACrD,EAAE;oBACF,iBAAiB,MAAM,CAAC,MAAM,EAAE;oBAChC,0BAA0B,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE;oBACjE,0BAA0B,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE;oBACjE,EAAE;oBACF,oFAAoF;iBACrF,CAAC;gBAEF,OAAO;oBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;iBAC7D,CAAC;YACJ,CAAC;YAED,MAAM,KAAK,GAAG;gBACZ,wBAAwB,MAAM,CAAC,YAAY,EAAE;gBAC7C,EAAE;gBACF,4DAA4D;gBAC5D,EAAE;gBACF,MAAM,CAAC,GAAI;gBACX,EAAE;gBACF,4CAA4C;gBAC5C,EAAE;gBACF,oEAAoE;gBACpE,yEAAyE;gBACzE,kEAAkE;gBAClE,EAAE;gBACF,wCAAwC;gBACxC,EAAE;gBACF,+FAA+F;gBAC/F,+FAA+F;gBAC/F,yFAAyF;gBACzF,+EAA+E;gBAC/E,6FAA6F;gBAC7F,EAAE;gBACF,mGAAmG;aACpG,CAAC;YAEF,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;aAC7D,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"}
@@ -0,0 +1,11 @@
1
+ export declare const getStartedTool: {
2
+ name: string;
3
+ description: string;
4
+ inputSchema: {};
5
+ handler: (_args: Record<string, never>) => Promise<{
6
+ content: {
7
+ type: "text";
8
+ text: string;
9
+ }[];
10
+ }>;
11
+ };
@@ -0,0 +1,153 @@
1
+ export const getStartedTool = {
2
+ name: "get_started",
3
+ description: "Returns a complete guide for developers integrating tru into their app. " +
4
+ "Covers what tru is (auth + billing API with risk signals), why it matters, " +
5
+ "and walks through setup step-by-step using the MCP tools: register_app, connect_stripe, " +
6
+ "and then using create_charge, request_credentials, and check_identity. " +
7
+ "Call this first when a developer wants to integrate tru.",
8
+ inputSchema: {},
9
+ handler: async (_args) => {
10
+ const guide = `# Getting Started with tru
11
+
12
+ ## What is tru?
13
+
14
+ tru is an auth and billing API in one. Your users verify their identity once — government ID, bank link, payment method via Stripe — and you get:
15
+
16
+ - **Instant identity verification** — know if a user is real before they touch your product
17
+ - **Credential sharing** — request verified name, email, phone, address from the user's vault (they approve each request)
18
+ - **Built-in billing** — charge users directly or via subscription, with user-controlled spending rules
19
+ - **Virtual cards** — issue single-use cards for agent purchases on third-party sites
20
+ - **Risk signals you can't get anywhere else** — every tru user has a risk profile built from Stripe's Radar, card funding type, country, fingerprint analysis, and charge history
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.
35
+
36
+ ---
37
+
38
+ ## Setup (5 minutes)
39
+
40
+ You'll use three MCP tools, in order. Each one takes about a minute.
41
+
42
+ ### Step 1: Register your app
43
+
44
+ \`\`\`
45
+ register_app(
46
+ service_name: "my-app",
47
+ display_name: "My App",
48
+ owner_email: "you@example.com",
49
+ description: "What your app does",
50
+ website: "https://myapp.com"
51
+ )
52
+ \`\`\`
53
+
54
+ This creates your app on tru and returns an **API key** (starts with \`tru_ak_\`). Save it — you'll need it for API calls. The API key is also your app's authentication for the REST API.
55
+
56
+ The \`service_name\` is your app's unique identifier on tru (lowercase, letters/numbers/hyphens).
57
+
58
+ ### Step 2: Connect your Stripe account
59
+
60
+ \`\`\`
61
+ connect_stripe(service_name: "my-app")
62
+ \`\`\`
63
+
64
+ This generates a URL. Open it in your browser, log into your existing Stripe account, and authorize the connection. That's it.
65
+
66
+ **What this does:**
67
+ - Links your Stripe account to receive tru payments
68
+ - Uses Stripe's standard Connect OAuth — secure, reversible, well-understood
69
+ - Your Stripe dashboard, payouts, refunds, disputes, Radar — all unchanged
70
+ - You can still charge customers directly outside of tru
71
+ - tru takes a small platform fee on each transaction; the rest goes straight to you
72
+
73
+ **If you don't have a Stripe account yet**, the OAuth flow will let you create one. But most developers already have one, and the whole point is that nothing about it changes.
74
+
75
+ ### Step 3: You're live
76
+
77
+ That's it. Your app can now:
78
+
79
+ - **Verify users** — \`check_identity(email)\` returns whether they're verified, plus risk signals
80
+ - **Request credentials** — \`request_credentials(email, service, fields)\` asks the user to share verified data
81
+ - **Charge users** — \`create_charge(email, amount_cents, description)\` creates a charge that the user approves
82
+ - **Issue virtual cards** — \`request_virtual_card(email, amount_cents)\` for agent purchases on other sites
83
+ - **Check risk** — every identity check includes risk level, score, card funding type, country, and fingerprint reuse
84
+
85
+ ---
86
+
87
+ ## Using risk signals
88
+
89
+ Every \`check_identity\` response includes:
90
+
91
+ \`\`\`json
92
+ {
93
+ "verified": true,
94
+ "email": "user@example.com",
95
+ "name": "Jane Doe",
96
+ "identity_verified": true,
97
+ "bank_linked": true,
98
+ "risk": {
99
+ "level": "low",
100
+ "score": 12,
101
+ "card_funding": "debit",
102
+ "card_country": "US",
103
+ "fingerprint_reuse": false
104
+ }
105
+ }
106
+ \`\`\`
107
+
108
+ **How to use this:**
109
+
110
+ | Signal | What it tells you | Example action |
111
+ |--------|-------------------|----------------|
112
+ | \`risk.level\` | Overall risk (low/medium/high/very_high) | Gate feature access |
113
+ | \`risk.score\` | Numeric Radar score (0-100, lower = safer) | Set free trial length |
114
+ | \`risk.card_funding\` | credit / debit / prepaid | Prepaid = higher fraud risk |
115
+ | \`risk.card_country\` | ISO country of the card | Flag mismatches with IP |
116
+ | \`risk.fingerprint_reuse\` | Same card used by multiple accounts | Block duplicate signups |
117
+ | \`identity_verified\` | Government ID verified via Stripe Identity | Require for high-value actions |
118
+ | \`bank_linked\` | User has linked a bank account | Higher trust signal |
119
+
120
+ These signals come from Stripe's Radar and Identity — the same fraud detection that processes billions of dollars in payments. You get them for free with every tru identity check.
121
+
122
+ ---
123
+
124
+ ## What's next
125
+
126
+ - **Set up webhooks** — get notified when charges are approved/rejected, credentials shared, etc.
127
+ - **Write an Agent Skill** — a SKILL.md that teaches AI agents how to use your app (tru hosts it for you)
128
+ - **Configure App Rules** — users can set per-app spending rules; you can set default limits on your side
129
+ - **Add "Login with tru"** — OAuth 2.0 flow for browser-based auth (see integration docs)
130
+
131
+ ## Quick reference
132
+
133
+ | Tool | Purpose |
134
+ |------|---------|
135
+ | \`get_started\` | This guide |
136
+ | \`register_app\` | Create your app, get API key |
137
+ | \`connect_stripe\` | Link your Stripe account |
138
+ | \`check_identity\` | Verify a user + get risk signals |
139
+ | \`request_credentials\` | Ask user to share verified data |
140
+ | \`check_request_status\` | Poll credential request status |
141
+ | \`create_charge\` | Charge a user (one-time or subscription) |
142
+ | \`check_charge_status\` | Poll charge status |
143
+ | \`request_virtual_card\` | Issue single-use card for agent purchases |
144
+ | \`discover_apps\` | Browse tru app directory |
145
+ | \`read_skill\` | Read an app's agent guide |
146
+ | \`initiate_oauth\` | Start OAuth login flow |
147
+ `;
148
+ return {
149
+ content: [{ type: "text", text: guide }],
150
+ };
151
+ },
152
+ };
153
+ //# sourceMappingURL=get_started.js.map
@@ -0,0 +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,0EAA0E;QAC1E,6EAA6E;QAC7E,0FAA0F;QAC1F,yEAAyE;QACzE,0DAA0D;IAC5D,WAAW,EAAE,EAAE;IACf,OAAO,EAAE,KAAK,EAAE,KAA4B,EAAE,EAAE;QAC9C,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyIjB,CAAC;QAEE,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;SAClD,CAAC;IACJ,CAAC;CACF,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tru-mcp",
3
- "version": "0.1.1",
4
- "description": "MCP server for tru — portable identity and billing for AI agents",
3
+ "version": "0.2.0",
4
+ "description": "MCP server for tru — auth, billing, and risk signals in one API",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "tru-mcp": "dist/index.js",