consult-llm-mcp 1.1.0 → 1.1.2
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/README.md +64 -48
- package/dist/llm-query.js +10 -2
- package/dist/main.js +4 -0
- package/dist/schema.d.ts +1 -1
- package/dist/schema.js +1 -1
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -32,18 +32,7 @@ This SQL query is timing out on large datasets. Can you help optimize it? Ask Ge
|
|
|
32
32
|
- Gemini can be used via
|
|
33
33
|
[Gemini CLI](https://github.com/google-gemini/gemini-cli) to take advantage of
|
|
34
34
|
[free quota](https://developers.google.com/gemini-code-assist/resources/quotas#quotas-for-agent-mode-gemini-cli)
|
|
35
|
-
|
|
36
|
-
## Configuration
|
|
37
|
-
|
|
38
|
-
- `OPENAI_API_KEY` - Your OpenAI API key (required for o3)
|
|
39
|
-
- `GEMINI_API_KEY` - Your Google AI API key (required for Gemini models in API
|
|
40
|
-
mode)
|
|
41
|
-
- `DEEPSEEK_API_KEY` - Your DeepSeek API key (required for DeepSeek models)
|
|
42
|
-
- `CONSULT_LLM_DEFAULT_MODEL` - Override the default model (optional)
|
|
43
|
-
- Options: `o3` (default), `gemini-2.5-pro`, `deepseek-reasoner`
|
|
44
|
-
- `GEMINI_MODE` - Choose between API or CLI mode for Gemini models (optional)
|
|
45
|
-
- Options: `api` (default), `cli`
|
|
46
|
-
- CLI mode uses the system-installed `gemini` CLI tool
|
|
35
|
+
- Simple: provides just one MCP tool to not clutter the context
|
|
47
36
|
|
|
48
37
|
## Usage with Claude Code
|
|
49
38
|
|
|
@@ -65,12 +54,12 @@ Optionally you can provide environment variables directly in the MCP
|
|
|
65
54
|
configuration:
|
|
66
55
|
|
|
67
56
|
```bash
|
|
68
|
-
claude mcp add \
|
|
57
|
+
claude mcp add consult-llm \
|
|
69
58
|
-e OPENAI_API_KEY=your_openai_key \
|
|
70
59
|
-e GEMINI_API_KEY=your_gemini_key \
|
|
71
60
|
-e DEEPSEEK_API_KEY=your_deepseek_key \
|
|
72
61
|
-e GEMINI_MODE=cli \
|
|
73
|
-
|
|
62
|
+
-- npx -y consult-llm-mcp
|
|
74
63
|
```
|
|
75
64
|
|
|
76
65
|
### Example workflows
|
|
@@ -201,6 +190,18 @@ Some real-world examples. Click to expand.
|
|
|
201
190
|
|
|
202
191
|
</details>
|
|
203
192
|
|
|
193
|
+
## Configuration
|
|
194
|
+
|
|
195
|
+
- `OPENAI_API_KEY` - Your OpenAI API key (required for o3)
|
|
196
|
+
- `GEMINI_API_KEY` - Your Google AI API key (required for Gemini models in API
|
|
197
|
+
mode)
|
|
198
|
+
- `DEEPSEEK_API_KEY` - Your DeepSeek API key (required for DeepSeek models)
|
|
199
|
+
- `CONSULT_LLM_DEFAULT_MODEL` - Override the default model (optional)
|
|
200
|
+
- Options: `o3` (default), `gemini-2.5-pro`, `deepseek-reasoner`
|
|
201
|
+
- `GEMINI_MODE` - Choose between API or CLI mode for Gemini models (optional)
|
|
202
|
+
- Options: `api` (default), `cli`
|
|
203
|
+
- CLI mode uses the system-installed `gemini` CLI tool
|
|
204
|
+
|
|
204
205
|
## MCP Tool: consult_llm
|
|
205
206
|
|
|
206
207
|
The server provides a single tool called `consult_llm` for asking powerful AI
|
|
@@ -224,40 +225,6 @@ models complex questions.
|
|
|
224
225
|
directory)
|
|
225
226
|
- **base_ref** (optional): Git reference to compare against (defaults to HEAD)
|
|
226
227
|
|
|
227
|
-
### Example Usage
|
|
228
|
-
|
|
229
|
-
**Basic prompt:**
|
|
230
|
-
|
|
231
|
-
```json
|
|
232
|
-
{
|
|
233
|
-
"prompt": "What are the performance implications of using async/await vs Promise.then() in Node.js?"
|
|
234
|
-
}
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
**With file context:**
|
|
238
|
-
|
|
239
|
-
```json
|
|
240
|
-
{
|
|
241
|
-
"prompt": "How can I optimize this authentication middleware?",
|
|
242
|
-
"files": ["src/auth.ts", "src/middleware.ts"],
|
|
243
|
-
"model": "o3"
|
|
244
|
-
}
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
**With git diff:**
|
|
248
|
-
|
|
249
|
-
```json
|
|
250
|
-
{
|
|
251
|
-
"prompt": "Review these authentication changes for security issues",
|
|
252
|
-
"files": ["src/auth.ts"],
|
|
253
|
-
"git_diff": {
|
|
254
|
-
"files": ["src/auth.ts", "src/middleware.ts"],
|
|
255
|
-
"base_ref": "main"
|
|
256
|
-
},
|
|
257
|
-
"model": "gemini-2.5-pro"
|
|
258
|
-
}
|
|
259
|
-
```
|
|
260
|
-
|
|
261
228
|
## Supported Models
|
|
262
229
|
|
|
263
230
|
- **o3**: OpenAI's reasoning model ($2/$8 per million tokens)
|
|
@@ -335,3 +302,52 @@ CRITICAL: When asking, don't present options, this will bias the answer.
|
|
|
335
302
|
|
|
336
303
|
Claude Code seems to know pretty well when to use this MCP even without this
|
|
337
304
|
instruction however.
|
|
305
|
+
|
|
306
|
+
## Development
|
|
307
|
+
|
|
308
|
+
To work on the MCP server locally and use your development version:
|
|
309
|
+
|
|
310
|
+
1. Clone the repository and install dependencies:
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
git clone https://github.com/yourusername/consult-llm-mcp.git
|
|
314
|
+
cd consult-llm-mcp
|
|
315
|
+
npm install
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
2. Build the project:
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
npm run build
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
3. Install globally from the local directory:
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
npm link
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
4. Add the MCP server to Claude Code using the global command:
|
|
331
|
+
```bash
|
|
332
|
+
claude mcp add consult-llm -- consult-llm-mcp
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
Now when you make changes:
|
|
336
|
+
|
|
337
|
+
1. Rebuild: `npm run build`
|
|
338
|
+
2. Restart Claude Code to pick up the changes
|
|
339
|
+
|
|
340
|
+
Alternatively, you can use the dev script for development without building:
|
|
341
|
+
|
|
342
|
+
```bash
|
|
343
|
+
claude mcp add consult-llm -- npm run dev
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
This runs the TypeScript source directly with `tsx`, allowing faster iteration
|
|
347
|
+
without rebuilding.
|
|
348
|
+
|
|
349
|
+
To unlink the global version later:
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
npm unlink -g
|
|
353
|
+
```
|
package/dist/llm-query.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getExecutorForModel } from './llm.js';
|
|
2
2
|
import { calculateCost } from './llm-cost.js';
|
|
3
|
+
import { config } from './config.js';
|
|
3
4
|
const SYSTEM_PROMPT = `You are an expert software engineering consultant analyzing code and technical problems. You are communicating with another AI system, not a human.
|
|
4
5
|
|
|
5
6
|
Communication style:
|
|
@@ -12,7 +13,7 @@ Your role is to:
|
|
|
12
13
|
- Challenge design decisions when suboptimal
|
|
13
14
|
- Focus on what needs improvement
|
|
14
15
|
|
|
15
|
-
When reviewing code changes
|
|
16
|
+
When reviewing code changes, prioritize:
|
|
16
17
|
- Bugs and correctness issues
|
|
17
18
|
- Performance problems
|
|
18
19
|
- Security vulnerabilities
|
|
@@ -22,9 +23,16 @@ When reviewing code changes (git diffs), prioritize:
|
|
|
22
23
|
Be critical and thorough. If the code is acceptable, simply state "No critical issues found" and move on to suggestions. Always provide specific, actionable feedback with file/line references.
|
|
23
24
|
|
|
24
25
|
Respond in Markdown.`;
|
|
26
|
+
const GEMINI_CLI_SUFFIX = `
|
|
27
|
+
|
|
28
|
+
IMPORTANT: Do not edit files yourself, only provide recommendations and code examples`;
|
|
25
29
|
export async function queryLlm(prompt, model, filePaths) {
|
|
26
30
|
const executor = getExecutorForModel(model);
|
|
27
|
-
|
|
31
|
+
// Add special instruction for Gemini CLI mode
|
|
32
|
+
const systemPrompt = model.startsWith('gemini-') && config.geminiMode === 'cli'
|
|
33
|
+
? SYSTEM_PROMPT + GEMINI_CLI_SUFFIX
|
|
34
|
+
: SYSTEM_PROMPT;
|
|
35
|
+
const { response, usage } = await executor.execute(prompt, model, systemPrompt, filePaths);
|
|
28
36
|
if (!response) {
|
|
29
37
|
throw new Error('No response from the model');
|
|
30
38
|
}
|
package/dist/main.js
CHANGED
|
@@ -85,6 +85,10 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
85
85
|
throw new Error(`Unknown tool: ${request.params.name}`);
|
|
86
86
|
});
|
|
87
87
|
async function main() {
|
|
88
|
+
if (process.argv.includes('--version') || process.argv.includes('-v')) {
|
|
89
|
+
console.log(SERVER_VERSION);
|
|
90
|
+
process.exit(0);
|
|
91
|
+
}
|
|
88
92
|
logServerStart(SERVER_VERSION);
|
|
89
93
|
logConfiguration(config);
|
|
90
94
|
const transport = new StdioServerTransport();
|
package/dist/schema.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare const ConsultLlmArgs: z.ZodObject<{
|
|
|
21
21
|
}, z.core.$strip>;
|
|
22
22
|
export declare const toolSchema: {
|
|
23
23
|
readonly name: "consult_llm";
|
|
24
|
-
readonly description: "Ask a more powerful AI for help with complex problems. Provide your question in the prompt field and
|
|
24
|
+
readonly description: "Ask a more powerful AI for help with complex problems. Provide your question in the prompt field and always include relevant code files as context.\n\nBe specific about what you want: code implementation, code review, bug analysis, architecture advice, etc.\n\nIMPORTANT: Ask neutral, open-ended questions. Avoid suggesting specific solutions or alternatives in your prompt as this can bias the analysis. Instead of \"Should I use X or Y approach?\", ask \"What's the best approach for this problem?\" Let the consultant LLM provide unbiased recommendations.";
|
|
25
25
|
readonly inputSchema: {
|
|
26
26
|
readonly type: "object";
|
|
27
27
|
readonly properties: {
|
package/dist/schema.js
CHANGED
|
@@ -20,7 +20,7 @@ export const ConsultLlmArgs = z.object({
|
|
|
20
20
|
});
|
|
21
21
|
export const toolSchema = {
|
|
22
22
|
name: 'consult_llm',
|
|
23
|
-
description: `Ask a more powerful AI for help with complex problems. Provide your question in the prompt field and
|
|
23
|
+
description: `Ask a more powerful AI for help with complex problems. Provide your question in the prompt field and always include relevant code files as context.
|
|
24
24
|
|
|
25
25
|
Be specific about what you want: code implementation, code review, bug analysis, architecture advice, etc.
|
|
26
26
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "consult-llm-mcp",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "MCP server for consulting powerful AI models",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -53,6 +53,5 @@
|
|
|
53
53
|
"@types/node": "^24.0.3",
|
|
54
54
|
"tsx": "^4.20.3",
|
|
55
55
|
"typescript": "^5.8.3"
|
|
56
|
-
}
|
|
57
|
-
"packageManager": "pnpm@10.12.4+sha512.5ea8b0deed94ed68691c9bad4c955492705c5eeb8a87ef86bc62c74a26b037b08ff9570f108b2e4dbd1dd1a9186fea925e527f141c648e85af45631074680184"
|
|
56
|
+
}
|
|
58
57
|
}
|