@lkbaba/grok-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.
- package/CHANGELOG.md +40 -0
- package/LICENSE +21 -0
- package/README.md +179 -0
- package/dist/config/index.d.ts +48 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +101 -0
- package/dist/config/index.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +182 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/agent-search.d.ts +14 -0
- package/dist/tools/agent-search.d.ts.map +1 -0
- package/dist/tools/agent-search.js +135 -0
- package/dist/tools/agent-search.js.map +1 -0
- package/dist/tools/brainstorm.d.ts +14 -0
- package/dist/tools/brainstorm.d.ts.map +1 -0
- package/dist/tools/brainstorm.js +208 -0
- package/dist/tools/brainstorm.js.map +1 -0
- package/dist/tools/definitions.d.ts +310 -0
- package/dist/tools/definitions.d.ts.map +1 -0
- package/dist/tools/definitions.js +187 -0
- package/dist/tools/definitions.js.map +1 -0
- package/dist/types/index.d.ts +210 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/grok-client.d.ts +53 -0
- package/dist/utils/grok-client.d.ts.map +1 -0
- package/dist/utils/grok-client.js +147 -0
- package/dist/utils/grok-client.js.map +1 -0
- package/dist/utils/logger.d.ts +52 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +97 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/tool-builder.d.ts +66 -0
- package/dist/utils/tool-builder.d.ts.map +1 -0
- package/dist/utils/tool-builder.js +187 -0
- package/dist/utils/tool-builder.js.map +1 -0
- package/package.json +67 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.0.0] - 2026-03-12
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **grok_agent_search** - Smart search tool with Web + X (Twitter) search
|
|
13
|
+
- `search_type`: web / x / mixed (default: mixed)
|
|
14
|
+
- `model`: grok-4.20-beta (default) / grok-4-latest
|
|
15
|
+
- `output_format`: text (Markdown) / json (structured)
|
|
16
|
+
- `web_search_config`: domain filters, image understanding
|
|
17
|
+
- `x_search_config`: date range, handle filters, video understanding
|
|
18
|
+
- Transparent citation URLs (not redirects)
|
|
19
|
+
|
|
20
|
+
- **grok_brainstorm** - Creative brainstorming tool
|
|
21
|
+
- `count`: generate 1-10 ideas (default: 5)
|
|
22
|
+
- `style`: innovative / practical / radical / balanced
|
|
23
|
+
- `context_files`: read project files as context
|
|
24
|
+
- `output_format`: text / json (with title/description/pros/cons/feasibility)
|
|
25
|
+
- Temperature auto-adjustment based on style
|
|
26
|
+
|
|
27
|
+
- **Core Infrastructure**
|
|
28
|
+
- Native fetch (undici) for xAI API calls, auto proxy support
|
|
29
|
+
- Zod-based parameter validation
|
|
30
|
+
- Retry logic with exponential backoff (3 attempts)
|
|
31
|
+
- Performance monitoring and logging (all to stderr)
|
|
32
|
+
- TypeScript ESM with strict mode
|
|
33
|
+
|
|
34
|
+
### Technical Details
|
|
35
|
+
|
|
36
|
+
- Runtime: Node.js 20+
|
|
37
|
+
- MCP SDK: @modelcontextprotocol/sdk ^1.0.0
|
|
38
|
+
- Default model: grok-4.20-beta ($0.20/$0.50 per M tokens, 2M context)
|
|
39
|
+
- API endpoint: xAI Responses API (`/v1/responses`)
|
|
40
|
+
- No OpenAI SDK dependency (native fetch for better xAI compatibility)
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 LKbaba
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# Grok MCP Server
|
|
2
|
+
|
|
3
|
+
> **Give Claude Code the power of Grok 4.20**
|
|
4
|
+
|
|
5
|
+
An MCP server that connects Claude Code to xAI's Grok, unlocking real-time web search and X (Twitter) search capabilities.
|
|
6
|
+
|
|
7
|
+
## Why Grok + Claude?
|
|
8
|
+
|
|
9
|
+
| Grok's Strengths | Use Case |
|
|
10
|
+
|-------------------|----------|
|
|
11
|
+
| **Web + X Search** | Real-time information with transparent source URLs |
|
|
12
|
+
| **X/Twitter Search** | Track social media trends, public opinion, breaking news |
|
|
13
|
+
| **4-Agent Architecture** | Harper (research) + Benjamin (logic) + Lucas (creative) collaboration |
|
|
14
|
+
| **2M Token Context** | Massive context window with grok-4.20-beta |
|
|
15
|
+
|
|
16
|
+
> **Philosophy**: Claude is the commander, Grok is the specialist for real-time search and social media intelligence.
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
### 1. Get API Key
|
|
21
|
+
|
|
22
|
+
Visit [xAI Console](https://console.x.ai/) and create an API key.
|
|
23
|
+
|
|
24
|
+
### 2. Configure Claude Code
|
|
25
|
+
|
|
26
|
+
Add to your MCP config file:
|
|
27
|
+
|
|
28
|
+
- **Mac**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
29
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
30
|
+
- **Linux**: `~/.config/Claude/claude_desktop_config.json`
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"mcpServers": {
|
|
35
|
+
"grok-mcp": {
|
|
36
|
+
"command": "npx",
|
|
37
|
+
"args": ["-y", "@lkbaba/grok-mcp"],
|
|
38
|
+
"env": {
|
|
39
|
+
"XAI_API_KEY": "your_xai_api_key_here"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 3. Restart Claude Code
|
|
47
|
+
|
|
48
|
+
## Tools (2)
|
|
49
|
+
|
|
50
|
+
### grok_agent_search - Smart Search
|
|
51
|
+
|
|
52
|
+
Real-time web and X (Twitter) search powered by Grok.
|
|
53
|
+
|
|
54
|
+
| Parameter | Type | Required | Default | Description |
|
|
55
|
+
|-----------|------|----------|---------|-------------|
|
|
56
|
+
| `query` | string | Yes | - | Search query |
|
|
57
|
+
| `search_type` | enum | No | `mixed` | `web` / `x` / `mixed` (recommended) |
|
|
58
|
+
| `model` | enum | No | `grok-4.20-beta` | `grok-4.20-beta` (fast) / `grok-4-latest` (best quality) |
|
|
59
|
+
| `output_format` | enum | No | `text` | `text` (Markdown) / `json` (structured) |
|
|
60
|
+
| `web_search_config` | object | No | - | Domain filters, image understanding |
|
|
61
|
+
| `x_search_config` | object | No | - | Date range, handle filters, video understanding |
|
|
62
|
+
|
|
63
|
+
**Example:**
|
|
64
|
+
```
|
|
65
|
+
"Search for the latest Claude Code updates on X and the web"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### grok_brainstorm - Creative Brainstorming
|
|
69
|
+
|
|
70
|
+
Multi-perspective idea generation with project context support.
|
|
71
|
+
|
|
72
|
+
| Parameter | Type | Required | Default | Description |
|
|
73
|
+
|-----------|------|----------|---------|-------------|
|
|
74
|
+
| `topic` | string | Yes | - | Brainstorming topic |
|
|
75
|
+
| `context` | string | No | - | Additional context |
|
|
76
|
+
| `context_files` | string[] | No | - | Project files to read as context |
|
|
77
|
+
| `count` | number | No | `5` | Number of ideas (1-10) |
|
|
78
|
+
| `style` | enum | No | `balanced` | `innovative` / `practical` / `radical` / `balanced` |
|
|
79
|
+
| `model` | enum | No | `grok-4.20-beta` | Model selection |
|
|
80
|
+
| `output_format` | enum | No | `text` | `text` (Markdown) / `json` (structured with pros/cons/feasibility) |
|
|
81
|
+
|
|
82
|
+
**Example:**
|
|
83
|
+
```
|
|
84
|
+
"Brainstorm 3 practical ideas for improving user onboarding, read ./README.md for context"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Model Selection
|
|
88
|
+
|
|
89
|
+
| Model | Price (input/output) | Context | Speed | Best For |
|
|
90
|
+
|-------|---------------------|---------|-------|----------|
|
|
91
|
+
| `grok-4.20-beta` | $0.20 / $0.50 per M | 2M | Fast | Default, 4-Agent native, lowest hallucination |
|
|
92
|
+
| `grok-4-latest` | $2.50 / $10.00 per M | 256K | Slow | Complex tasks requiring highest quality |
|
|
93
|
+
|
|
94
|
+
## Performance
|
|
95
|
+
|
|
96
|
+
Tested on 2026-03-12:
|
|
97
|
+
|
|
98
|
+
| Operation | Model | Time | Tokens |
|
|
99
|
+
|-----------|-------|------|--------|
|
|
100
|
+
| Web Search | grok-4.20-beta | ~29s | ~70K |
|
|
101
|
+
| X Search | grok-4.20-beta | ~28s | ~48K |
|
|
102
|
+
| Brainstorm (3 ideas) | grok-4.20-beta | ~16s | ~3.6K |
|
|
103
|
+
|
|
104
|
+
## Proxy Configuration
|
|
105
|
+
|
|
106
|
+
<details>
|
|
107
|
+
<summary>For users behind proxy/VPN</summary>
|
|
108
|
+
|
|
109
|
+
Add proxy environment variable to your config:
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"mcpServers": {
|
|
114
|
+
"grok-mcp": {
|
|
115
|
+
"command": "npx",
|
|
116
|
+
"args": ["-y", "@lkbaba/grok-mcp"],
|
|
117
|
+
"env": {
|
|
118
|
+
"XAI_API_KEY": "your_xai_api_key_here",
|
|
119
|
+
"HTTPS_PROXY": "http://127.0.0.1:7897"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Native `fetch` (undici) automatically reads proxy environment variables.
|
|
127
|
+
</details>
|
|
128
|
+
|
|
129
|
+
## Local Development
|
|
130
|
+
|
|
131
|
+
<details>
|
|
132
|
+
<summary>Build from source</summary>
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
git clone https://github.com/LKbaba/Grok-mcp.git
|
|
136
|
+
cd Grok-mcp
|
|
137
|
+
npm install
|
|
138
|
+
npm run build
|
|
139
|
+
export XAI_API_KEY="your_xai_api_key_here"
|
|
140
|
+
npm start
|
|
141
|
+
```
|
|
142
|
+
</details>
|
|
143
|
+
|
|
144
|
+
## Project Structure
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
src/
|
|
148
|
+
├── config/
|
|
149
|
+
│ └── index.ts # Configuration (zod validation)
|
|
150
|
+
├── types/
|
|
151
|
+
│ └── index.ts # TypeScript type definitions
|
|
152
|
+
├── tools/
|
|
153
|
+
│ ├── definitions.ts # MCP tool JSON Schema definitions
|
|
154
|
+
│ ├── agent-search.ts # grok_agent_search implementation
|
|
155
|
+
│ └── brainstorm.ts # grok_brainstorm implementation
|
|
156
|
+
├── utils/
|
|
157
|
+
│ ├── grok-client.ts # xAI API client (native fetch)
|
|
158
|
+
│ ├── tool-builder.ts # Search tool parameter builder
|
|
159
|
+
│ └── logger.ts # Logging and performance monitoring
|
|
160
|
+
└── index.ts # MCP server entry point
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Comparison with Gemini MCP
|
|
164
|
+
|
|
165
|
+
| Feature | Gemini MCP | Grok MCP |
|
|
166
|
+
|---------|-----------|----------|
|
|
167
|
+
| Web Search | Google Search (grounding) | Grok Web Search |
|
|
168
|
+
| X/Twitter Search | Not available | **Native support** |
|
|
169
|
+
| Citation URLs | Google redirect (opaque) | **Direct URLs (transparent)** |
|
|
170
|
+
| Search Speed | ~8-10s (flash) | ~16-29s (grok-4.20) |
|
|
171
|
+
| Codebase Analysis | 1M token context | Not available |
|
|
172
|
+
| Multimodal | Image analysis | Not available |
|
|
173
|
+
| Brainstorm | Structured JSON | **Structured JSON + style/count/context_files** |
|
|
174
|
+
|
|
175
|
+
**Best strategy**: Use both! Gemini for speed and code analysis, Grok for deep search and X/Twitter intelligence.
|
|
176
|
+
|
|
177
|
+
## License
|
|
178
|
+
|
|
179
|
+
MIT
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grok-MCP Configuration Module
|
|
3
|
+
*
|
|
4
|
+
* Loads environment variables, validates config, and exports type-safe configuration objects
|
|
5
|
+
*/
|
|
6
|
+
import type { GrokMCPConfig } from '../types/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* Supported model list
|
|
9
|
+
* grok-4.20-beta: Default model, fast, affordable, 2M context, 4-Agent native architecture
|
|
10
|
+
* grok-4-latest: Flagship model, highest quality, suitable for complex tasks
|
|
11
|
+
*/
|
|
12
|
+
export declare const SUPPORTED_MODELS: readonly ["grok-4.20-beta", "grok-4-latest"];
|
|
13
|
+
export type SupportedModel = typeof SUPPORTED_MODELS[number];
|
|
14
|
+
/**
|
|
15
|
+
* xAI API configuration
|
|
16
|
+
*/
|
|
17
|
+
export declare const xaiConfig: {
|
|
18
|
+
/** API key */
|
|
19
|
+
readonly apiKey: string;
|
|
20
|
+
/** API base URL */
|
|
21
|
+
readonly baseURL: "https://api.x.ai/v1";
|
|
22
|
+
/** Default model (v3: switched from grok-4-latest to grok-4.20-beta) */
|
|
23
|
+
readonly defaultModel: SupportedModel;
|
|
24
|
+
/** Request timeout (milliseconds) */
|
|
25
|
+
readonly timeout: 120000;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* MCP service configuration
|
|
29
|
+
*/
|
|
30
|
+
export declare const mcpConfig: {
|
|
31
|
+
/** Service name */
|
|
32
|
+
readonly name: "grok-mcp";
|
|
33
|
+
/** Service version */
|
|
34
|
+
readonly version: "1.0.0";
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Debug mode
|
|
38
|
+
*/
|
|
39
|
+
export declare const debugMode: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Full configuration object
|
|
42
|
+
*/
|
|
43
|
+
export declare const config: GrokMCPConfig;
|
|
44
|
+
/**
|
|
45
|
+
* Print configuration info (for debugging)
|
|
46
|
+
*/
|
|
47
|
+
export declare function printConfig(): void;
|
|
48
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAuDvD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,8CAA+C,CAAC;AAC7E,MAAM,MAAM,cAAc,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,SAAS;IACpB,cAAc;;IAEd,mBAAmB;;IAEnB,wEAAwE;2BACtC,cAAc;IAChD,qCAAqC;;CAE7B,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,SAAS;IACpB,mBAAmB;;IAEnB,sBAAsB;;CAEd,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,SAAS,SAAuB,CAAC;AAE9C;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,aAKpB,CAAC;AAEF;;GAEG;AACH,wBAAgB,WAAW,SAO1B"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grok-MCP Configuration Module
|
|
3
|
+
*
|
|
4
|
+
* Loads environment variables, validates config, and exports type-safe configuration objects
|
|
5
|
+
*/
|
|
6
|
+
import { config as dotenvConfig } from 'dotenv';
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
// Load .env file
|
|
9
|
+
dotenvConfig();
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// Config Validation Schema
|
|
12
|
+
// ============================================================================
|
|
13
|
+
/**
|
|
14
|
+
* Environment variable validation schema
|
|
15
|
+
*/
|
|
16
|
+
const envSchema = z.object({
|
|
17
|
+
// xAI API configuration
|
|
18
|
+
XAI_API_KEY: z.string().min(1, 'XAI_API_KEY environment variable is required'),
|
|
19
|
+
// Debug mode (optional)
|
|
20
|
+
DEBUG: z.string().optional(),
|
|
21
|
+
});
|
|
22
|
+
// ============================================================================
|
|
23
|
+
// Config Validation & Loading
|
|
24
|
+
// ============================================================================
|
|
25
|
+
/**
|
|
26
|
+
* Validate environment variables
|
|
27
|
+
*/
|
|
28
|
+
function validateEnv() {
|
|
29
|
+
try {
|
|
30
|
+
return envSchema.parse(process.env);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
if (error instanceof z.ZodError) {
|
|
34
|
+
const messages = error.errors.map((err) => ` - ${err.path.join('.')}: ${err.message}`);
|
|
35
|
+
throw new Error(`Configuration validation failed:\n${messages.join('\n')}\n\n` +
|
|
36
|
+
'Please check your .env file or set the required environment variables.\n' +
|
|
37
|
+
'Refer to .env.example for required configuration items.');
|
|
38
|
+
}
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Validated environment variables
|
|
44
|
+
*/
|
|
45
|
+
const env = validateEnv();
|
|
46
|
+
// ============================================================================
|
|
47
|
+
// Export Configuration Objects
|
|
48
|
+
// ============================================================================
|
|
49
|
+
/**
|
|
50
|
+
* Supported model list
|
|
51
|
+
* grok-4.20-beta: Default model, fast, affordable, 2M context, 4-Agent native architecture
|
|
52
|
+
* grok-4-latest: Flagship model, highest quality, suitable for complex tasks
|
|
53
|
+
*/
|
|
54
|
+
export const SUPPORTED_MODELS = ['grok-4.20-beta', 'grok-4-latest'];
|
|
55
|
+
/**
|
|
56
|
+
* xAI API configuration
|
|
57
|
+
*/
|
|
58
|
+
export const xaiConfig = {
|
|
59
|
+
/** API key */
|
|
60
|
+
apiKey: env.XAI_API_KEY,
|
|
61
|
+
/** API base URL */
|
|
62
|
+
baseURL: 'https://api.x.ai/v1',
|
|
63
|
+
/** Default model (v3: switched from grok-4-latest to grok-4.20-beta) */
|
|
64
|
+
defaultModel: 'grok-4.20-beta',
|
|
65
|
+
/** Request timeout (milliseconds) */
|
|
66
|
+
timeout: 120000, // 120 seconds
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* MCP service configuration
|
|
70
|
+
*/
|
|
71
|
+
export const mcpConfig = {
|
|
72
|
+
/** Service name */
|
|
73
|
+
name: 'grok-mcp',
|
|
74
|
+
/** Service version */
|
|
75
|
+
version: '1.0.0',
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Debug mode
|
|
79
|
+
*/
|
|
80
|
+
export const debugMode = env.DEBUG === 'true';
|
|
81
|
+
/**
|
|
82
|
+
* Full configuration object
|
|
83
|
+
*/
|
|
84
|
+
export const config = {
|
|
85
|
+
apiKey: xaiConfig.apiKey,
|
|
86
|
+
baseURL: xaiConfig.baseURL,
|
|
87
|
+
model: xaiConfig.defaultModel,
|
|
88
|
+
debug: debugMode,
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Print configuration info (for debugging)
|
|
92
|
+
*/
|
|
93
|
+
export function printConfig() {
|
|
94
|
+
console.error('Grok-MCP Configuration:');
|
|
95
|
+
console.error(' - API URL:', xaiConfig.baseURL);
|
|
96
|
+
console.error(' - Default Model:', xaiConfig.defaultModel);
|
|
97
|
+
console.error(' - Timeout:', xaiConfig.timeout, 'ms');
|
|
98
|
+
console.error(' - Debug Mode:', debugMode ? 'enabled' : 'disabled');
|
|
99
|
+
console.error(' - MCP Service:', `${mcpConfig.name} v${mcpConfig.version}`);
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,iBAAiB;AACjB,YAAY,EAAE,CAAC;AAEf,+EAA+E;AAC/E,2BAA2B;AAC3B,+EAA+E;AAE/E;;GAEG;AACH,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IACzB,wBAAwB;IACxB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,8CAA8C,CAAC;IAE9E,wBAAwB;IACxB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC,CAAC;AAEH,+EAA+E;AAC/E,8BAA8B;AAC9B,+EAA+E;AAE/E;;GAEG;AACH,SAAS,WAAW;IAClB,IAAI,CAAC;QACH,OAAO,SAAS,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,EAAE,SAAS,CAAC,MAAM;IACxB,OAAO,EAAE,SAAS,CAAC,OAAO;IAC1B,KAAK,EAAE,SAAS,CAAC,YAAY;IAC7B,KAAK,EAAE,SAAS;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACzC,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IACjD,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;IAC5D,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACvD,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IACrE,OAAO,CAAC,KAAK,CAAC,kBAAkB,EAAE,GAAG,SAAS,CAAC,IAAI,KAAK,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;AAC/E,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;GAGG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Grok-MCP Entry Point
|
|
4
|
+
* MCP protocol-based Grok API service
|
|
5
|
+
*/
|
|
6
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
7
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
8
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
9
|
+
import { mcpConfig } from './config/index.js';
|
|
10
|
+
import { TOOL_DEFINITIONS } from './tools/definitions.js';
|
|
11
|
+
import { grokAgentSearch } from './tools/agent-search.js';
|
|
12
|
+
import { grokBrainstorm } from './tools/brainstorm.js';
|
|
13
|
+
import { logger, startPerformanceMonitor } from './utils/logger.js';
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// MCP Server Initialization
|
|
16
|
+
// ============================================================================
|
|
17
|
+
/**
|
|
18
|
+
* Create MCP server instance
|
|
19
|
+
*/
|
|
20
|
+
const server = new Server({
|
|
21
|
+
name: mcpConfig.name,
|
|
22
|
+
version: mcpConfig.version,
|
|
23
|
+
}, {
|
|
24
|
+
capabilities: {
|
|
25
|
+
tools: {},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
// ============================================================================
|
|
29
|
+
// Request Handlers
|
|
30
|
+
// ============================================================================
|
|
31
|
+
/**
|
|
32
|
+
* Handle tools/list request
|
|
33
|
+
*/
|
|
34
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
35
|
+
logger.debug('Received tools/list request');
|
|
36
|
+
return { tools: TOOL_DEFINITIONS };
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* Handle tools/call request
|
|
40
|
+
*/
|
|
41
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
42
|
+
const { name, arguments: args } = request.params;
|
|
43
|
+
logger.info(`Received tool call: ${name}`);
|
|
44
|
+
logger.debug('Tool arguments', args);
|
|
45
|
+
// Start performance monitoring
|
|
46
|
+
const monitor = startPerformanceMonitor(`Tool call: ${name}`);
|
|
47
|
+
try {
|
|
48
|
+
switch (name) {
|
|
49
|
+
case 'grok_agent_search': {
|
|
50
|
+
// Call grok_agent_search tool
|
|
51
|
+
const input = args;
|
|
52
|
+
const result = await grokAgentSearch(input);
|
|
53
|
+
// Record performance and usage stats
|
|
54
|
+
const duration = monitor.end({
|
|
55
|
+
tokens: result.usage.total_tokens,
|
|
56
|
+
citations: result.citations.length,
|
|
57
|
+
});
|
|
58
|
+
// Format output
|
|
59
|
+
let output = `# Search Results\n\n${result.content}\n\n`;
|
|
60
|
+
if (result.citations.length > 0) {
|
|
61
|
+
output += `## Citations\n\n`;
|
|
62
|
+
result.citations.forEach((url, index) => {
|
|
63
|
+
output += `${index + 1}. ${url}\n`;
|
|
64
|
+
});
|
|
65
|
+
output += `\n`;
|
|
66
|
+
}
|
|
67
|
+
output += `## Usage Statistics\n\n`;
|
|
68
|
+
output += `- Model: ${input.model || 'grok-4.20-beta'}\n`;
|
|
69
|
+
output += `- Input Tokens: ${result.usage.input_tokens}\n`;
|
|
70
|
+
output += `- Output Tokens: ${result.usage.output_tokens}\n`;
|
|
71
|
+
output += `- Reasoning Tokens: ${result.usage.reasoning_tokens}\n`;
|
|
72
|
+
output += `- Total Tokens: ${result.usage.total_tokens}\n`;
|
|
73
|
+
output += `- Web Search Calls: ${result.usage.web_search_calls}\n`;
|
|
74
|
+
output += `- X Search Calls: ${result.usage.x_search_calls}\n`;
|
|
75
|
+
output += `- Duration: ${duration}ms\n`;
|
|
76
|
+
logger.info(`Search completed in ${duration}ms`);
|
|
77
|
+
return {
|
|
78
|
+
content: [
|
|
79
|
+
{
|
|
80
|
+
type: 'text',
|
|
81
|
+
text: output,
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
case 'grok_brainstorm': {
|
|
87
|
+
// Call grok_brainstorm tool
|
|
88
|
+
const input = args;
|
|
89
|
+
const result = await grokBrainstorm(input);
|
|
90
|
+
// Record performance and usage stats
|
|
91
|
+
const duration = monitor.end({
|
|
92
|
+
tokens: result.usage.total_tokens,
|
|
93
|
+
});
|
|
94
|
+
// Format output
|
|
95
|
+
let output = `# Brainstorm Results\n\n`;
|
|
96
|
+
output += `**Topic**: ${input.topic}\n`;
|
|
97
|
+
output += `**Style**: ${input.style || 'balanced'} | **Count**: ${input.count || 5}\n\n`;
|
|
98
|
+
if (input.context) {
|
|
99
|
+
output += `**Context**: ${input.context}\n\n`;
|
|
100
|
+
}
|
|
101
|
+
if (input.context_files && input.context_files.length > 0) {
|
|
102
|
+
output += `**Reference Files**: ${input.context_files.join(', ')}\n\n`;
|
|
103
|
+
}
|
|
104
|
+
output += `---\n\n${result.content}\n\n`;
|
|
105
|
+
output += `---\n\n## Usage Statistics\n\n`;
|
|
106
|
+
output += `- Model: ${input.model || 'grok-4.20-beta'}\n`;
|
|
107
|
+
output += `- Input Tokens: ${result.usage.input_tokens}\n`;
|
|
108
|
+
output += `- Output Tokens: ${result.usage.output_tokens}\n`;
|
|
109
|
+
output += `- Reasoning Tokens: ${result.usage.reasoning_tokens}\n`;
|
|
110
|
+
output += `- Total Tokens: ${result.usage.total_tokens}\n`;
|
|
111
|
+
output += `- Duration: ${duration}ms\n`;
|
|
112
|
+
logger.info(`Brainstorm completed in ${duration}ms`);
|
|
113
|
+
return {
|
|
114
|
+
content: [
|
|
115
|
+
{
|
|
116
|
+
type: 'text',
|
|
117
|
+
text: output,
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
default:
|
|
123
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
logger.error(`Tool call failed: ${name}`, error);
|
|
128
|
+
throw error;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
// ============================================================================
|
|
132
|
+
// Server Startup
|
|
133
|
+
// ============================================================================
|
|
134
|
+
/**
|
|
135
|
+
* Start MCP server
|
|
136
|
+
*/
|
|
137
|
+
async function main() {
|
|
138
|
+
try {
|
|
139
|
+
logger.info('Starting Grok-MCP server...');
|
|
140
|
+
logger.info(`Service name: ${mcpConfig.name}`);
|
|
141
|
+
logger.info(`Service version: ${mcpConfig.version}`);
|
|
142
|
+
const transport = new StdioServerTransport();
|
|
143
|
+
await server.connect(transport);
|
|
144
|
+
logger.info('Grok-MCP server started');
|
|
145
|
+
logger.info('Waiting for client connection...');
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
logger.error('Server startup failed', error);
|
|
149
|
+
process.exit(1);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
// ============================================================================
|
|
153
|
+
// Error Handling
|
|
154
|
+
// ============================================================================
|
|
155
|
+
/**
|
|
156
|
+
* Handle uncaught exceptions
|
|
157
|
+
*/
|
|
158
|
+
process.on('uncaughtException', (error) => {
|
|
159
|
+
logger.error('Uncaught exception', error);
|
|
160
|
+
process.exit(1);
|
|
161
|
+
});
|
|
162
|
+
/**
|
|
163
|
+
* Handle unhandled promise rejections
|
|
164
|
+
* Only log the error, do not exit — a single request failure should not terminate the MCP server
|
|
165
|
+
*/
|
|
166
|
+
process.on('unhandledRejection', (reason, promise) => {
|
|
167
|
+
logger.error('Unhandled promise rejection', reason);
|
|
168
|
+
});
|
|
169
|
+
/**
|
|
170
|
+
* Handle process termination signals
|
|
171
|
+
*/
|
|
172
|
+
process.on('SIGINT', () => {
|
|
173
|
+
logger.info('Received SIGINT, shutting down server...');
|
|
174
|
+
process.exit(0);
|
|
175
|
+
});
|
|
176
|
+
process.on('SIGTERM', () => {
|
|
177
|
+
logger.info('Received SIGTERM, shutting down server...');
|
|
178
|
+
process.exit(0);
|
|
179
|
+
});
|
|
180
|
+
// Start server
|
|
181
|
+
main();
|
|
182
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,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AAE,KAAK,CAAC,CAAC;QAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E;;GAEG;AACH,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE;IACxC,MAAM,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;IAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH;;;GAGG;AACH,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;IACnD,MAAM,CAAC,KAAK,CAAC,6BAA6B,EAAE,MAAe,CAAC,CAAC;AAC/D,CAAC,CAAC,CAAC;AAEH;;GAEG;AACH,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;IACxB,MAAM,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;IACxD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;IACzB,MAAM,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;IACzD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,eAAe;AACf,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* grok_agent_search Tool Implementation
|
|
3
|
+
*
|
|
4
|
+
* Intelligent search using Grok AI, supports Web search, X search, or mixed search
|
|
5
|
+
*/
|
|
6
|
+
import type { GrokAgentSearchInput, GrokAgentSearchOutput } from '../types/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* grok_agent_search main function
|
|
9
|
+
*
|
|
10
|
+
* @param input - Search input parameters
|
|
11
|
+
* @returns Search result
|
|
12
|
+
*/
|
|
13
|
+
export declare function grokAgentSearch(input: GrokAgentSearchInput): Promise<GrokAgentSearchOutput>;
|
|
14
|
+
//# sourceMappingURL=agent-search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-search.d.ts","sourceRoot":"","sources":["../../src/tools/agent-search.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAyB3B;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC,qBAAqB,CAAC,CAmIhC"}
|