tru-mcp 0.1.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/LICENSE +21 -0
- package/README.md +76 -0
- package/dist/api-client.d.ts +107 -0
- package/dist/api-client.js +75 -0
- package/dist/api-client.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/init.d.ts +2 -0
- package/dist/init.js +155 -0
- package/dist/init.js.map +1 -0
- package/dist/tools/check_charge_status.d.ts +23 -0
- package/dist/tools/check_charge_status.js +60 -0
- package/dist/tools/check_charge_status.js.map +1 -0
- package/dist/tools/check_identity.d.ts +23 -0
- package/dist/tools/check_identity.js +56 -0
- package/dist/tools/check_identity.js.map +1 -0
- package/dist/tools/check_request_status.d.ts +23 -0
- package/dist/tools/check_request_status.js +87 -0
- package/dist/tools/check_request_status.js.map +1 -0
- package/dist/tools/create_charge.d.ts +46 -0
- package/dist/tools/create_charge.js +135 -0
- package/dist/tools/create_charge.js.map +1 -0
- package/dist/tools/discover_apps.d.ts +18 -0
- package/dist/tools/discover_apps.js +56 -0
- package/dist/tools/discover_apps.js.map +1 -0
- package/dist/tools/initiate_oauth.d.ts +23 -0
- package/dist/tools/initiate_oauth.js +75 -0
- package/dist/tools/initiate_oauth.js.map +1 -0
- package/dist/tools/read_skill.d.ts +23 -0
- package/dist/tools/read_skill.js +50 -0
- package/dist/tools/read_skill.js.map +1 -0
- package/dist/tools/register_app.d.ts +35 -0
- package/dist/tools/register_app.js +83 -0
- package/dist/tools/register_app.js.map +1 -0
- package/dist/tools/request_credentials.d.ts +27 -0
- package/dist/tools/request_credentials.js +63 -0
- package/dist/tools/request_credentials.js.map +1 -0
- package/dist/tools/request_virtual_card.d.ts +33 -0
- package/dist/tools/request_virtual_card.js +124 -0
- package/dist/tools/request_virtual_card.js.map +1 -0
- package/package.json +46 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 David Wurtz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# tru MCP Server
|
|
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.
|
|
4
|
+
|
|
5
|
+
## Quick Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx tru-mcp init
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This detects your MCP client (Claude Code, Claude Desktop, Cursor) and writes the config automatically.
|
|
12
|
+
|
|
13
|
+
### Manual Config
|
|
14
|
+
|
|
15
|
+
Add to your `.mcp.json` (Claude Code) or equivalent:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"mcpServers": {
|
|
20
|
+
"tru": {
|
|
21
|
+
"command": "npx",
|
|
22
|
+
"args": ["-y", "tru-mcp"],
|
|
23
|
+
"env": {
|
|
24
|
+
"TRU_API_URL": "https://tru-by29.onrender.com",
|
|
25
|
+
"TRU_API_KEY": "your_api_key_here"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Environment Variables
|
|
33
|
+
|
|
34
|
+
| Variable | Required | Description |
|
|
35
|
+
|----------|----------|-------------|
|
|
36
|
+
| `TRU_API_KEY` | Yes | Your tru API key (starts with `tru_ak_`) |
|
|
37
|
+
| `TRU_API_URL` | No | tru server URL (default: `https://tru-by29.onrender.com`) |
|
|
38
|
+
|
|
39
|
+
## Tools
|
|
40
|
+
|
|
41
|
+
| Tool | Description |
|
|
42
|
+
|------|-------------|
|
|
43
|
+
| `check_identity` | Check if a user has a verified tru identity |
|
|
44
|
+
| `request_credentials` | Request verified credential data from a user's vault |
|
|
45
|
+
| `check_request_status` | Poll the status of a credential request |
|
|
46
|
+
| `create_charge` | Create a direct charge or subscription |
|
|
47
|
+
| `check_charge_status` | Check the status of a charge request |
|
|
48
|
+
| `request_virtual_card` | Issue a single-use virtual card for agent purchases |
|
|
49
|
+
| `discover_apps` | Browse registered apps on the tru platform |
|
|
50
|
+
| `read_skill` | Read an app's agent skill guide |
|
|
51
|
+
| `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
|
+
|
|
54
|
+
## Example Agent Conversation
|
|
55
|
+
|
|
56
|
+
```
|
|
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
|
+
|
|
62
|
+
Agent: I'll request your credentials for signup.
|
|
63
|
+
→ request_credentials(email: "user@example.com", fields: ["name", "email"])
|
|
64
|
+
⏳ Pending — approve on your tru dashboard
|
|
65
|
+
|
|
66
|
+
Agent: → check_request_status(request_id: "req_abc123")
|
|
67
|
+
✓ Approved — got name and email
|
|
68
|
+
|
|
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
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
MIT
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
interface CheckIdentityResponse {
|
|
2
|
+
verified: boolean;
|
|
3
|
+
email?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
identity_verified?: boolean;
|
|
6
|
+
bank_linked?: boolean;
|
|
7
|
+
vault_status?: string;
|
|
8
|
+
reason?: string;
|
|
9
|
+
risk?: {
|
|
10
|
+
level: string;
|
|
11
|
+
score: number | null;
|
|
12
|
+
card_funding: string | null;
|
|
13
|
+
card_country: string | null;
|
|
14
|
+
fingerprint_reuse: boolean;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
interface CredentialRequest {
|
|
18
|
+
id: string;
|
|
19
|
+
user_email: string;
|
|
20
|
+
requesting_service: string;
|
|
21
|
+
requested_fields: string[];
|
|
22
|
+
status: "pending" | "approved" | "rejected";
|
|
23
|
+
created_at: string;
|
|
24
|
+
updated_at?: string;
|
|
25
|
+
vault_data?: Record<string, unknown>;
|
|
26
|
+
}
|
|
27
|
+
export declare function checkIdentity(email: string): Promise<CheckIdentityResponse>;
|
|
28
|
+
export declare function requestCredentials(email: string, service: string, fields: string[]): Promise<CredentialRequest>;
|
|
29
|
+
export declare function getRequestStatus(id: string): Promise<CredentialRequest>;
|
|
30
|
+
export interface ChargeResponse {
|
|
31
|
+
id: string;
|
|
32
|
+
status: "pending" | "approved" | "rejected";
|
|
33
|
+
type: string;
|
|
34
|
+
amount_cents: number;
|
|
35
|
+
currency: string;
|
|
36
|
+
description?: string;
|
|
37
|
+
rule_evaluation?: {
|
|
38
|
+
allowed: boolean;
|
|
39
|
+
action: string;
|
|
40
|
+
reason?: string;
|
|
41
|
+
};
|
|
42
|
+
[key: string]: unknown;
|
|
43
|
+
}
|
|
44
|
+
export declare function createCharge(email: string, amountCents: number, description?: string, type?: string, interval?: string, currency?: string, paymentMode?: string, action?: string): Promise<ChargeResponse>;
|
|
45
|
+
export interface AgentCardResponse {
|
|
46
|
+
status: "issued" | "escalated";
|
|
47
|
+
charge_request_id: string;
|
|
48
|
+
message?: string;
|
|
49
|
+
virtual_card?: {
|
|
50
|
+
virtualCardId: string;
|
|
51
|
+
number: string;
|
|
52
|
+
exp_month: number;
|
|
53
|
+
exp_year: number;
|
|
54
|
+
cvc: string;
|
|
55
|
+
last4: string;
|
|
56
|
+
brand: string;
|
|
57
|
+
};
|
|
58
|
+
rule_evaluation?: {
|
|
59
|
+
allowed: boolean;
|
|
60
|
+
action: string;
|
|
61
|
+
reason?: string;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export interface AppLookupResponse {
|
|
65
|
+
status: "registered" | "not_found";
|
|
66
|
+
app?: {
|
|
67
|
+
id: string;
|
|
68
|
+
service_name: string;
|
|
69
|
+
display_name: string;
|
|
70
|
+
redirect_uris: string[];
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export declare function lookupAppByServiceName(serviceName: string): Promise<AppLookupResponse>;
|
|
74
|
+
export interface RegisterAppParams {
|
|
75
|
+
service_name: string;
|
|
76
|
+
display_name: string;
|
|
77
|
+
owner_email: string;
|
|
78
|
+
description?: string;
|
|
79
|
+
website?: string;
|
|
80
|
+
allowed_fields?: string[];
|
|
81
|
+
redirect_uris?: string[];
|
|
82
|
+
}
|
|
83
|
+
export interface RegisterAppResponse {
|
|
84
|
+
app: {
|
|
85
|
+
id: string;
|
|
86
|
+
service_name: string;
|
|
87
|
+
display_name: string;
|
|
88
|
+
owner_email: string;
|
|
89
|
+
status: string;
|
|
90
|
+
};
|
|
91
|
+
api_key: string;
|
|
92
|
+
}
|
|
93
|
+
export declare function registerApp(params: RegisterAppParams): Promise<RegisterAppResponse>;
|
|
94
|
+
export interface ChargeStatusResponse {
|
|
95
|
+
id: string;
|
|
96
|
+
status: "pending" | "approved" | "rejected" | "cancelled" | "completed";
|
|
97
|
+
type: string;
|
|
98
|
+
amount_cents: number;
|
|
99
|
+
currency: string;
|
|
100
|
+
description?: string;
|
|
101
|
+
created_at: string;
|
|
102
|
+
updated_at?: string;
|
|
103
|
+
[key: string]: unknown;
|
|
104
|
+
}
|
|
105
|
+
export declare function getChargeStatus(id: string): Promise<ChargeStatusResponse>;
|
|
106
|
+
export declare function requestAgentCard(email: string, amountCents: number, description?: string, targetService?: string, currency?: string, action?: string): Promise<AgentCardResponse>;
|
|
107
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
const BASE_URL = process.env.TRU_API_URL || "http://localhost:3000";
|
|
2
|
+
const API_KEY = process.env.TRU_API_KEY || "";
|
|
3
|
+
async function request(path, options = {}) {
|
|
4
|
+
const url = `${BASE_URL}${path}`;
|
|
5
|
+
const res = await fetch(url, {
|
|
6
|
+
...options,
|
|
7
|
+
headers: {
|
|
8
|
+
"Content-Type": "application/json",
|
|
9
|
+
"X-API-Key": API_KEY,
|
|
10
|
+
...options.headers,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
if (!res.ok) {
|
|
14
|
+
const body = await res.text();
|
|
15
|
+
throw new Error(`API error ${res.status}: ${body}`);
|
|
16
|
+
}
|
|
17
|
+
return res.json();
|
|
18
|
+
}
|
|
19
|
+
export async function checkIdentity(email) {
|
|
20
|
+
return (await request(`/api/credentials/check/${encodeURIComponent(email)}`));
|
|
21
|
+
}
|
|
22
|
+
export async function requestCredentials(email, service, fields) {
|
|
23
|
+
return (await request("/api/credentials", {
|
|
24
|
+
method: "POST",
|
|
25
|
+
body: JSON.stringify({
|
|
26
|
+
email,
|
|
27
|
+
service,
|
|
28
|
+
fields,
|
|
29
|
+
}),
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
export async function getRequestStatus(id) {
|
|
33
|
+
return (await request(`/api/credentials/${encodeURIComponent(id)}`));
|
|
34
|
+
}
|
|
35
|
+
export async function createCharge(email, amountCents, description, type, interval, currency, paymentMode, action) {
|
|
36
|
+
return (await request("/api/billing/charges", {
|
|
37
|
+
method: "POST",
|
|
38
|
+
body: JSON.stringify({
|
|
39
|
+
email,
|
|
40
|
+
amount_cents: amountCents,
|
|
41
|
+
currency: currency || "usd",
|
|
42
|
+
description,
|
|
43
|
+
type: type || "one_time",
|
|
44
|
+
interval,
|
|
45
|
+
payment_mode: paymentMode || "direct",
|
|
46
|
+
action,
|
|
47
|
+
}),
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
export async function lookupAppByServiceName(serviceName) {
|
|
51
|
+
return (await request(`/api/apps/by-service/${encodeURIComponent(serviceName)}`));
|
|
52
|
+
}
|
|
53
|
+
export async function registerApp(params) {
|
|
54
|
+
return (await request("/api/apps/register", {
|
|
55
|
+
method: "POST",
|
|
56
|
+
body: JSON.stringify(params),
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
export async function getChargeStatus(id) {
|
|
60
|
+
return (await request(`/api/billing/charges/${encodeURIComponent(id)}`));
|
|
61
|
+
}
|
|
62
|
+
export async function requestAgentCard(email, amountCents, description, targetService, currency, action) {
|
|
63
|
+
return (await request("/api/billing/agent-card", {
|
|
64
|
+
method: "POST",
|
|
65
|
+
body: JSON.stringify({
|
|
66
|
+
email,
|
|
67
|
+
amount_cents: amountCents,
|
|
68
|
+
currency: currency || "usd",
|
|
69
|
+
description,
|
|
70
|
+
target_service: targetService,
|
|
71
|
+
action,
|
|
72
|
+
}),
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=api-client.js.map
|
|
@@ -0,0 +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;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,EAAE,CAAC,CAA0B,CAAC;AACzG,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,KAAa,EACb,OAAe,EACf,MAAgB;IAEhB,OAAO,CAAC,MAAM,OAAO,CAAC,kBAAkB,EAAE;QACxC,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YAC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CAAC,CAAyB,CAAC;AACnG,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/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { checkIdentityTool } from "./tools/check_identity.js";
|
|
5
|
+
import { requestCredentialsTool } from "./tools/request_credentials.js";
|
|
6
|
+
import { checkRequestStatusTool } from "./tools/check_request_status.js";
|
|
7
|
+
import { requestVirtualCardTool } from "./tools/request_virtual_card.js";
|
|
8
|
+
import { discoverAppsTool } from "./tools/discover_apps.js";
|
|
9
|
+
import { readSkillTool } from "./tools/read_skill.js";
|
|
10
|
+
import { createChargeTool } from "./tools/create_charge.js";
|
|
11
|
+
import { checkChargeStatusTool } from "./tools/check_charge_status.js";
|
|
12
|
+
import { registerAppTool } from "./tools/register_app.js";
|
|
13
|
+
import { initiateOAuthTool } from "./tools/initiate_oauth.js";
|
|
14
|
+
const server = new McpServer({
|
|
15
|
+
name: "tru-identity",
|
|
16
|
+
version: "0.1.0",
|
|
17
|
+
});
|
|
18
|
+
// Register tools
|
|
19
|
+
server.tool(checkIdentityTool.name, checkIdentityTool.description, checkIdentityTool.inputSchema, checkIdentityTool.handler);
|
|
20
|
+
server.tool(requestCredentialsTool.name, requestCredentialsTool.description, requestCredentialsTool.inputSchema, requestCredentialsTool.handler);
|
|
21
|
+
server.tool(checkRequestStatusTool.name, checkRequestStatusTool.description, checkRequestStatusTool.inputSchema, checkRequestStatusTool.handler);
|
|
22
|
+
server.tool(requestVirtualCardTool.name, requestVirtualCardTool.description, requestVirtualCardTool.inputSchema, requestVirtualCardTool.handler);
|
|
23
|
+
server.tool(discoverAppsTool.name, discoverAppsTool.description, discoverAppsTool.inputSchema, discoverAppsTool.handler);
|
|
24
|
+
server.tool(readSkillTool.name, readSkillTool.description, readSkillTool.inputSchema, readSkillTool.handler);
|
|
25
|
+
server.tool(createChargeTool.name, createChargeTool.description, createChargeTool.inputSchema, createChargeTool.handler);
|
|
26
|
+
server.tool(checkChargeStatusTool.name, checkChargeStatusTool.description, checkChargeStatusTool.inputSchema, checkChargeStatusTool.handler);
|
|
27
|
+
server.tool(registerAppTool.name, registerAppTool.description, registerAppTool.inputSchema, registerAppTool.handler);
|
|
28
|
+
server.tool(initiateOAuthTool.name, initiateOAuthTool.description, initiateOAuthTool.inputSchema, initiateOAuthTool.handler);
|
|
29
|
+
async function main() {
|
|
30
|
+
const transport = new StdioServerTransport();
|
|
31
|
+
await server.connect(transport);
|
|
32
|
+
console.error("tru-identity MCP server running on stdio");
|
|
33
|
+
}
|
|
34
|
+
main().catch((err) => {
|
|
35
|
+
console.error("Fatal error:", err);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC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|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createInterface } from "node:readline/promises";
|
|
3
|
+
import { stdin, stdout } from "node:process";
|
|
4
|
+
import { readFile, writeFile, access } from "node:fs/promises";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { homedir } from "node:os";
|
|
7
|
+
const DEFAULT_URL = "https://tru-by29.onrender.com";
|
|
8
|
+
function detectTargets() {
|
|
9
|
+
const targets = [];
|
|
10
|
+
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
|
+
const home = homedir();
|
|
18
|
+
const platform = process.platform;
|
|
19
|
+
if (platform === "darwin") {
|
|
20
|
+
targets.push({
|
|
21
|
+
name: "Claude Desktop",
|
|
22
|
+
path: join(home, "Library", "Application Support", "Claude", "claude_desktop_config.json"),
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
else if (platform === "win32") {
|
|
26
|
+
targets.push({
|
|
27
|
+
name: "Claude Desktop",
|
|
28
|
+
path: join(home, "AppData", "Roaming", "Claude", "claude_desktop_config.json"),
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
targets.push({
|
|
33
|
+
name: "Claude Desktop",
|
|
34
|
+
path: join(home, ".config", "Claude", "claude_desktop_config.json"),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
// Cursor — .cursor/mcp.json in current directory
|
|
38
|
+
targets.push({
|
|
39
|
+
name: "Cursor",
|
|
40
|
+
path: join(cwd, ".cursor", "mcp.json"),
|
|
41
|
+
});
|
|
42
|
+
return targets;
|
|
43
|
+
}
|
|
44
|
+
async function fileExists(path) {
|
|
45
|
+
try {
|
|
46
|
+
await access(path);
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async function readJsonFile(path) {
|
|
54
|
+
try {
|
|
55
|
+
const raw = await readFile(path, "utf-8");
|
|
56
|
+
return JSON.parse(raw);
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
return {};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function buildTruEntry(apiUrl, apiKey) {
|
|
63
|
+
return {
|
|
64
|
+
command: "npx",
|
|
65
|
+
args: ["-y", "tru-mcp"],
|
|
66
|
+
env: {
|
|
67
|
+
TRU_API_URL: apiUrl,
|
|
68
|
+
TRU_API_KEY: apiKey,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
async function main() {
|
|
73
|
+
const rl = createInterface({ input: stdin, output: stdout });
|
|
74
|
+
console.log("\n tru MCP Server Setup\n");
|
|
75
|
+
// Prompt for config values
|
|
76
|
+
const apiUrl = (await rl.question(` tru API URL [${DEFAULT_URL}]: `)).trim() || DEFAULT_URL;
|
|
77
|
+
const apiKey = (await rl.question(" tru API Key: ")).trim();
|
|
78
|
+
if (!apiKey) {
|
|
79
|
+
console.log("\n Error: API key is required.\n");
|
|
80
|
+
rl.close();
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
// Detect available targets
|
|
84
|
+
const targets = detectTargets();
|
|
85
|
+
const existing = [];
|
|
86
|
+
const creatable = [];
|
|
87
|
+
for (const t of targets) {
|
|
88
|
+
if (await fileExists(t.path)) {
|
|
89
|
+
existing.push(t);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
// For Claude Code, always offer to create .mcp.json
|
|
93
|
+
// For others, only offer if the parent dir exists
|
|
94
|
+
if (t.name === "Claude Code") {
|
|
95
|
+
creatable.push(t);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const available = [...existing, ...creatable];
|
|
100
|
+
if (available.length === 0) {
|
|
101
|
+
// No config files found — print manual snippet
|
|
102
|
+
console.log("\n No MCP client config files detected. Add this to your config:\n");
|
|
103
|
+
printManualConfig(apiUrl, apiKey);
|
|
104
|
+
rl.close();
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
// Show detected targets
|
|
108
|
+
console.log("\n Detected MCP clients:");
|
|
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}`);
|
|
138
|
+
}
|
|
139
|
+
console.log("\n Done! Restart your MCP client to connect.\n");
|
|
140
|
+
rl.close();
|
|
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();
|
|
150
|
+
}
|
|
151
|
+
main().catch((err) => {
|
|
152
|
+
console.error("Error:", err);
|
|
153
|
+
process.exit(1);
|
|
154
|
+
});
|
|
155
|
+
//# sourceMappingURL=init.js.map
|
package/dist/init.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC7C,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;AAElC,MAAM,WAAW,GAAG,+BAA+B,CAAC;AAepD,SAAS,aAAa;IACpB,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAE1B,+CAA+C;IAC/C,OAAO,CAAC,IAAI,CAAC;QACX,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC;KAC7B,CAAC,CAAC;IAEH,iBAAiB;IACjB,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAClC,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC1B,OAAO,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,qBAAqB,EAAE,QAAQ,EAAE,4BAA4B,CAAC;S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CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const checkChargeStatusTool: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
charge_id: z.ZodString;
|
|
7
|
+
};
|
|
8
|
+
handler: (args: {
|
|
9
|
+
charge_id: 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,60 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { getChargeStatus } from "../api-client.js";
|
|
3
|
+
export const checkChargeStatusTool = {
|
|
4
|
+
name: "check_charge_status",
|
|
5
|
+
description: "Check the status of a charge or subscription request. Returns pending, approved, rejected, or cancelled.",
|
|
6
|
+
inputSchema: {
|
|
7
|
+
charge_id: z
|
|
8
|
+
.string()
|
|
9
|
+
.describe("The charge request ID to check"),
|
|
10
|
+
},
|
|
11
|
+
handler: async (args) => {
|
|
12
|
+
try {
|
|
13
|
+
const result = await getChargeStatus(args.charge_id);
|
|
14
|
+
const amount = (result.amount_cents / 100).toFixed(2);
|
|
15
|
+
const currency = (result.currency || "usd").toUpperCase();
|
|
16
|
+
const lines = [
|
|
17
|
+
`Status: ${result.status}`,
|
|
18
|
+
`Amount: $${amount} ${currency}`,
|
|
19
|
+
`Type: ${result.type}`,
|
|
20
|
+
`Charge ID: ${result.id}`,
|
|
21
|
+
];
|
|
22
|
+
if (result.description) {
|
|
23
|
+
lines.push(`Description: ${result.description}`);
|
|
24
|
+
}
|
|
25
|
+
if (result.created_at) {
|
|
26
|
+
lines.push(`Created: ${result.created_at}`);
|
|
27
|
+
}
|
|
28
|
+
if (result.updated_at) {
|
|
29
|
+
lines.push(`Updated: ${result.updated_at}`);
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
37
|
+
if (message.includes("404")) {
|
|
38
|
+
return {
|
|
39
|
+
content: [
|
|
40
|
+
{
|
|
41
|
+
type: "text",
|
|
42
|
+
text: `Charge not found. Check that the charge_id is correct.`,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
isError: true,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
content: [
|
|
50
|
+
{
|
|
51
|
+
type: "text",
|
|
52
|
+
text: `Error checking charge status: ${message}`,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
isError: true,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=check_charge_status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check_charge_status.js","sourceRoot":"","sources":["../../src/tools/check_charge_status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EACT,0GAA0G;IAC5G,WAAW,EAAE;QACX,SAAS,EAAE,CAAC;aACT,MAAM,EAAE;aACR,QAAQ,CAAC,gCAAgC,CAAC;KAC9C;IACD,OAAO,EAAE,KAAK,EAAE,IAA2B,EAAE,EAAE;QAC7C,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,eA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E,MAAe;4BACrB,IAAI,EAAE,wDAAwD;yBAC/D;qBACF;oBACD,OAAO,EAAE,IAAI;iBACd,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,iCAAiC,OAAO,EAAE;qBACjD;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const checkIdentityTool: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
email: z.ZodString;
|
|
7
|
+
};
|
|
8
|
+
handler: (args: {
|
|
9
|
+
email: 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
|
+
};
|