trustsource 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/.vscode/settings.json +9 -0
- package/LICENSE +21 -0
- package/Procfile +1 -0
- package/README.md +142 -0
- package/mcp-server/.env.example +7 -0
- package/mcp-server/README.md +116 -0
- package/mcp-server/package-lock.json +1815 -0
- package/mcp-server/package.json +58 -0
- package/mcp-server/smithery.yaml +45 -0
- package/mcp-server/src/index.ts +171 -0
- package/mcp-server/tsconfig.json +19 -0
- package/package.json +35 -0
- package/public/index.html +954 -0
- package/railway.json +11 -0
- package/skills/trustsource-domain/skill.md +182 -0
- package/src/openapi.ts +660 -0
- package/src/routes/headers.ts +448 -0
- package/src/routes/robots.ts +455 -0
- package/src/routes/sslcheck.ts +408 -0
- package/src/routes/trustscore.ts +268 -0
- package/src/server.ts +318 -0
- package/src/types/whois-json.d.ts +4 -0
- package/tsconfig.json +13 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "trustsource-mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server exposing TrustSource x402-paid domain verification APIs (trust score, SSL check, security headers, robots.txt) to any MCP-compatible client.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"trustsource-mcp": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md",
|
|
13
|
+
".env.example",
|
|
14
|
+
"smithery.yaml"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"start": "node dist/index.js",
|
|
19
|
+
"dev": "tsx watch src/index.ts",
|
|
20
|
+
"prepublishOnly": "npm run build"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"mcp",
|
|
24
|
+
"model-context-protocol",
|
|
25
|
+
"x402",
|
|
26
|
+
"trustsource",
|
|
27
|
+
"domain-verification",
|
|
28
|
+
"ssl",
|
|
29
|
+
"trust-score",
|
|
30
|
+
"ai-agents",
|
|
31
|
+
"agentic-payments",
|
|
32
|
+
"base-mainnet",
|
|
33
|
+
"usdc"
|
|
34
|
+
],
|
|
35
|
+
"author": "TrustSource <hello@trustsource.cc>",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"homepage": "https://trustsource.cc",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "https://github.com/SurfEther/TrustSourceX402.git",
|
|
41
|
+
"directory": "mcp-server"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=18"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
48
|
+
"@x402/fetch": "^2.13.0",
|
|
49
|
+
"viem": "^2.50.4",
|
|
50
|
+
"zod": "^3.23.0",
|
|
51
|
+
"dotenv": "^16.4.5"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/node": "^20.14.0",
|
|
55
|
+
"tsx": "^4.15.1",
|
|
56
|
+
"typescript": "^5.4.5"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
startCommand:
|
|
2
|
+
type: stdio
|
|
3
|
+
configSchema:
|
|
4
|
+
type: object
|
|
5
|
+
required:
|
|
6
|
+
- walletPrivateKey
|
|
7
|
+
properties:
|
|
8
|
+
walletPrivateKey:
|
|
9
|
+
type: string
|
|
10
|
+
title: Wallet Private Key
|
|
11
|
+
description: >-
|
|
12
|
+
Base Mainnet wallet private key that holds USDC (for per-call fees) and
|
|
13
|
+
a small amount of ETH (for gas). Each TrustSource API call costs
|
|
14
|
+
$0.002–$0.003 USDC, settled atomically on Base via the x402 protocol.
|
|
15
|
+
format: password
|
|
16
|
+
apiUrl:
|
|
17
|
+
type: string
|
|
18
|
+
title: TrustSource API URL
|
|
19
|
+
description: Override the TrustSource API base URL. Leave default unless self-hosting.
|
|
20
|
+
default: https://api.trustsource.cc
|
|
21
|
+
commandFunction: |-
|
|
22
|
+
(config) => ({
|
|
23
|
+
command: 'npx',
|
|
24
|
+
args: ['-y', 'trustsource-mcp'],
|
|
25
|
+
env: {
|
|
26
|
+
WALLET_PRIVATE_KEY: config.walletPrivateKey,
|
|
27
|
+
TRUSTSOURCE_API_URL: config.apiUrl || 'https://api.trustsource.cc'
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
build:
|
|
31
|
+
dockerfile: ../Dockerfile
|
|
32
|
+
metadata:
|
|
33
|
+
name: TrustSource
|
|
34
|
+
description: >-
|
|
35
|
+
Four x402-paid domain verification tools for AI agents — trust scoring,
|
|
36
|
+
SSL/TLS certificate intelligence, HTTP security header audit, and
|
|
37
|
+
robots.txt + AI bot policy detection. Pays per call in USDC on Base
|
|
38
|
+
Mainnet. No API keys, no signups.
|
|
39
|
+
homepage: https://trustsource.cc
|
|
40
|
+
license: MIT
|
|
41
|
+
categories:
|
|
42
|
+
- security
|
|
43
|
+
- web
|
|
44
|
+
- verification
|
|
45
|
+
- x402
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TrustSource MCP Server
|
|
3
|
+
*
|
|
4
|
+
* Exposes the four TrustSource x402-paid HTTP APIs as MCP tools:
|
|
5
|
+
* - trustsource_score — domain trust scoring ($0.003 USDC)
|
|
6
|
+
* - trustsource_ssl — TLS/SSL certificate intelligence ($0.002 USDC)
|
|
7
|
+
* - trustsource_headers — HTTP security header audit ($0.003 USDC)
|
|
8
|
+
* - trustsource_robots — robots.txt + AI bot policy ($0.002 USDC)
|
|
9
|
+
*
|
|
10
|
+
* Payment is per-call in USDC on Base Mainnet via the x402 protocol.
|
|
11
|
+
* The caller's wallet (set via WALLET_PRIVATE_KEY) must hold USDC and
|
|
12
|
+
* a small amount of ETH for gas. No API keys.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import "dotenv/config";
|
|
16
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
17
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
18
|
+
import { x402Client, wrapFetchWithPayment } from "@x402/fetch";
|
|
19
|
+
import { registerExactEvmScheme } from "@x402/evm/exact/client";
|
|
20
|
+
import { privateKeyToAccount } from "viem/accounts";
|
|
21
|
+
import { z } from "zod";
|
|
22
|
+
|
|
23
|
+
// ─── Config ──────────────────────────────────────────────────────────────────
|
|
24
|
+
|
|
25
|
+
const BASE_URL =
|
|
26
|
+
process.env.TRUSTSOURCE_API_URL?.replace(/\/$/, "") ??
|
|
27
|
+
"https://api.trustsource.cc";
|
|
28
|
+
|
|
29
|
+
const PRIVATE_KEY = process.env.WALLET_PRIVATE_KEY;
|
|
30
|
+
|
|
31
|
+
if (!PRIVATE_KEY) {
|
|
32
|
+
// Write to stderr so it does not interfere with the stdio transport.
|
|
33
|
+
console.error(
|
|
34
|
+
"[trustsource-mcp] FATAL: WALLET_PRIVATE_KEY environment variable is required.\n" +
|
|
35
|
+
"Provide a Base Mainnet wallet private key that holds USDC and a small amount of ETH for gas.\n" +
|
|
36
|
+
"See https://trustsource.cc for funding instructions.",
|
|
37
|
+
);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const signer = privateKeyToAccount(PRIVATE_KEY as `0x${string}`);
|
|
42
|
+
const client = new x402Client();
|
|
43
|
+
registerExactEvmScheme(client, { signer });
|
|
44
|
+
const fetch402 = wrapFetchWithPayment(fetch, client);
|
|
45
|
+
|
|
46
|
+
// ─── Helpers ─────────────────────────────────────────────────────────────────
|
|
47
|
+
|
|
48
|
+
type ToolResult = {
|
|
49
|
+
content: { type: "text"; text: string }[];
|
|
50
|
+
isError?: boolean;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
async function callApi(path: string, params: Record<string, string>): Promise<ToolResult> {
|
|
54
|
+
const qs = new URLSearchParams(params).toString();
|
|
55
|
+
const url = `${BASE_URL}${path}?${qs}`;
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
const res = await fetch402(url, { method: "GET" });
|
|
59
|
+
const text = await res.text();
|
|
60
|
+
|
|
61
|
+
let parsed: unknown;
|
|
62
|
+
try {
|
|
63
|
+
parsed = JSON.parse(text);
|
|
64
|
+
} catch {
|
|
65
|
+
parsed = { raw: text, status: res.status };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (!res.ok) {
|
|
69
|
+
return {
|
|
70
|
+
isError: true,
|
|
71
|
+
content: [
|
|
72
|
+
{
|
|
73
|
+
type: "text",
|
|
74
|
+
text: `HTTP ${res.status} from ${path}:\n${JSON.stringify(parsed, null, 2)}`,
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
content: [{ type: "text", text: JSON.stringify(parsed, null, 2) }],
|
|
82
|
+
};
|
|
83
|
+
} catch (err) {
|
|
84
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
85
|
+
return {
|
|
86
|
+
isError: true,
|
|
87
|
+
content: [
|
|
88
|
+
{
|
|
89
|
+
type: "text",
|
|
90
|
+
text: `[trustsource-mcp] Request to ${path} failed: ${msg}`,
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// ─── Server ──────────────────────────────────────────────────────────────────
|
|
98
|
+
|
|
99
|
+
const server = new McpServer({
|
|
100
|
+
name: "trustsource",
|
|
101
|
+
version: "0.1.0",
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// Tool 1: TrustScore — domain trust scoring
|
|
105
|
+
server.tool(
|
|
106
|
+
"trustsource_score",
|
|
107
|
+
"Score a domain's overall trustworthiness (0–100) using WHOIS age, TLD risk class, DNS presence (A + MX records), and registrar reputation. Returns tier TRUSTED (75+) / MODERATE (50–74) / CAUTION (25–49) / HIGH_RISK (0–24). Use before transacting with, recommending, or following links to an unfamiliar domain. Cost: $0.003 USDC per call. Cached 1 hour server-side.",
|
|
108
|
+
{
|
|
109
|
+
domain: z
|
|
110
|
+
.string()
|
|
111
|
+
.min(1)
|
|
112
|
+
.max(253)
|
|
113
|
+
.describe("Domain to score, e.g. 'example.com' (do not include scheme or path)"),
|
|
114
|
+
},
|
|
115
|
+
async ({ domain }) => callApi("/trustscore", { domain }),
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
// Tool 2: SslCheck — TLS certificate intelligence
|
|
119
|
+
server.tool(
|
|
120
|
+
"trustsource_ssl",
|
|
121
|
+
"Perform a live TLS handshake to a domain and return SSL/TLS certificate intelligence: chain validity, trusted root CA detection, expiry date and days remaining, signature algorithm, TLS protocol version, and cipher quality. Returns 0–100 score and tier VALID / EXPIRING / WEAK / EXPIRED / UNTRUSTED / INVALID. Use before sending credentials, posting forms, downloading code, or making any HTTPS request to a domain you do not fully trust. Cost: $0.002 USDC per call. Cached 1 hour server-side.",
|
|
122
|
+
{
|
|
123
|
+
domain: z
|
|
124
|
+
.string()
|
|
125
|
+
.min(1)
|
|
126
|
+
.max(253)
|
|
127
|
+
.describe("Domain to check, e.g. 'example.com'"),
|
|
128
|
+
},
|
|
129
|
+
async ({ domain }) => callApi("/sslcheck", { domain }),
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
// Tool 3: Headers — HTTP security header audit
|
|
133
|
+
server.tool(
|
|
134
|
+
"trustsource_headers",
|
|
135
|
+
"Audit a URL's HTTP security headers and return a defense-in-depth letter grade A+ through F. Checks HSTS (Strict-Transport-Security), Content-Security-Policy, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, and Cross-Origin-* headers. Use when crawling, embedding, building integrations against, or auditing a site. Note: many legitimate marketing sites grade F — this measures hardening, not active vulnerabilities. Cost: $0.003 USDC per call. Cached up to 12 hours server-side.",
|
|
136
|
+
{
|
|
137
|
+
url: z
|
|
138
|
+
.string()
|
|
139
|
+
.min(1)
|
|
140
|
+
.max(2048)
|
|
141
|
+
.describe("Full URL to audit, e.g. 'https://example.com'"),
|
|
142
|
+
},
|
|
143
|
+
async ({ url }) => callApi("/headers", { url }),
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
// Tool 4: Robots — robots.txt + AI bot policy
|
|
147
|
+
server.tool(
|
|
148
|
+
"trustsource_robots",
|
|
149
|
+
"Fetch and parse a domain's robots.txt, with policy detection across 24 known AI crawlers (GPTBot, ClaudeBot, PerplexityBot, Google-Extended, CCBot, Bytespider, etc.). Returns tier OPEN / SELECTIVE / BLOCKED_AI / BLOCKED_ALL / NO_ROBOTS_TXT. Use BEFORE any crawling, scraping, RAG ingestion, training-data collection, or page summarization. If tier is BLOCKED_AI or BLOCKED_ALL the agent should refuse to crawl. Cost: $0.002 USDC per call. Cached up to 12 hours server-side.",
|
|
150
|
+
{
|
|
151
|
+
domain: z
|
|
152
|
+
.string()
|
|
153
|
+
.min(1)
|
|
154
|
+
.max(253)
|
|
155
|
+
.describe("Domain to check, e.g. 'example.com'"),
|
|
156
|
+
},
|
|
157
|
+
async ({ domain }) => callApi("/robots", { domain }),
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
// ─── Boot ────────────────────────────────────────────────────────────────────
|
|
161
|
+
|
|
162
|
+
async function main() {
|
|
163
|
+
const transport = new StdioServerTransport();
|
|
164
|
+
await server.connect(transport);
|
|
165
|
+
console.error(`[trustsource-mcp] Connected. Buyer wallet: ${signer.address}`);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
main().catch((err) => {
|
|
169
|
+
console.error("[trustsource-mcp] FATAL:", err);
|
|
170
|
+
process.exit(1);
|
|
171
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"allowSyntheticDefaultImports": true,
|
|
8
|
+
"strict": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"types": ["node"],
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"outDir": "dist",
|
|
13
|
+
"rootDir": "src",
|
|
14
|
+
"declaration": false,
|
|
15
|
+
"sourceMap": false
|
|
16
|
+
},
|
|
17
|
+
"include": ["src/**/*"],
|
|
18
|
+
"exclude": ["node_modules", "dist"]
|
|
19
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "trustsource",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "x402-powered intelligence APIs for AI agents",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "tsx watch src/server.ts",
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"start": "node dist/server.js"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@coinbase/x402": "^2.1.0",
|
|
13
|
+
"@x402/core": "latest",
|
|
14
|
+
"@x402/evm": "latest",
|
|
15
|
+
"@x402/express": "^2.13.0",
|
|
16
|
+
"@x402/extensions": "latest",
|
|
17
|
+
"@x402/fetch": "^2.13.0",
|
|
18
|
+
"cors": "^2.8.5",
|
|
19
|
+
"dotenv": "^16.4.5",
|
|
20
|
+
"express": "^4.18.2",
|
|
21
|
+
"express-rate-limit": "^8.5.2",
|
|
22
|
+
"viem": "^2.50.4",
|
|
23
|
+
"whois-json": "^2.0.4"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/cors": "^2.8.17",
|
|
27
|
+
"@types/express": "^4.17.21",
|
|
28
|
+
"@types/node": "^20.14.0",
|
|
29
|
+
"tsx": "^4.15.1",
|
|
30
|
+
"typescript": "^5.4.5"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18"
|
|
34
|
+
}
|
|
35
|
+
}
|