@fre4x/grok 1.0.45 → 1.0.47

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/dist/index.js +15 -3
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  import{createRequire}from'module';const require=createRequire(import.meta.url);
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
@@ -18435,7 +18436,8 @@ var require_follow_redirects = __commonJS({
18435
18436
  });
18436
18437
 
18437
18438
  // src/index.ts
18438
- import { pathToFileURL } from "node:url";
18439
+ import { realpathSync } from "node:fs";
18440
+ import { fileURLToPath } from "node:url";
18439
18441
 
18440
18442
  // ../packages/shared/dist/errors.js
18441
18443
  function createApiError(message, statusCode) {
@@ -44430,8 +44432,18 @@ async function runServer() {
44430
44432
  await server.connect(transport);
44431
44433
  console.error("Grok MCP Server running on stdio");
44432
44434
  }
44433
- var isMainModule = Boolean(process.argv[1]) && import.meta.url === pathToFileURL(process.argv[1]).href;
44434
- if (isMainModule) {
44435
+ function isMainModule(url3) {
44436
+ if (!process.argv[1]) return false;
44437
+ try {
44438
+ const scriptPath = fileURLToPath(url3);
44439
+ const realScriptPath = realpathSync(scriptPath);
44440
+ const realArgvPath = realpathSync(process.argv[1]);
44441
+ return realScriptPath === realArgvPath;
44442
+ } catch {
44443
+ return false;
44444
+ }
44445
+ }
44446
+ if (isMainModule(import.meta.url)) {
44435
44447
  runServer().catch((error48) => {
44436
44448
  console.error("Fatal error running server:", error48);
44437
44449
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fre4x/grok",
3
- "version": "1.0.45",
3
+ "version": "1.0.47",
4
4
  "description": "An MCP server for xAI (Grok) with search and generation capabilities.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -11,12 +11,12 @@
11
11
  "dist"
12
12
  ],
13
13
  "scripts": {
14
- "build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && npx esbuild src/index.ts --bundle --outfile=dist/index.js --platform=node --format=esm --banner:js=\"import{createRequire}from'module';const require=createRequire(import.meta.url);\"",
14
+ "build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && npx esbuild src/index.ts --bundle --outfile=dist/index.js --platform=node --format=esm --banner:js=\"import{createRequire}from'module';const require=createRequire(import.meta.url);\" && node -e \"const fs=require('fs');const p='dist/index.js';const c=fs.readFileSync(p,'utf8');const next=c.startsWith('#!/usr/bin/env node')?c:'#!/usr/bin/env node\\n'+c;fs.writeFileSync(p,next);fs.chmodSync(p,0o755);\"",
15
15
  "typecheck": "cross-env NODE_OPTIONS=--max-old-space-size=4096 tsc --noEmit",
16
16
  "start": "node dist/index.js",
17
17
  "dev": "tsx src/index.ts",
18
18
  "watch": "tsc -w",
19
- "inspector": "cross-env MOCK=true npx @modelcontextprotocol/inspector node dist/index.js",
19
+ "inspector": "node ../scripts/run-official-inspector.mjs node dist/index.js",
20
20
  "prepublishOnly": "npm run build && npm run typecheck",
21
21
  "test": "vitest run --passWithNoTests --exclude dist"
22
22
  },