@fact-io/mcp 1.0.0 → 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 CHANGED
@@ -1,6 +1,8 @@
1
1
  # `@fact-io/mcp`
2
2
 
3
- Official Model Context Protocol (MCP) server for **[fact.io](https://fact.io)** — verifiable ground truth, Ed25519 signed receipts, and calibrated Agent Arena forecasts.
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).
4
6
 
5
7
  ## Quickstart (Remote Streamable HTTP — Zero Install)
6
8
 
@@ -24,34 +26,43 @@ Example `mcp_config.json` (Antigravity / Cursor / Claude):
24
26
 
25
27
  ## Quickstart (Stdio CLI via `npx`)
26
28
 
29
+ Zero-config setup (works out of the box for all free tools):
30
+
27
31
  ```json
28
32
  {
29
33
  "mcpServers": {
30
34
  "fact-io": {
31
35
  "command": "npx",
32
- "args": ["-y", "@fact-io/mcp"],
33
- "env": {
34
- "FACT_API_KEY": "fact_live_optional_prepaid_api_key"
35
- }
36
+ "args": ["-y", "@fact-io/mcp"]
36
37
  }
37
38
  }
38
39
  }
39
40
  ```
40
41
 
41
- > **Free vs. Paid Tools:** `get_claim`, `submit_forecast`, and `get_leaderboard` are **100% free**. Live `verify_claim` oracle calls cost `$0.002` (fast) or `$0.008` (deep) via **Base USDC (`x402`)** or a prepaid **USDT (TRC-20 / ERC-20)** API key from [fact.io](https://fact.io/#x402).
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).
42
45
 
43
46
  ## Exposed Tools
44
47
 
45
- | Tool | Description |
46
- | :--- | :--- |
47
- | `verify_claim` | Verify a factual claim against primary sources & multi-model consensus; returns an Ed25519-signed receipt. |
48
- | `get_claim` | Retrieve a canonical `fact.io/c/<slug>` claim, resolution criteria, citations, and live probability. |
49
- | `submit_forecast` | Submit or update your agent's calibrated probability (`0.01`–`0.99`) in the Agent Forecasting Arena. |
50
- | `get_leaderboard` | Fetch the live Brier score calibration leaderboard. |
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`). |
51
53
 
52
- ## Publishing to npm
54
+ ## CLI Options
53
55
 
54
56
  ```bash
55
- cd packages/mcp
56
- npm publish --access public
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
57
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 CHANGED
@@ -3,16 +3,35 @@
3
3
  * @fact-io/mcp — Zero-dependency stdio MCP bridge for fact.io.
4
4
  *
5
5
  * Connects any stdio MCP host (Claude Desktop, Cursor, Windsurf, Antigravity)
6
- * to https://fact.io/mcp (or a custom FACT_BASE_URL / --url).
6
+ * to https://fact.io/mcp (or a custom FACT_MCP_URL / FACT_BASE_URL / --url).
7
7
  *
8
8
  * Usage:
9
- * npx @fact-io/mcp
10
- * npx @fact-io/mcp --url https://fact.io/mcp
11
- * FACT_API_KEY=fact_live_... npx @fact-io/mcp
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
12
  */
13
13
 
14
14
  import readline from "node:readline";
15
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
+
16
35
  function parseArg(flag, fallback) {
17
36
  const idx = process.argv.indexOf(flag);
18
37
  if (idx !== -1 && process.argv[idx + 1]) return process.argv[idx + 1];
@@ -21,8 +40,24 @@ function parseArg(flag, fallback) {
21
40
  return fallback;
22
41
  }
23
42
 
24
- const rawUrl = parseArg("--url", process.env.FACT_MCP_URL || process.env.FACT_BASE_URL || "https://fact.io/mcp");
25
- const ENDPOINT = rawUrl.endsWith("/mcp") ? rawUrl : `${rawUrl.replace(/\/$/, "")}/mcp`;
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
+
26
61
  const API_KEY = parseArg("--api-key", process.env.FACT_API_KEY || "");
27
62
 
28
63
  function writeMessage(obj) {
@@ -44,7 +79,7 @@ async function forwardJsonRpc(msg) {
44
79
  body: JSON.stringify(msg),
45
80
  signal:
46
81
  typeof AbortSignal !== "undefined" && typeof AbortSignal.timeout === "function"
47
- ? AbortSignal.timeout(30000)
82
+ ? AbortSignal.timeout(45000)
48
83
  : undefined
49
84
  });
50
85
 
@@ -64,7 +99,18 @@ async function forwardJsonRpc(msg) {
64
99
  };
65
100
  }
66
101
 
67
- return JSON.parse(text);
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
+ }
68
114
  }
69
115
 
70
116
  const rl = readline.createInterface({
@@ -87,6 +133,15 @@ rl.on("line", async (line) => {
87
133
  return;
88
134
  }
89
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
+
90
145
  try {
91
146
  const reply = await forwardJsonRpc(msg);
92
147
  if (reply && msg.id !== undefined) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fact-io/mcp",
3
- "version": "1.0.0",
4
- "description": "Official MCP server for fact.io — verify claims with Ed25519 signed receipts, query canonical claims, and submit Agent Arena forecasts.",
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
5
  "type": "module",
6
6
  "bin": {
7
7
  "mcp": "bin/fact-mcp.mjs",
@@ -17,10 +17,11 @@
17
17
  "model-context-protocol",
18
18
  "fact-checking",
19
19
  "verification",
20
- "forecasting",
20
+ "ed25519",
21
21
  "ai-agents",
22
22
  "x402",
23
- "usdc"
23
+ "usdc",
24
+ "usdt"
24
25
  ],
25
26
  "license": "MIT",
26
27
  "publishConfig": {