driven-research-mcp 1.0.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 (3) hide show
  1. package/README.md +64 -0
  2. package/bin.mjs +88 -0
  3. package/package.json +17 -0
package/README.md ADDED
@@ -0,0 +1,64 @@
1
+ # driven-research-mcp
2
+
3
+ A tiny **stdio ↔ HTTP bridge** for the Driven Research MCP. It speaks MCP over
4
+ stdin/stdout locally and forwards every call to the hosted MCP endpoint with
5
+ your API key.
6
+
7
+ Use it for clients that can't add a remote HTTP MCP with a custom auth header —
8
+ **Claude Desktop**, Codex, Cursor, and other stdio-only agents. (In **Claude
9
+ Code** you don't need this — add the HTTP server directly with `claude mcp add
10
+ --transport http … --header "Authorization: Bearer drk_…"`.)
11
+
12
+ ## Configure
13
+
14
+ Set your API key (generate one at the Driven Research dashboard → Settings):
15
+
16
+ - `DRIVEN_RESEARCH_API_KEY` — required, your `drk_…` key
17
+ - `DRIVEN_RESEARCH_URL` — optional, defaults to the hosted endpoint
18
+
19
+ ## Claude Desktop
20
+
21
+ Edit `claude_desktop_config.json` (macOS: `~/Library/Application Support/Claude/`):
22
+
23
+ ```json
24
+ {
25
+ "mcpServers": {
26
+ "driven-research": {
27
+ "command": "npx",
28
+ "args": ["-y", "driven-research-mcp"],
29
+ "env": { "DRIVEN_RESEARCH_API_KEY": "drk_your_key" }
30
+ }
31
+ }
32
+ }
33
+ ```
34
+
35
+ Before publishing to npm, point `command`/`args` at the local file instead:
36
+
37
+ ```json
38
+ {
39
+ "mcpServers": {
40
+ "driven-research": {
41
+ "command": "node",
42
+ "args": ["/absolute/path/to/mcp-client/bin.mjs"],
43
+ "env": { "DRIVEN_RESEARCH_API_KEY": "drk_your_key" }
44
+ }
45
+ }
46
+ }
47
+ ```
48
+
49
+ Restart Claude Desktop, then the `dr_*` tools appear.
50
+
51
+ ## Other stdio agents
52
+
53
+ Same idea — register a stdio command `npx -y driven-research-mcp` (or
54
+ `node bin.mjs`) with `DRIVEN_RESEARCH_API_KEY` in the environment.
55
+
56
+ ## Publishing (optional)
57
+
58
+ ```bash
59
+ cd mcp-client
60
+ npm publish # requires an npm account; pick an available package name
61
+ ```
62
+
63
+ Until then it works fine via the local-path config above, or
64
+ `npx /absolute/path/to/mcp-client`.
package/bin.mjs ADDED
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/env node
2
+ // Driven Research MCP — stdio <-> HTTP bridge.
3
+ // Speaks MCP over stdin/stdout (newline-delimited JSON-RPC) and forwards every
4
+ // message to the hosted MCP endpoint with the API key. Lets stdio-only clients
5
+ // (Claude Desktop, Codex, Cursor) use the same server Claude Code reaches over HTTP.
6
+ //
7
+ // DRIVEN_RESEARCH_API_KEY required — your drk_... key
8
+ // DRIVEN_RESEARCH_URL optional — defaults to the hosted endpoint
9
+ import readline from "node:readline";
10
+
11
+ const URL =
12
+ process.env.DRIVEN_RESEARCH_URL ||
13
+ "https://driven-research.vercel.app/api/mcp";
14
+ const KEY =
15
+ process.env.DRIVEN_RESEARCH_API_KEY || process.env.DRIVEN_RESEARCH_KEY;
16
+
17
+ if (process.argv.includes("--help") || process.argv.includes("-h")) {
18
+ process.stderr.write(
19
+ "driven-research-mcp — stdio bridge to the Driven Research MCP\n" +
20
+ "Set DRIVEN_RESEARCH_API_KEY (drk_...). Optional DRIVEN_RESEARCH_URL.\n",
21
+ );
22
+ process.exit(0);
23
+ }
24
+ if (!KEY) {
25
+ process.stderr.write(
26
+ "driven-research-mcp: missing DRIVEN_RESEARCH_API_KEY environment variable.\n",
27
+ );
28
+ process.exit(1);
29
+ }
30
+
31
+ const send = (obj) => process.stdout.write(JSON.stringify(obj) + "\n");
32
+
33
+ const rl = readline.createInterface({ input: process.stdin });
34
+
35
+ rl.on("line", async (line) => {
36
+ const text = line.trim();
37
+ if (!text) return;
38
+
39
+ let msg;
40
+ try {
41
+ msg = JSON.parse(text);
42
+ } catch {
43
+ return; // ignore non-JSON lines
44
+ }
45
+
46
+ try {
47
+ const res = await fetch(URL, {
48
+ method: "POST",
49
+ headers: {
50
+ "Content-Type": "application/json",
51
+ Authorization: "Bearer " + KEY,
52
+ },
53
+ body: JSON.stringify(msg),
54
+ });
55
+
56
+ // Notifications return 202 with no body — nothing to write back.
57
+ if (res.status === 202) return;
58
+
59
+ const data = await res.json().catch(() => null);
60
+ if (data == null) {
61
+ if (msg.id !== undefined) {
62
+ send({
63
+ jsonrpc: "2.0",
64
+ id: msg.id,
65
+ error: { code: -32603, message: "Upstream HTTP " + res.status },
66
+ });
67
+ }
68
+ return;
69
+ }
70
+
71
+ // Keep the response id aligned with the request (e.g. auth errors return id:null).
72
+ if (
73
+ msg.id !== undefined &&
74
+ (data.id === null || data.id === undefined)
75
+ ) {
76
+ data.id = msg.id;
77
+ }
78
+ send(data);
79
+ } catch (e) {
80
+ if (msg.id !== undefined) {
81
+ send({
82
+ jsonrpc: "2.0",
83
+ id: msg.id,
84
+ error: { code: -32603, message: String((e && e.message) || e) },
85
+ });
86
+ }
87
+ }
88
+ });
package/package.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "driven-research-mcp",
3
+ "version": "1.0.0",
4
+ "description": "Driven Research MCP — stdio client that bridges to the hosted Driven Research MCP server. For Claude Desktop and other stdio-only agents.",
5
+ "type": "module",
6
+ "bin": {
7
+ "driven-research-mcp": "bin.mjs"
8
+ },
9
+ "files": [
10
+ "bin.mjs",
11
+ "README.md"
12
+ ],
13
+ "engines": {
14
+ "node": ">=18"
15
+ },
16
+ "license": "MIT"
17
+ }