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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 TrustSource
|
|
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/Procfile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
echo "web: npm start"
|
package/README.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Trustsource API
|
|
2
|
+
|
|
3
|
+
x402-powered intelligence APIs for AI agents. Pay per use, no API keys, no accounts.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
### 1. Install dependencies
|
|
8
|
+
```bash
|
|
9
|
+
npm install
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### 2. Configure environment
|
|
13
|
+
```bash
|
|
14
|
+
cp .env.example .env
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Open `.env` and set **at minimum**:
|
|
18
|
+
```
|
|
19
|
+
PAY_TO_ADDRESS=0xYourBaseWalletAddress
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Leave everything else as-is to run on **Base Sepolia testnet** (no real money).
|
|
23
|
+
|
|
24
|
+
### 3. Run the server
|
|
25
|
+
```bash
|
|
26
|
+
npm run dev
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
You should see the startup banner at `http://localhost:3000`.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Testing the x402 Flow
|
|
34
|
+
|
|
35
|
+
### Free endpoints (no payment needed)
|
|
36
|
+
```bash
|
|
37
|
+
curl http://localhost:3000/
|
|
38
|
+
curl http://localhost:3000/health
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Paid endpoint — what an unpaid agent sees
|
|
42
|
+
```bash
|
|
43
|
+
curl http://localhost:3000/trustscore?domain=example.com
|
|
44
|
+
# Returns HTTP 402 with payment instructions in the PAYMENT-REQUIRED header
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Paid endpoint — bypass payment for local dev testing
|
|
48
|
+
The x402 testnet facilitator at `https://facilitator.x402.org` accepts test payments.
|
|
49
|
+
To fully test the payment flow, use an x402 client with a funded testnet wallet.
|
|
50
|
+
|
|
51
|
+
Get Base Sepolia testnet ETH: https://sepolia.base.org/faucet
|
|
52
|
+
Get testnet USDC: https://faucet.circle.com (select Base Sepolia)
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Switching to Mainnet (Production)
|
|
57
|
+
|
|
58
|
+
1. In `.env`, change:
|
|
59
|
+
```
|
|
60
|
+
NETWORK=eip155:8453
|
|
61
|
+
FACILITATOR_URL=https://api.cdp.coinbase.com/platform/v2/x402
|
|
62
|
+
CDP_API_KEY_ID=your-key-id
|
|
63
|
+
CDP_API_KEY_SECRET=your-key-secret
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
2. Make sure your `PAY_TO_ADDRESS` Base wallet has some ETH for gas.
|
|
67
|
+
|
|
68
|
+
3. Your endpoints auto-list in the Bazaar/Agentic.Market after the first paid call clears.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## API Reference
|
|
73
|
+
|
|
74
|
+
### `GET /trustscore`
|
|
75
|
+
Returns a 0–100 trust score for any domain.
|
|
76
|
+
|
|
77
|
+
**Payment:** 0.003 USDC per call (via x402)
|
|
78
|
+
|
|
79
|
+
**Params:**
|
|
80
|
+
- `?domain=example.com` — bare domain
|
|
81
|
+
- `?url=https://example.com/some/path` — full URL (domain extracted)
|
|
82
|
+
|
|
83
|
+
**Response:**
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"domain": "example.com",
|
|
87
|
+
"score": 80,
|
|
88
|
+
"maxScore": 100,
|
|
89
|
+
"tier": "TRUSTED",
|
|
90
|
+
"breakdown": {
|
|
91
|
+
"domainAge": 30,
|
|
92
|
+
"tld": 20,
|
|
93
|
+
"dnsPresence": 30,
|
|
94
|
+
"registrar": 20
|
|
95
|
+
},
|
|
96
|
+
"details": {
|
|
97
|
+
"age": { "days": 9720, "label": "established (5+ years)", "created": "...", "expires": "..." },
|
|
98
|
+
"tld": ".com",
|
|
99
|
+
"dns": { "hasARecord": true, "hasMxRecord": true, "mxRecords": ["mail.example.com"] },
|
|
100
|
+
"registrar": "GoDaddy"
|
|
101
|
+
},
|
|
102
|
+
"meta": {
|
|
103
|
+
"checkedAt": "2026-05-22T12:00:00.000Z",
|
|
104
|
+
"apiVersion": "1.0",
|
|
105
|
+
"paidWith": "x402/USDC"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Tiers:**
|
|
111
|
+
| Score | Tier |
|
|
112
|
+
|-------|------|
|
|
113
|
+
| 75–100 | `TRUSTED` |
|
|
114
|
+
| 50–74 | `MODERATE` |
|
|
115
|
+
| 25–49 | `CAUTION` |
|
|
116
|
+
| 0–24 | `HIGH_RISK` |
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Project Structure
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
agentbrain/
|
|
124
|
+
├── src/
|
|
125
|
+
│ ├── server.ts # Express app + x402 middleware
|
|
126
|
+
│ └── routes/
|
|
127
|
+
│ └── trustscore.ts # Domain analysis logic
|
|
128
|
+
├── .env.example
|
|
129
|
+
├── .env # Your config (git-ignored)
|
|
130
|
+
├── package.json
|
|
131
|
+
└── tsconfig.json
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Roadmap
|
|
137
|
+
|
|
138
|
+
- [x] Phase 1: TrustScore API
|
|
139
|
+
- [ ] Phase 2: ResearchOracle API
|
|
140
|
+
- [ ] Phase 3: SkillForge API
|
|
141
|
+
- [ ] Phase 4: Bazaar/Agentic.Market listing
|
|
142
|
+
- [ ] Phase 5: Cloudflare Workers deployment
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Base Mainnet wallet private key (must hold USDC + a small amount of ETH for gas).
|
|
2
|
+
# Required. The server will exit on startup if not set.
|
|
3
|
+
# DO NOT commit this file with a real key.
|
|
4
|
+
WALLET_PRIVATE_KEY=0x00000000000000000000000000000000000000
|
|
5
|
+
# Optional — override the TrustSource API base URL (useful for self-hosting or testing).
|
|
6
|
+
# Defaults to https://api.trustsource.cc
|
|
7
|
+
# TRUSTSOURCE_API_URL=https://api.trustsource.cc
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# trustsource-mcp
|
|
2
|
+
|
|
3
|
+
MCP server exposing the [TrustSource](https://trustsource.cc) suite of x402-paid domain verification APIs to any MCP-compatible client (Claude Desktop, Claude Code, Cline, Continue, etc.).
|
|
4
|
+
|
|
5
|
+
Four tools, each settled per-call in USDC on Base Mainnet. No API keys, no signups, no accounts — just a wallet.
|
|
6
|
+
|
|
7
|
+
## Tools
|
|
8
|
+
|
|
9
|
+
| Tool | Cost | What it does |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| `trustsource_score` | $0.003 USDC | Domain trust score 0–100 (WHOIS age, TLD, DNS, registrar) |
|
|
12
|
+
| `trustsource_ssl` | $0.002 USDC | TLS certificate intelligence (chain, expiry, CA trust, TLS version) |
|
|
13
|
+
| `trustsource_headers` | $0.003 USDC | HTTP security header audit (A+ to F grade) |
|
|
14
|
+
| `trustsource_robots` | $0.002 USDC | robots.txt + AI bot policy across 24 known crawlers |
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install -g trustsource-mcp
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Or run without installing:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx -y trustsource-mcp
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Configure
|
|
29
|
+
|
|
30
|
+
The server needs a Base Mainnet wallet private key. The wallet must hold:
|
|
31
|
+
- A few cents of USDC (for paying per-call fees)
|
|
32
|
+
- A small amount of ETH (for gas)
|
|
33
|
+
|
|
34
|
+
Set the private key in your MCP client's environment, **not** in any committed file.
|
|
35
|
+
|
|
36
|
+
### Claude Desktop
|
|
37
|
+
|
|
38
|
+
Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"mcpServers": {
|
|
43
|
+
"trustsource": {
|
|
44
|
+
"command": "npx",
|
|
45
|
+
"args": ["-y", "trustsource-mcp"],
|
|
46
|
+
"env": {
|
|
47
|
+
"WALLET_PRIVATE_KEY": "0xYOUR_BASE_MAINNET_PRIVATE_KEY"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Restart Claude Desktop. The four tools appear automatically.
|
|
55
|
+
|
|
56
|
+
### Cline / Continue / other MCP clients
|
|
57
|
+
|
|
58
|
+
Add to your client's MCP server configuration:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"trustsource": {
|
|
63
|
+
"command": "npx",
|
|
64
|
+
"args": ["-y", "trustsource-mcp"],
|
|
65
|
+
"env": {
|
|
66
|
+
"WALLET_PRIVATE_KEY": "0x..."
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Environment variables
|
|
73
|
+
|
|
74
|
+
| Variable | Required | Default | Description |
|
|
75
|
+
|---|---|---|---|
|
|
76
|
+
| `WALLET_PRIVATE_KEY` | yes | — | Base Mainnet wallet private key with USDC + ETH for gas |
|
|
77
|
+
| `TRUSTSOURCE_API_URL` | no | `https://api.trustsource.cc` | Override the API base URL (useful for testing) |
|
|
78
|
+
|
|
79
|
+
## How it works
|
|
80
|
+
|
|
81
|
+
1. The MCP client calls a tool (e.g. `trustsource_score`).
|
|
82
|
+
2. This server makes an HTTP request to the corresponding TrustSource endpoint.
|
|
83
|
+
3. The API returns HTTP 402 with a `PAYMENT-REQUIRED` header.
|
|
84
|
+
4. `x402-fetch` signs an EIP-3009 USDC `transferWithAuthorization` for the exact amount.
|
|
85
|
+
5. The request is retried with the signed payment in `X-PAYMENT`.
|
|
86
|
+
6. The Coinbase Developer Platform facilitator settles on-chain.
|
|
87
|
+
7. The API returns the JSON response. The MCP client receives the result.
|
|
88
|
+
|
|
89
|
+
Total latency per call: typically 1–3 seconds including settlement.
|
|
90
|
+
|
|
91
|
+
## Cost discipline
|
|
92
|
+
|
|
93
|
+
If your agent is making many calls, deduplicate by domain client-side before invoking tools. The API caches responses (1 hour for `/trustscore` and `/sslcheck`, up to 12 hours for `/robots` and `/headers`), but the cache reduces latency, not price — every call costs the same regardless of whether it hits cache.
|
|
94
|
+
|
|
95
|
+
Worst-case full domain audit: `trustsource_score` + `trustsource_ssl` + `trustsource_headers` + `trustsource_robots` = $0.010 USDC.
|
|
96
|
+
|
|
97
|
+
## Build from source
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
git clone https://github.com/SurfEther/TrustSourceX402.git
|
|
101
|
+
cd trustsource/mcp-server
|
|
102
|
+
npm install
|
|
103
|
+
npm run build
|
|
104
|
+
npm start
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Links
|
|
108
|
+
|
|
109
|
+
- TrustSource site: https://trustsource.cc
|
|
110
|
+
- OpenAPI spec: https://api.trustsource.cc/openapi.json
|
|
111
|
+
- Discoverable in Bazaar: https://agentic.market
|
|
112
|
+
- Contact: hello@trustsource.cc
|
|
113
|
+
|
|
114
|
+
## License
|
|
115
|
+
|
|
116
|
+
MIT
|