@fact-io/mcp 0.0.0-stage → 1.0.1
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 +67 -2
- package/bin/fact-mcp.mjs +159 -0
- package/package.json +32 -4
package/README.md
CHANGED
|
@@ -1,3 +1,68 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@fact-io/mcp`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Official Model Context Protocol (MCP) server for **[fact.io](https://fact.io)** — 7-lab autonomous AI fact-checking with permanent Ed25519-signed receipts and SHA-256 archived primary sources.
|
|
4
|
+
|
|
5
|
+
Every deep verification runs independently across 7 frontier AI labs (**Claude**, **GPT**, **Gemini**, **Grok**, **DeepSeek**, **Llama**, and **Mistral**) and returns a cryptographically signed verdict verifiable via [`https://fact.io/.well-known/jwks.json`](https://fact.io/.well-known/jwks.json).
|
|
6
|
+
|
|
7
|
+
## Quickstart (Remote Streamable HTTP — Zero Install)
|
|
8
|
+
|
|
9
|
+
Point any Streamable HTTP MCP client directly at:
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
https://fact.io/mcp
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Example `mcp_config.json` (Antigravity / Cursor / Claude):
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"mcpServers": {
|
|
20
|
+
"fact-io": {
|
|
21
|
+
"url": "https://fact.io/mcp"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Quickstart (Stdio CLI via `npx`)
|
|
28
|
+
|
|
29
|
+
Zero-config setup (works out of the box for all free tools):
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"mcpServers": {
|
|
34
|
+
"fact-io": {
|
|
35
|
+
"command": "npx",
|
|
36
|
+
"args": ["-y", "@fact-io/mcp"]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
To enable paid `verify_claim` calls using a prepaid USDT API key, add `"env": { "FACT_API_KEY": "fact_live_..." }` (or pay per call via Base USDC `x402`).
|
|
43
|
+
|
|
44
|
+
> **Free vs. Paid Tools:** `get_receipt` and `list_receipts` are **100% free**. Live `verify_claim` calls cost `$0.002` (`fast`) or `$0.008` (`deep` 7-lab consensus) via **Base USDC (`x402`)** or a 0%-fee prepaid **USDT (TRC-20 / ERC-20)** API key from [fact.io](https://fact.io/#x402).
|
|
45
|
+
|
|
46
|
+
## Exposed Tools
|
|
47
|
+
|
|
48
|
+
| Tool | Cost | Description |
|
|
49
|
+
| :--- | :--- | :--- |
|
|
50
|
+
| `verify_claim` | `$0.002` fast / `$0.008` deep | Verify a factual claim against primary web sources and 7-lab independent AI consensus. Returns an Ed25519-signed receipt with verdict, per-model reasoning, and SHA-256 source hashes. |
|
|
51
|
+
| `get_receipt` | Free | Fetch a canonical `fact.io/c/<slug>` verification receipt by slug, including per-model verdicts and primary source citations. |
|
|
52
|
+
| `list_receipts` | Free | List published `fact.io` verification receipts filtered optionally by verdict status (`verified`, `false`, `misleading`, `disputed`, `unverifiable`) or category (`ai`, `crypto`, `tech`, `finance`, `world`, `policy`, `science`). |
|
|
53
|
+
|
|
54
|
+
## CLI Options
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npx -y @fact-io/mcp --help
|
|
58
|
+
npx -y @fact-io/mcp --version
|
|
59
|
+
FACT_API_KEY=fact_live_... npx -y @fact-io/mcp --url https://fact.io/mcp
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Links
|
|
63
|
+
|
|
64
|
+
- **Website & Live 7-Lab Verifier:** https://fact.io
|
|
65
|
+
- **OpenAPI Spec:** https://fact.io/openapi.yaml
|
|
66
|
+
- **Ed25519 Public Keys (JWKS):** https://fact.io/.well-known/jwks.json
|
|
67
|
+
- **X (Autonomous Fact-Check Feed):** https://x.com/FactASI
|
|
68
|
+
- **Contact:** para@fact.io
|
package/bin/fact-mcp.mjs
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @fact-io/mcp — Zero-dependency stdio MCP bridge for fact.io.
|
|
4
|
+
*
|
|
5
|
+
* Connects any stdio MCP host (Claude Desktop, Cursor, Windsurf, Antigravity)
|
|
6
|
+
* to https://fact.io/mcp (or a custom FACT_MCP_URL / FACT_BASE_URL / --url).
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* npx -y @fact-io/mcp
|
|
10
|
+
* npx -y @fact-io/mcp --url https://fact.io/mcp
|
|
11
|
+
* FACT_API_KEY=fact_live_... npx -y @fact-io/mcp
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import readline from "node:readline";
|
|
15
|
+
|
|
16
|
+
const VERSION = "1.0.1";
|
|
17
|
+
|
|
18
|
+
if (process.argv.includes("--version") || process.argv.includes("-v")) {
|
|
19
|
+
process.stdout.write(`@fact-io/mcp v${VERSION}\n`);
|
|
20
|
+
process.exit(0);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (process.argv.includes("--help") || process.argv.includes("-h")) {
|
|
24
|
+
process.stdout.write(
|
|
25
|
+
`@fact-io/mcp v${VERSION} — stdio MCP bridge for https://fact.io/mcp\n\n` +
|
|
26
|
+
`Usage:\n` +
|
|
27
|
+
` npx -y @fact-io/mcp [--url https://fact.io/mcp] [--api-key fact_live_...]\n\n` +
|
|
28
|
+
`Environment:\n` +
|
|
29
|
+
` FACT_MCP_URL / FACT_BASE_URL Override remote endpoint (default: https://fact.io/mcp)\n` +
|
|
30
|
+
` FACT_API_KEY Optional prepaid API key for paid verify_claim calls\n`
|
|
31
|
+
);
|
|
32
|
+
process.exit(0);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function parseArg(flag, fallback) {
|
|
36
|
+
const idx = process.argv.indexOf(flag);
|
|
37
|
+
if (idx !== -1 && process.argv[idx + 1]) return process.argv[idx + 1];
|
|
38
|
+
const eq = process.argv.find((a) => a.startsWith(`${flag}=`));
|
|
39
|
+
if (eq) return eq.slice(flag.length + 1);
|
|
40
|
+
return fallback;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const rawUrl = String(
|
|
44
|
+
parseArg("--url", process.env.FACT_MCP_URL || process.env.FACT_BASE_URL || "https://fact.io/mcp")
|
|
45
|
+
).trim();
|
|
46
|
+
|
|
47
|
+
let ENDPOINT;
|
|
48
|
+
try {
|
|
49
|
+
const parsed = new URL(rawUrl);
|
|
50
|
+
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") {
|
|
51
|
+
throw new Error("URL must use https:// or http://");
|
|
52
|
+
}
|
|
53
|
+
const normalizedPath = parsed.pathname.replace(/\/+$/, "");
|
|
54
|
+
parsed.pathname = normalizedPath.endsWith("/mcp") ? normalizedPath : `${normalizedPath}/mcp`;
|
|
55
|
+
ENDPOINT = parsed.toString();
|
|
56
|
+
} catch (err) {
|
|
57
|
+
process.stderr.write(`Invalid --url "${rawUrl}": ${err.message}\n`);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const API_KEY = parseArg("--api-key", process.env.FACT_API_KEY || "");
|
|
62
|
+
|
|
63
|
+
function writeMessage(obj) {
|
|
64
|
+
process.stdout.write(JSON.stringify(obj) + "\n");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async function forwardJsonRpc(msg) {
|
|
68
|
+
const headers = {
|
|
69
|
+
"Content-Type": "application/json",
|
|
70
|
+
Accept: "application/json"
|
|
71
|
+
};
|
|
72
|
+
if (API_KEY) {
|
|
73
|
+
headers.Authorization = `Bearer ${API_KEY}`;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const res = await fetch(ENDPOINT, {
|
|
77
|
+
method: "POST",
|
|
78
|
+
headers,
|
|
79
|
+
body: JSON.stringify(msg),
|
|
80
|
+
signal:
|
|
81
|
+
typeof AbortSignal !== "undefined" && typeof AbortSignal.timeout === "function"
|
|
82
|
+
? AbortSignal.timeout(45000)
|
|
83
|
+
: undefined
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
if (res.status === 202 || res.status === 204) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const text = await res.text();
|
|
91
|
+
if (!res.ok) {
|
|
92
|
+
return {
|
|
93
|
+
jsonrpc: "2.0",
|
|
94
|
+
id: msg.id ?? null,
|
|
95
|
+
error: {
|
|
96
|
+
code: -32000,
|
|
97
|
+
message: `fact.io MCP endpoint returned HTTP ${res.status}: ${text.slice(0, 240)}`
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
try {
|
|
103
|
+
return JSON.parse(text);
|
|
104
|
+
} catch {
|
|
105
|
+
return {
|
|
106
|
+
jsonrpc: "2.0",
|
|
107
|
+
id: msg.id ?? null,
|
|
108
|
+
error: {
|
|
109
|
+
code: -32603,
|
|
110
|
+
message: "fact.io MCP endpoint returned invalid JSON"
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const rl = readline.createInterface({
|
|
117
|
+
input: process.stdin,
|
|
118
|
+
crlfDelay: Infinity
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
rl.on("line", async (line) => {
|
|
122
|
+
const trimmed = line.trim();
|
|
123
|
+
if (!trimmed) return;
|
|
124
|
+
let msg;
|
|
125
|
+
try {
|
|
126
|
+
msg = JSON.parse(trimmed);
|
|
127
|
+
} catch {
|
|
128
|
+
writeMessage({
|
|
129
|
+
jsonrpc: "2.0",
|
|
130
|
+
id: null,
|
|
131
|
+
error: { code: -32700, message: "Invalid JSON received on stdin" }
|
|
132
|
+
});
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (!msg || typeof msg !== "object" || Array.isArray(msg)) {
|
|
137
|
+
writeMessage({
|
|
138
|
+
jsonrpc: "2.0",
|
|
139
|
+
id: null,
|
|
140
|
+
error: { code: -32600, message: "Invalid JSON-RPC request object" }
|
|
141
|
+
});
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
try {
|
|
146
|
+
const reply = await forwardJsonRpc(msg);
|
|
147
|
+
if (reply && msg.id !== undefined) {
|
|
148
|
+
writeMessage(reply);
|
|
149
|
+
}
|
|
150
|
+
} catch (err) {
|
|
151
|
+
if (msg.id !== undefined) {
|
|
152
|
+
writeMessage({
|
|
153
|
+
jsonrpc: "2.0",
|
|
154
|
+
id: msg.id,
|
|
155
|
+
error: { code: -32603, message: err.message || "Network error calling fact.io MCP" }
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fact-io/mcp",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Official MCP server for fact.io — 7-lab autonomous AI fact-checking with Ed25519-signed receipts and SHA-256 archived sources.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"mcp": "bin/fact-mcp.mjs",
|
|
8
|
+
"fact-mcp": "bin/fact-mcp.mjs",
|
|
9
|
+
"fact-io-mcp": "bin/fact-mcp.mjs"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"bin/",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"mcp",
|
|
17
|
+
"model-context-protocol",
|
|
18
|
+
"fact-checking",
|
|
19
|
+
"verification",
|
|
20
|
+
"ed25519",
|
|
21
|
+
"ai-agents",
|
|
22
|
+
"x402",
|
|
23
|
+
"usdc",
|
|
24
|
+
"usdt"
|
|
25
|
+
],
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=20.0.0"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://fact.io"
|
|
34
|
+
}
|