swiss-truth-mcp 0.1.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/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/package.json +47 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Swiss Truth MCP — stdio proxy
|
|
4
|
+
*
|
|
5
|
+
* Bridges stdio (Claude Desktop / any MCP host) ↔ Swiss Truth HTTP MCP server.
|
|
6
|
+
* Usage in claude_desktop_config.json:
|
|
7
|
+
*
|
|
8
|
+
* "swiss-truth": {
|
|
9
|
+
* "command": "npx",
|
|
10
|
+
* "args": ["-y", "swiss-truth-mcp"]
|
|
11
|
+
* }
|
|
12
|
+
*
|
|
13
|
+
* Optional env vars:
|
|
14
|
+
* SWISS_TRUTH_URL — override server URL (default: https://swisstruth.org/mcp)
|
|
15
|
+
* SWISS_TRUTH_API_KEY — API key (only needed for write operations)
|
|
16
|
+
*/
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;GAcG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* Swiss Truth MCP — stdio proxy
|
|
5
|
+
*
|
|
6
|
+
* Bridges stdio (Claude Desktop / any MCP host) ↔ Swiss Truth HTTP MCP server.
|
|
7
|
+
* Usage in claude_desktop_config.json:
|
|
8
|
+
*
|
|
9
|
+
* "swiss-truth": {
|
|
10
|
+
* "command": "npx",
|
|
11
|
+
* "args": ["-y", "swiss-truth-mcp"]
|
|
12
|
+
* }
|
|
13
|
+
*
|
|
14
|
+
* Optional env vars:
|
|
15
|
+
* SWISS_TRUTH_URL — override server URL (default: https://swisstruth.org/mcp)
|
|
16
|
+
* SWISS_TRUTH_API_KEY — API key (only needed for write operations)
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
const index_1 = require("@modelcontextprotocol/sdk/client/index");
|
|
20
|
+
const sse_1 = require("@modelcontextprotocol/sdk/client/sse");
|
|
21
|
+
const index_2 = require("@modelcontextprotocol/sdk/server/index");
|
|
22
|
+
const stdio_1 = require("@modelcontextprotocol/sdk/server/stdio");
|
|
23
|
+
const types_1 = require("@modelcontextprotocol/sdk/types");
|
|
24
|
+
const UPSTREAM_URL = process.env.SWISS_TRUTH_URL ?? "https://swisstruth.org/mcp";
|
|
25
|
+
const API_KEY = process.env.SWISS_TRUTH_API_KEY ?? "";
|
|
26
|
+
async function main() {
|
|
27
|
+
// ── 1. Connect to upstream HTTP MCP server ────────────────────────────────
|
|
28
|
+
const headers = {};
|
|
29
|
+
if (API_KEY)
|
|
30
|
+
headers["X-Swiss-Truth-Key"] = API_KEY;
|
|
31
|
+
const upstreamTransport = new sse_1.SSEClientTransport(new URL(UPSTREAM_URL), { requestInit: { headers } });
|
|
32
|
+
const upstream = new index_1.Client({ name: "swiss-truth-proxy", version: "0.1.1" }, { capabilities: {} });
|
|
33
|
+
await upstream.connect(upstreamTransport);
|
|
34
|
+
// ── 2. Fetch tool list from upstream ──────────────────────────────────────
|
|
35
|
+
const { tools } = await upstream.listTools();
|
|
36
|
+
// ── 3. Create local stdio MCP server ─────────────────────────────────────
|
|
37
|
+
const server = new index_2.Server({ name: "swiss-truth", version: "0.1.1" }, { capabilities: { tools: {} } });
|
|
38
|
+
// List tools — return what upstream reported
|
|
39
|
+
server.setRequestHandler(types_1.ListToolsRequestSchema, async () => ({ tools }));
|
|
40
|
+
// Call tool — forward to upstream
|
|
41
|
+
server.setRequestHandler(types_1.CallToolRequestSchema, async (request) => {
|
|
42
|
+
const result = await upstream.callTool({
|
|
43
|
+
name: request.params.name,
|
|
44
|
+
arguments: request.params.arguments ?? {},
|
|
45
|
+
});
|
|
46
|
+
return result;
|
|
47
|
+
});
|
|
48
|
+
// ── 4. Start stdio transport ──────────────────────────────────────────────
|
|
49
|
+
const stdioTransport = new stdio_1.StdioServerTransport();
|
|
50
|
+
await server.connect(stdioTransport);
|
|
51
|
+
// Graceful shutdown
|
|
52
|
+
process.on("SIGINT", () => { upstream.close(); server.close(); process.exit(0); });
|
|
53
|
+
process.on("SIGTERM", () => { upstream.close(); server.close(); process.exit(0); });
|
|
54
|
+
}
|
|
55
|
+
main().catch((err) => {
|
|
56
|
+
process.stderr.write(`[swiss-truth-mcp] Fatal: ${err.message}\n`);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AACA;;;;;;;;;;;;;;GAcG;;AAEH,kEAAgE;AAChE,8DAA0E;AAC1E,kEAAgE;AAChE,kEAA8E;AAC9E,2DAIyC;AAEzC,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,4BAA4B,CAAC;AACjF,MAAM,OAAO,GAAQ,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,EAAE,CAAC;AAE3D,KAAK,UAAU,IAAI;IACjB,6EAA6E;IAC7E,MAAM,OAAO,GAA2B,EAAE,CAAC;IAC3C,IAAI,OAAO;QAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,OAAO,CAAC;IAEpD,MAAM,iBAAiB,GAAG,IAAI,wBAAkB,CAC9C,IAAI,GAAG,CAAC,YAAY,CAAC,EACrB,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,EAAE,CAC7B,CAAC;IAEF,MAAM,QAAQ,G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CAAC,CAAC,CAAC;IACpF,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACtF,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,4BAA4B,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC;IAClE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "swiss-truth-mcp",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Swiss Truth MCP — certified knowledge for AI agents. Stops hallucinations with source-backed facts.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"mcp",
|
|
7
|
+
"ai",
|
|
8
|
+
"agents",
|
|
9
|
+
"fact-checking",
|
|
10
|
+
"hallucination",
|
|
11
|
+
"rag",
|
|
12
|
+
"llm",
|
|
13
|
+
"knowledge-base",
|
|
14
|
+
"swiss-truth",
|
|
15
|
+
"verified",
|
|
16
|
+
"knowledge",
|
|
17
|
+
"claude"
|
|
18
|
+
],
|
|
19
|
+
"homepage": "https://swisstruth.org",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/swisstruthorg/swiss-truth-mcp.git"
|
|
23
|
+
},
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"author": "Swiss Truth <hello@swisstruth.org>",
|
|
26
|
+
"bin": {
|
|
27
|
+
"swiss-truth-mcp": "./dist/index.js"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "tsc",
|
|
34
|
+
"prepublishOnly": "npm run build",
|
|
35
|
+
"start": "node dist/index.js"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"typescript": "^5.7.0",
|
|
42
|
+
"@types/node": "^22.0.0"
|
|
43
|
+
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=18"
|
|
46
|
+
}
|
|
47
|
+
}
|