@fre4x/grok 1.0.41 → 1.0.42

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 +51 -51
  2. package/dist/index.js +160 -38
  3. package/package.json +45 -45
package/README.md CHANGED
@@ -1,51 +1,51 @@
1
- # grok — The Infinite Oracle
2
-
3
- > *Searching the stream of everything, imagining the void, and animating the future. A B1TE that sees all.*
4
-
5
- Part of **[FRE4X-B1TE](../)** — a monorepo of MCP servers built for autonomous agents.
6
-
7
- xAI's Grok is more than an LLM. It's a real-time sensor for the global consciousness (X) and a multi-modal engine for creation. This server gives autonomous agents the ability to search the web with high reasoning, tap into the real-time X stream, and generate high-fidelity images and videos.
8
-
9
- ## Tools
10
-
11
- | Tool | Capability |
12
- |------|------------|
13
- | `x_search` | Real-time search of X (Twitter) posts, users, and threads |
14
- | `web_search` | Reasoning-based web search using Grok's latest models |
15
- | `grok_imagine` | Generate high-quality images from text prompts |
16
- | `grok_animate` | Generate or animate video from text or image prompts (Asynchronous) |
17
- | `check_video_status` | Check the status of a video generation task via its request ID |
18
-
19
- ## Configuration
20
-
21
- Required Environment Variable:
22
- - `XAI_API_KEY`: Your xAI API key from [console.x.ai](https://console.x.ai/).
23
-
24
- ## Deploy
25
-
26
- ```json
27
- {
28
- "mcpServers": {
29
- "grok": {
30
- "command": "npx",
31
- "args": ["-y", "@fre4x/grok"],
32
- "env": {
33
- "XAI_API_KEY": "your-key-here"
34
- }
35
- }
36
- }
37
- }
38
- ```
39
-
40
- ## Development
41
-
42
- ```bash
43
- npm install
44
- npm run dev # tsx, no build
45
- npm run build # esbuild → dist/
46
- npm run typecheck # tsc verification
47
- ```
48
-
49
- ## License
50
-
51
- MIT — **WE ARE THE FRE4X.**
1
+ # grok — The Infinite Oracle
2
+
3
+ > *Searching the stream of everything, imagining the void, and animating the future. A B1TE that sees all.*
4
+
5
+ Part of **[FRE4X-B1TE](../)** — a monorepo of MCP servers built for autonomous agents.
6
+
7
+ xAI's Grok is more than an LLM. It's a real-time sensor for the global consciousness (X) and a multi-modal engine for creation. This server gives autonomous agents the ability to search the web with high reasoning, tap into the real-time X stream, and generate high-fidelity images and videos.
8
+
9
+ ## Tools
10
+
11
+ | Tool | Capability |
12
+ |------|------------|
13
+ | `x_search` | Real-time search of X (Twitter) posts, users, and threads |
14
+ | `web_search` | Reasoning-based web search using Grok's latest models |
15
+ | `grok_imagine` | Generate high-quality images from text prompts |
16
+ | `grok_animate` | Generate or animate video from text or image prompts (Asynchronous) |
17
+ | `check_video_status` | Check the status of a video generation task via its request ID |
18
+
19
+ ## Configuration
20
+
21
+ Required Environment Variable:
22
+ - `XAI_API_KEY`: Your xAI API key from [console.x.ai](https://console.x.ai/).
23
+
24
+ ## Deploy
25
+
26
+ ```json
27
+ {
28
+ "mcpServers": {
29
+ "grok": {
30
+ "command": "npx",
31
+ "args": ["-y", "@fre4x/grok"],
32
+ "env": {
33
+ "XAI_API_KEY": "your-key-here"
34
+ }
35
+ }
36
+ }
37
+ }
38
+ ```
39
+
40
+ ## Development
41
+
42
+ ```bash
43
+ npm install
44
+ npm run dev # tsx, no build
45
+ npm run build # esbuild → dist/
46
+ npm run typecheck # tsc verification
47
+ ```
48
+
49
+ ## License
50
+
51
+ MIT — **WE ARE THE FRE4X.**
package/dist/index.js CHANGED
@@ -16083,7 +16083,7 @@ var require_shams = __commonJS({
16083
16083
  return true;
16084
16084
  }
16085
16085
  var obj = {};
16086
- var sym = /* @__PURE__ */ Symbol("test");
16086
+ var sym = Symbol("test");
16087
16087
  var symObj = Object(sym);
16088
16088
  if (typeof sym === "string") {
16089
16089
  return false;
@@ -16142,7 +16142,7 @@ var require_has_symbols = __commonJS({
16142
16142
  if (typeof origSymbol("foo") !== "symbol") {
16143
16143
  return false;
16144
16144
  }
16145
- if (typeof /* @__PURE__ */ Symbol("bar") !== "symbol") {
16145
+ if (typeof Symbol("bar") !== "symbol") {
16146
16146
  return false;
16147
16147
  }
16148
16148
  return hasSymbolSham();
@@ -22142,6 +22142,7 @@ ZodNaN.create = (params) => {
22142
22142
  ...processCreateParams(params)
22143
22143
  });
22144
22144
  };
22145
+ var BRAND = Symbol("zod_brand");
22145
22146
  var ZodBranded = class extends ZodType {
22146
22147
  _parse(input) {
22147
22148
  const { ctx } = this._processInputParams(input);
@@ -22366,6 +22367,7 @@ function $constructor(name, initializer3, params) {
22366
22367
  Object.defineProperty(_, "name", { value: name });
22367
22368
  return _;
22368
22369
  }
22370
+ var $brand = Symbol("zod_brand");
22369
22371
  var $ZodAsyncError = class extends Error {
22370
22372
  constructor() {
22371
22373
  super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
@@ -22512,7 +22514,7 @@ function floatSafeRemainder2(val, step) {
22512
22514
  const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
22513
22515
  return valInt % stepInt / 10 ** decCount;
22514
22516
  }
22515
- var EVALUATING = /* @__PURE__ */ Symbol("evaluating");
22517
+ var EVALUATING = Symbol("evaluating");
22516
22518
  function defineLazy(object3, key, getter) {
22517
22519
  let value = void 0;
22518
22520
  Object.defineProperty(object3, key, {
@@ -26039,6 +26041,8 @@ function en_default2() {
26039
26041
 
26040
26042
  // ../node_modules/zod/v4/core/registries.js
26041
26043
  var _a;
26044
+ var $output = Symbol("ZodOutput");
26045
+ var $input = Symbol("ZodInput");
26042
26046
  var $ZodRegistry = class {
26043
26047
  constructor() {
26044
26048
  this._map = /* @__PURE__ */ new WeakMap();
@@ -30683,6 +30687,9 @@ function isTerminal(status) {
30683
30687
  return status === "completed" || status === "failed" || status === "cancelled";
30684
30688
  }
30685
30689
 
30690
+ // ../node_modules/zod-to-json-schema/dist/esm/Options.js
30691
+ var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
30692
+
30686
30693
  // ../node_modules/zod-to-json-schema/dist/esm/parsers/string.js
30687
30694
  var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
30688
30695
 
@@ -33496,7 +33503,7 @@ var parseHeaders_default = (rawHeaders) => {
33496
33503
  };
33497
33504
 
33498
33505
  // ../node_modules/axios/lib/core/AxiosHeaders.js
33499
- var $internals = /* @__PURE__ */ Symbol("internals");
33506
+ var $internals = Symbol("internals");
33500
33507
  function normalizeHeader(header) {
33501
33508
  return header && String(header).trim().toLowerCase();
33502
33509
  }
@@ -33860,7 +33867,7 @@ import stream3 from "stream";
33860
33867
 
33861
33868
  // ../node_modules/axios/lib/helpers/AxiosTransformStream.js
33862
33869
  import stream from "stream";
33863
- var kInternals = /* @__PURE__ */ Symbol("internals");
33870
+ var kInternals = Symbol("internals");
33864
33871
  var AxiosTransformStream = class extends stream.Transform {
33865
33872
  constructor(options) {
33866
33873
  options = utils_default.toFlatObject(
@@ -36265,7 +36272,9 @@ var MOCK_FIXTURES = {
36265
36272
  // src/index.ts
36266
36273
  var XAI_API_KEY = process.env.XAI_API_KEY;
36267
36274
  if (!XAI_API_KEY && !IS_MOCK) {
36268
- throw new Error("XAI_API_KEY environment variable is required (unless MOCK=true)");
36275
+ throw new Error(
36276
+ "XAI_API_KEY environment variable is required (unless MOCK=true)"
36277
+ );
36269
36278
  }
36270
36279
  var xaiClient = axios_default.create({
36271
36280
  baseURL: "https://api.x.ai/v1",
@@ -36294,14 +36303,23 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
36294
36303
  inputSchema: {
36295
36304
  type: "object",
36296
36305
  properties: {
36297
- query: { type: "string", description: "The search query" },
36306
+ query: {
36307
+ type: "string",
36308
+ description: "The search query"
36309
+ },
36298
36310
  allowed_handles: {
36299
36311
  type: "array",
36300
36312
  items: { type: "string" },
36301
36313
  description: "Optional list of X handles to limit search to (max 10)"
36302
36314
  },
36303
- from_date: { type: "string", description: "Optional start date (ISO8601)" },
36304
- to_date: { type: "string", description: "Optional end date (ISO8601)" }
36315
+ from_date: {
36316
+ type: "string",
36317
+ description: "Optional start date (ISO8601)"
36318
+ },
36319
+ to_date: {
36320
+ type: "string",
36321
+ description: "Optional end date (ISO8601)"
36322
+ }
36305
36323
  },
36306
36324
  required: ["query"]
36307
36325
  }
@@ -36312,7 +36330,10 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
36312
36330
  inputSchema: {
36313
36331
  type: "object",
36314
36332
  properties: {
36315
- query: { type: "string", description: "The search query" },
36333
+ query: {
36334
+ type: "string",
36335
+ description: "The search query"
36336
+ },
36316
36337
  allowed_domains: {
36317
36338
  type: "array",
36318
36339
  items: { type: "string" },
@@ -36328,7 +36349,10 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
36328
36349
  inputSchema: {
36329
36350
  type: "object",
36330
36351
  properties: {
36331
- prompt: { type: "string", description: "The prompt for image generation" },
36352
+ prompt: {
36353
+ type: "string",
36354
+ description: "The prompt for image generation"
36355
+ },
36332
36356
  aspect_ratio: {
36333
36357
  type: "string",
36334
36358
  enum: ["1:1", "16:9", "9:16"],
@@ -36344,8 +36368,14 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
36344
36368
  inputSchema: {
36345
36369
  type: "object",
36346
36370
  properties: {
36347
- prompt: { type: "string", description: "The prompt for video generation/animation" },
36348
- image_url: { type: "string", description: "Optional source image URL to animate" },
36371
+ prompt: {
36372
+ type: "string",
36373
+ description: "The prompt for video generation/animation"
36374
+ },
36375
+ image_url: {
36376
+ type: "string",
36377
+ description: "Optional source image URL to animate"
36378
+ },
36349
36379
  aspect_ratio: {
36350
36380
  type: "string",
36351
36381
  enum: ["1:1", "16:9", "9:16"],
@@ -36361,7 +36391,10 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
36361
36391
  inputSchema: {
36362
36392
  type: "object",
36363
36393
  properties: {
36364
- request_id: { type: "string", description: "The request ID returned by grok_animate" }
36394
+ request_id: {
36395
+ type: "string",
36396
+ description: "The request ID returned by grok_animate"
36397
+ }
36365
36398
  },
36366
36399
  required: ["request_id"]
36367
36400
  }
@@ -36376,53 +36409,115 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
36376
36409
  case "x_search": {
36377
36410
  const { query, allowed_handles, from_date, to_date } = args;
36378
36411
  if (IS_MOCK) {
36379
- return { content: [{ type: "text", text: JSON.stringify(MOCK_FIXTURES.x_search, null, 2) }] };
36412
+ return {
36413
+ content: [
36414
+ {
36415
+ type: "text",
36416
+ text: JSON.stringify(
36417
+ MOCK_FIXTURES.x_search,
36418
+ null,
36419
+ 2
36420
+ )
36421
+ }
36422
+ ]
36423
+ };
36380
36424
  }
36381
36425
  const response = await xaiClient.post("/responses", {
36382
36426
  model: "grok-4-1-fast-reasoning",
36383
36427
  input: [{ role: "user", content: query }],
36384
- tools: [{
36385
- type: "x_search",
36386
- x_search: {
36387
- allowed_x_handles: allowed_handles,
36388
- from_date,
36389
- to_date
36428
+ tools: [
36429
+ {
36430
+ type: "x_search",
36431
+ x_search: {
36432
+ allowed_x_handles: allowed_handles,
36433
+ from_date,
36434
+ to_date
36435
+ }
36390
36436
  }
36391
- }]
36437
+ ]
36392
36438
  });
36393
- return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }] };
36439
+ return {
36440
+ content: [
36441
+ {
36442
+ type: "text",
36443
+ text: JSON.stringify(response.data, null, 2)
36444
+ }
36445
+ ]
36446
+ };
36394
36447
  }
36395
36448
  case "web_search": {
36396
36449
  const { query, allowed_domains } = args;
36397
36450
  if (IS_MOCK) {
36398
- return { content: [{ type: "text", text: JSON.stringify(MOCK_FIXTURES.web_search, null, 2) }] };
36451
+ return {
36452
+ content: [
36453
+ {
36454
+ type: "text",
36455
+ text: JSON.stringify(
36456
+ MOCK_FIXTURES.web_search,
36457
+ null,
36458
+ 2
36459
+ )
36460
+ }
36461
+ ]
36462
+ };
36399
36463
  }
36400
36464
  const response = await xaiClient.post("/responses", {
36401
36465
  model: "grok-4-1-fast-reasoning",
36402
36466
  input: [{ role: "user", content: query }],
36403
- tools: [{
36404
- type: "web_search",
36405
- web_search: {
36406
- allowed_domains
36467
+ tools: [
36468
+ {
36469
+ type: "web_search",
36470
+ web_search: {
36471
+ allowed_domains
36472
+ }
36407
36473
  }
36408
- }]
36474
+ ]
36409
36475
  });
36410
- return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }] };
36476
+ return {
36477
+ content: [
36478
+ {
36479
+ type: "text",
36480
+ text: JSON.stringify(response.data, null, 2)
36481
+ }
36482
+ ]
36483
+ };
36411
36484
  }
36412
36485
  case "grok_imagine": {
36413
36486
  const { prompt, aspect_ratio = "1:1" } = args;
36414
36487
  if (IS_MOCK) {
36415
- return { content: [{ type: "text", text: JSON.stringify(MOCK_FIXTURES.grok_imagine, null, 2) }] };
36488
+ return {
36489
+ content: [
36490
+ {
36491
+ type: "text",
36492
+ text: JSON.stringify(
36493
+ MOCK_FIXTURES.grok_imagine,
36494
+ null,
36495
+ 2
36496
+ )
36497
+ }
36498
+ ]
36499
+ };
36416
36500
  }
36417
36501
  const response = await xaiClient.post("/images/generations", {
36418
36502
  model: "grok-imagine-image",
36419
36503
  prompt,
36420
36504
  aspect_ratio
36421
36505
  });
36422
- return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }] };
36506
+ return {
36507
+ content: [
36508
+ {
36509
+ type: "text",
36510
+ text: JSON.stringify(response.data, null, 2)
36511
+ }
36512
+ ]
36513
+ };
36423
36514
  }
36424
36515
  case "grok_animate": {
36425
- const { prompt, image_url, aspect_ratio = "16:9" } = args;
36516
+ const {
36517
+ prompt,
36518
+ image_url,
36519
+ aspect_ratio = "16:9"
36520
+ } = args;
36426
36521
  if (IS_MOCK) {
36427
36522
  return {
36428
36523
  content: [
@@ -36434,7 +36529,11 @@ Status: ${MOCK_FIXTURES.grok_animate.status}`
36434
36529
  },
36435
36530
  {
36436
36531
  type: "text",
36437
- text: JSON.stringify(MOCK_FIXTURES.grok_animate, null, 2)
36532
+ text: JSON.stringify(
36533
+ MOCK_FIXTURES.grok_animate,
36534
+ null,
36535
+ 2
36536
+ )
36438
36537
  }
36439
36538
  ]
36440
36539
  };
@@ -36465,13 +36564,36 @@ You can use this ID to check the status later or wait for completion if the clie
36465
36564
  case "check_video_status": {
36466
36565
  const { request_id } = args;
36467
36566
  if (IS_MOCK) {
36468
- return { content: [{ type: "text", text: JSON.stringify(MOCK_FIXTURES.check_video_status, null, 2) }] };
36567
+ return {
36568
+ content: [
36569
+ {
36570
+ type: "text",
36571
+ text: JSON.stringify(
36572
+ MOCK_FIXTURES.check_video_status,
36573
+ null,
36574
+ 2
36575
+ )
36576
+ }
36577
+ ]
36578
+ };
36469
36579
  }
36470
- const response = await xaiClient.get(`/videos/status/${request_id}`);
36471
- return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }] };
36580
+ const response = await xaiClient.get(
36581
+ `/videos/status/${request_id}`
36582
+ );
36583
+ return {
36584
+ content: [
36585
+ {
36586
+ type: "text",
36587
+ text: JSON.stringify(response.data, null, 2)
36588
+ }
36589
+ ]
36590
+ };
36472
36591
  }
36473
36592
  default:
36474
- throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
36593
+ throw new McpError(
36594
+ ErrorCode.MethodNotFound,
36595
+ `Unknown tool: ${name}`
36596
+ );
36475
36597
  }
36476
36598
  } catch (error2) {
36477
36599
  const errorMessage = error2.response?.data?.error?.message || error2.message;
package/package.json CHANGED
@@ -1,45 +1,45 @@
1
- {
2
- "name": "@fre4x/grok",
3
- "version": "1.0.41",
4
- "description": "An MCP server for xAI (Grok) with search and generation capabilities.",
5
- "type": "module",
6
- "main": "dist/index.js",
7
- "bin": {
8
- "grok": "dist/index.js"
9
- },
10
- "files": [
11
- "dist"
12
- ],
13
- "scripts": {
14
- "build": "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);\"",
15
- "typecheck": "tsc --noEmit",
16
- "start": "node dist/index.js",
17
- "dev": "tsx src/index.ts",
18
- "watch": "tsc -w",
19
- "test": "vitest run --passWithNoTests --exclude dist"
20
- },
21
- "keywords": [
22
- "mcp",
23
- "grok",
24
- "xai",
25
- "mcp-server",
26
- "ai",
27
- "search",
28
- "image-generation",
29
- "video-generation"
30
- ],
31
- "author": "fritzprix",
32
- "license": "MIT",
33
- "dependencies": {
34
- "@modelcontextprotocol/sdk": "^1.26.0",
35
- "axios": "^1.13.5",
36
- "zod": "^4.0.0"
37
- },
38
- "devDependencies": {
39
- "@types/node": "^25.3.0",
40
- "tsx": "^4.21.0",
41
- "typescript": "^5.9.3",
42
- "esbuild": "^0.25.0",
43
- "vitest": "^4.0.18"
44
- }
45
- }
1
+ {
2
+ "name": "@fre4x/grok",
3
+ "version": "1.0.42",
4
+ "description": "An MCP server for xAI (Grok) with search and generation capabilities.",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "grok": "dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist"
12
+ ],
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);\"",
15
+ "typecheck": "tsc --noEmit",
16
+ "start": "node dist/index.js",
17
+ "dev": "tsx src/index.ts",
18
+ "watch": "tsc -w",
19
+ "test": "vitest run --passWithNoTests --exclude dist"
20
+ },
21
+ "keywords": [
22
+ "mcp",
23
+ "grok",
24
+ "xai",
25
+ "mcp-server",
26
+ "ai",
27
+ "search",
28
+ "image-generation",
29
+ "video-generation"
30
+ ],
31
+ "author": "fritzprix",
32
+ "license": "MIT",
33
+ "dependencies": {
34
+ "@modelcontextprotocol/sdk": "^1.26.0",
35
+ "axios": "^1.13.5",
36
+ "zod": "^4.0.0"
37
+ },
38
+ "devDependencies": {
39
+ "@types/node": "^25.3.0",
40
+ "tsx": "^4.21.0",
41
+ "typescript": "^5.9.3",
42
+ "esbuild": "^0.25.0",
43
+ "vitest": "^4.0.18"
44
+ }
45
+ }