@oimdb/mcp 1.1.0 → 1.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.
package/bin/cdp.cjs CHANGED
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env node
2
1
  /**
3
2
  * One-shot CDP inspector: connects to Chrome, evaluates __OIMDB_DEV__.inspect(),
4
3
  * prints JSON to stdout. Pipe to jq or paste into an AI prompt.
@@ -90,7 +89,10 @@ async function run() {
90
89
  });
91
90
  }
92
91
 
93
- run().catch((err) => {
94
- process.stderr.write('[OIMDB CDP] Error: ' + err.message + '\n');
95
- process.exit(1);
96
- });
92
+ /** Run the one-shot CDP snapshot (`cdp` subcommand). */
93
+ module.exports = function runCdp() {
94
+ run().catch((err) => {
95
+ process.stderr.write('[OIMDB CDP] Error: ' + err.message + '\n');
96
+ process.exit(1);
97
+ });
98
+ };
package/bin/devtools.cjs CHANGED
@@ -1,11 +1,17 @@
1
- #!/usr/bin/env node
2
1
  const path = require('path');
3
2
  const { OIMDevUIServer } = require('../dist/index.cjs');
4
3
 
5
- const wsPort = process.env.OIMDB_WS_PORT ? Number(process.env.OIMDB_WS_PORT) : 7432;
6
- const uiPort = process.env.OIMDB_UI_PORT ? Number(process.env.OIMDB_UI_PORT) : 7433;
7
- const noOpen = process.argv.includes('--no-open');
8
- const uiDir = path.join(__dirname, '../ui');
4
+ /** Start the standalone DevTools UI server (`devtools` subcommand). */
5
+ module.exports = function runDevtools() {
6
+ const wsPort = process.env.OIMDB_WS_PORT
7
+ ? Number(process.env.OIMDB_WS_PORT)
8
+ : 7432;
9
+ const uiPort = process.env.OIMDB_UI_PORT
10
+ ? Number(process.env.OIMDB_UI_PORT)
11
+ : 7433;
12
+ const noOpen = process.argv.includes('--no-open');
13
+ const uiDir = path.join(__dirname, '../ui');
9
14
 
10
- const server = new OIMDevUIServer({ wsPort, uiPort, uiDir, open: !noOpen });
11
- server.start();
15
+ const server = new OIMDevUIServer({ wsPort, uiPort, uiDir, open: !noOpen });
16
+ server.start();
17
+ };
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Single entry point for @oimdb/mcp. Dispatches on the first argument so all of
4
+ * these work via npx (one bin → npx can always resolve it):
5
+ *
6
+ * npx @oimdb/mcp # MCP server (default; for AI tools)
7
+ * npx @oimdb/mcp devtools # standalone DevTools UI (for humans)
8
+ * npx @oimdb/mcp cdp # one-shot CDP snapshot to stdout
9
+ */
10
+ const sub = process.argv[2];
11
+
12
+ if (sub === 'devtools') {
13
+ require('./devtools.cjs')();
14
+ } else if (sub === 'cdp') {
15
+ require('./cdp.cjs')();
16
+ } else if (sub === undefined || sub === 'mcp' || sub === 'serve') {
17
+ require('./server.cjs')();
18
+ } else {
19
+ process.stderr.write(
20
+ `[OIMDB] Unknown command: ${sub}\n` +
21
+ 'Usage: oimdb-mcp [devtools|cdp] (no argument = MCP server)\n'
22
+ );
23
+ process.exit(1);
24
+ }
package/bin/server.cjs CHANGED
@@ -1,11 +1,15 @@
1
- #!/usr/bin/env node
2
1
  const { OIMDevMcpServer } = require('../dist/index.cjs');
3
2
 
4
- const wsPort = process.env.OIMDB_WS_PORT ? Number(process.env.OIMDB_WS_PORT) : 7432;
5
- // Offline/static mode: point at a module that builds the model in-process.
6
- const modelModulePath = process.env.OIMDB_MODEL_MODULE || undefined;
7
- const server = new OIMDevMcpServer({ wsPort, modelModulePath });
8
- server.start().catch((err) => {
9
- process.stderr.write('[OIMDB MCP] Fatal: ' + err.message + '\n');
10
- process.exit(1);
11
- });
3
+ /** Start the MCP server (default subcommand). */
4
+ module.exports = function runMcpServer() {
5
+ const wsPort = process.env.OIMDB_WS_PORT
6
+ ? Number(process.env.OIMDB_WS_PORT)
7
+ : 7432;
8
+ // Offline/static mode: point at a module that builds the model in-process.
9
+ const modelModulePath = process.env.OIMDB_MODEL_MODULE || undefined;
10
+ const server = new OIMDevMcpServer({ wsPort, modelModulePath });
11
+ server.start().catch(err => {
12
+ process.stderr.write('[OIMDB MCP] Fatal: ' + err.message + '\n');
13
+ process.exit(1);
14
+ });
15
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oimdb/mcp",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "MCP server and CDP inspector for OIMDB — connects AI assistants to live browser state",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -18,9 +18,7 @@
18
18
  }
19
19
  },
20
20
  "bin": {
21
- "oimdb-mcp": "bin/server.cjs",
22
- "oimdb-devtools": "bin/devtools.cjs",
23
- "oimdb-cdp": "bin/cdp.cjs"
21
+ "oimdb-mcp": "bin/oimdb-mcp.cjs"
24
22
  },
25
23
  "files": [
26
24
  "dist",