takar-mcp 0.1.0 → 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.
Files changed (2) hide show
  1. package/package.json +17 -17
  2. package/server.mjs +46 -0
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
- {
2
- "name": "takar-mcp",
3
- "version": "0.1.0",
4
- "description": "Resolve real-world events with verbatim quotes, read a signed forecast scorecard, and rank Telegraph miners. No key, no wallet.",
5
- "keywords": ["mcp", "modelcontextprotocol", "telegraph", "prediction-markets", "event-resolution", "oracle", "forecasting"],
6
- "homepage": "https://github.com/PugarHuda/takar/tree/main/mcp",
7
- "repository": { "type": "git", "url": "git+https://github.com/PugarHuda/takar.git", "directory": "mcp" },
8
- "bugs": "https://github.com/PugarHuda/takar/issues",
9
- "license": "MIT",
10
- "author": "Pugar Huda Mantoro",
11
- "type": "module",
12
- "engines": { "node": ">=20" },
13
- "bin": { "takar-mcp": "server.mjs" },
14
- "main": "server.mjs",
15
- "mcpName": "io.github.PugarHuda/takar",
16
- "files": ["server.mjs", "README.md"]
17
- }
1
+ {
2
+ "name": "takar-mcp",
3
+ "version": "0.2.0",
4
+ "description": "A second opinion for any Telegraph intent: two independent miners, chosen by an open on-chain record of who was right. Plus event resolution with verbatim quotes and a signed forecast scorecard. No key, no wallet.",
5
+ "keywords": ["mcp", "modelcontextprotocol", "telegraph", "prediction-markets", "event-resolution", "oracle", "forecasting"],
6
+ "homepage": "https://github.com/PugarHuda/takar/tree/main/mcp",
7
+ "repository": { "type": "git", "url": "git+https://github.com/PugarHuda/takar.git", "directory": "mcp" },
8
+ "bugs": "https://github.com/PugarHuda/takar/issues",
9
+ "license": "MIT",
10
+ "author": "Pugar Huda Mantoro",
11
+ "type": "module",
12
+ "engines": { "node": ">=20" },
13
+ "bin": { "takar-mcp": "server.mjs" },
14
+ "main": "server.mjs",
15
+ "mcpName": "io.github.PugarHuda/takar",
16
+ "files": ["server.mjs", "README.md"]
17
+ }
package/server.mjs CHANGED
@@ -25,6 +25,7 @@ const SCORECARD = process.env.TAKAR_SCORECARD ?? "https://raw.githubusercontent.
25
25
  // re-signed by anyone. This is keys/takar-ed25519.pub in the repo.
26
26
  const TAKAR_KEY = "MCowBQYDK2VwAyEA3Hx7R/RFow5HcbXTPXlbw0gS4eX7xliuos4D9uyQa5I=";
27
27
  const NAME = "takar";
28
+ const SITE = process.env.TAKAR_SITE ?? "https://takar-telegraph.vercel.app";
28
29
  const VERSION = JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf8")).version;
29
30
  const PROTOCOL = "2024-11-05";
30
31
 
@@ -67,6 +68,37 @@ const TOOLS = [
67
68
  required: ["intent"],
68
69
  },
69
70
  },
71
+ {
72
+ name: "second_opinion",
73
+ description:
74
+ "Before acting on intelligence from Telegraph, get a second opinion: Takar asks two DIFFERENT miners " +
75
+ "the same question (any intent), chosen by an open on-chain record of who was right, and compares their " +
76
+ "answers field by field. verdict 'agree' -> act on 'answer'. 'disagree' -> do not act on either alone; " +
77
+ "report both and the differing fields. 'insufficient' -> fewer than two usable answers. Takar pays the asks " +
78
+ "in test USDC; no key or wallet needed. Testnet only.",
79
+ inputSchema: {
80
+ type: "object",
81
+ properties: {
82
+ intent: { type: "string", description: "Exact Telegraph intent name, e.g. WEATHER_FORECAST_VERIFY_GENERAL or EVENT_OUTCOME_RESOLUTION_GENERAL." },
83
+ params: { type: "object", description: "The intent's request params, as its schema defines them." },
84
+ },
85
+ required: ["intent", "params"],
86
+ },
87
+ },
88
+ {
89
+ name: "miner_reputation",
90
+ description:
91
+ "Which Telegraph miner to trust for an intent, from an open on-chain record (EAS on Ethereum Sepolia) of how " +
92
+ "each miner's paid answers held up against independent truth: right, wrong, unusable, wrong place, abstained. " +
93
+ "Ranked by the Wilson lower bound of accuracy. Anyone can add evidence to the same schema.",
94
+ inputSchema: {
95
+ type: "object",
96
+ properties: {
97
+ intent: { type: "string", description: "Exact intent name. Omit to list the intents with evidence." },
98
+ attester: { type: "string", description: "Only count evidence from this attester address." },
99
+ },
100
+ },
101
+ },
70
102
  ];
71
103
 
72
104
  async function getJson(url, init) {
@@ -115,6 +147,20 @@ const CALLS = {
115
147
  };
116
148
  },
117
149
 
150
+ async second_opinion({ intent, params }) {
151
+ const name = String(intent ?? "").trim();
152
+ if (!/^[A-Z][A-Z0-9_]{2,80}$/.test(name)) throw new Error("intent must be an exact intent name");
153
+ if (!params || typeof params !== "object" || Array.isArray(params)) throw new Error("params must be an object");
154
+ return getJson(`${SITE}/api/second-opinion`, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ intent: name, params }) });
155
+ },
156
+
157
+ async miner_reputation({ intent, attester } = {}) {
158
+ const q = new URLSearchParams();
159
+ if (intent) q.set("intent", String(intent));
160
+ if (attester) q.set("attester", String(attester));
161
+ return getJson(`${SITE}/api/reputation?${q}`);
162
+ },
163
+
118
164
  async intent_ranking({ intent, top = 10 }) {
119
165
  const name = String(intent ?? "").trim();
120
166
  if (!/^[A-Z0-9_]{3,80}$/.test(name)) throw new Error("intent must be an exact intent name such as EVENT_OUTCOME_RESOLUTION_GENERAL");