consult-llm-mcp 1.0.1 → 1.0.3
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 +48 -12
- package/dist/llm.d.ts +1 -1
- package/dist/llm.js +9 -0
- package/dist/logger.d.ts +1 -0
- package/dist/logger.js +3 -0
- package/dist/main.js +9 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# Consult LLM MCP
|
|
2
2
|
|
|
3
|
-
An MCP (
|
|
4
|
-
AI models with your code and questions.
|
|
3
|
+
An MCP server that lets Claude Code consult stronger AI models (o3, Gemini 2.5 Pro, DeepSeek Reasoner) when you need deeper analysis on complex problems.
|
|
5
4
|
|
|
6
5
|
## Features
|
|
7
6
|
|
|
@@ -12,21 +11,13 @@ AI models with your code and questions.
|
|
|
12
11
|
- Usage tracking with cost estimation
|
|
13
12
|
- Comprehensive logging
|
|
14
13
|
|
|
15
|
-
## Installation
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm install
|
|
19
|
-
npm run build
|
|
20
|
-
npm install -g .
|
|
21
|
-
```
|
|
22
|
-
|
|
23
14
|
## Configuration
|
|
24
15
|
|
|
25
16
|
- `OPENAI_API_KEY` - Your OpenAI API key (required for o3)
|
|
26
17
|
- `GEMINI_API_KEY` - Your Google AI API key (required for Gemini models)
|
|
27
18
|
- `DEEPSEEK_API_KEY` - Your DeepSeek API key (required for DeepSeek models)
|
|
28
|
-
- `CONSULT_LLM_DEFAULT_MODEL` - Override the default model (optional
|
|
29
|
-
|
|
19
|
+
- `CONSULT_LLM_DEFAULT_MODEL` - Override the default model (optional)
|
|
20
|
+
- Options: `o3` (default), `gemini-2.5-pro`, `deepseek-reasoner`
|
|
30
21
|
|
|
31
22
|
## Usage with Claude Code
|
|
32
23
|
|
|
@@ -46,6 +37,8 @@ claude mcp add --scope user consult-llm -- npx -y consult-llm-mcp
|
|
|
46
37
|
|
|
47
38
|
### Example workflows
|
|
48
39
|
|
|
40
|
+
Click to expand.
|
|
41
|
+
|
|
49
42
|
<details>
|
|
50
43
|
<summary>Explain the problem, and tell CC to consult a smarter LLM</summary>
|
|
51
44
|
|
|
@@ -150,6 +143,49 @@ All prompts and responses are logged to `~/.consult-llm-mcp/logs/mcp.log` with:
|
|
|
150
143
|
- Full prompts and responses
|
|
151
144
|
- Token usage and cost estimates
|
|
152
145
|
|
|
146
|
+
<details>
|
|
147
|
+
<summary>Example</summary>
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
[2025-06-22T20:16:04.673Z] TOOL CALL: consult_llm
|
|
151
|
+
Arguments: {
|
|
152
|
+
"files": [
|
|
153
|
+
"refactor-analysis.md",
|
|
154
|
+
"src/main.ts",
|
|
155
|
+
"src/schema.ts",
|
|
156
|
+
"src/config.ts",
|
|
157
|
+
"src/llm.ts",
|
|
158
|
+
"src/llm-cost.ts"
|
|
159
|
+
],
|
|
160
|
+
"model": "deepseek-reasoner"
|
|
161
|
+
}
|
|
162
|
+
================================================================================
|
|
163
|
+
[2025-06-22T20:16:04.675Z] PROMPT (model: deepseek-reasoner):
|
|
164
|
+
## Relevant Files
|
|
165
|
+
|
|
166
|
+
### File: src/main.ts
|
|
167
|
+
|
|
168
|
+
...
|
|
169
|
+
|
|
170
|
+
Please provide specific suggestions for refactoring with example code structure
|
|
171
|
+
where helpful.
|
|
172
|
+
================================================================================
|
|
173
|
+
[2025-06-22T20:19:20.632Z] RESPONSE (model: deepseek-reasoner):
|
|
174
|
+
Based on the analysis, here are the key refactoring suggestions to improve
|
|
175
|
+
separation of concerns and maintainability:
|
|
176
|
+
|
|
177
|
+
...
|
|
178
|
+
|
|
179
|
+
This refactoring maintains all existing functionality while significantly
|
|
180
|
+
improving maintainability and separation of concerns. The new structure makes
|
|
181
|
+
it easier to add features like new LLM providers, additional context sources,
|
|
182
|
+
or alternative prompt formats.
|
|
183
|
+
|
|
184
|
+
Tokens: 3440 input, 5880 output | Cost: $0.014769 (input: $0.001892, output: $0.012877)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
</details>
|
|
188
|
+
|
|
153
189
|
## CLAUDE.md example
|
|
154
190
|
|
|
155
191
|
To help Claude Code understand when and how to use this tool, you can add the
|
package/dist/llm.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
2
|
import { type SupportedChatModel as SupportedChatModelType } from './schema.js';
|
|
3
|
-
export declare function getClientForModel(model: SupportedChatModelType
|
|
3
|
+
export declare function getClientForModel(model: SupportedChatModelType): {
|
|
4
4
|
client: OpenAI;
|
|
5
5
|
};
|
package/dist/llm.js
CHANGED
|
@@ -4,6 +4,9 @@ const clients = {};
|
|
|
4
4
|
export function getClientForModel(model) {
|
|
5
5
|
if (model.startsWith('gpt-') || model === 'o3') {
|
|
6
6
|
if (!clients.openai) {
|
|
7
|
+
if (!config.openaiApiKey) {
|
|
8
|
+
throw new Error('OPENAI_API_KEY environment variable is required for OpenAI models');
|
|
9
|
+
}
|
|
7
10
|
clients.openai = new OpenAI({
|
|
8
11
|
apiKey: config.openaiApiKey,
|
|
9
12
|
});
|
|
@@ -12,6 +15,9 @@ export function getClientForModel(model) {
|
|
|
12
15
|
}
|
|
13
16
|
else if (model.startsWith('gemini-')) {
|
|
14
17
|
if (!clients.gemini) {
|
|
18
|
+
if (!config.geminiApiKey) {
|
|
19
|
+
throw new Error('GEMINI_API_KEY environment variable is required for Gemini models');
|
|
20
|
+
}
|
|
15
21
|
clients.gemini = new OpenAI({
|
|
16
22
|
apiKey: config.geminiApiKey,
|
|
17
23
|
baseURL: 'https://generativelanguage.googleapis.com/v1beta/openai/',
|
|
@@ -21,6 +27,9 @@ export function getClientForModel(model) {
|
|
|
21
27
|
}
|
|
22
28
|
else if (model.startsWith('deepseek-')) {
|
|
23
29
|
if (!clients.deepseek) {
|
|
30
|
+
if (!config.deepseekApiKey) {
|
|
31
|
+
throw new Error('DEEPSEEK_API_KEY environment variable is required for DeepSeek models');
|
|
32
|
+
}
|
|
24
33
|
clients.deepseek = new OpenAI({
|
|
25
34
|
apiKey: config.deepseekApiKey,
|
|
26
35
|
baseURL: 'https://api.deepseek.com',
|
package/dist/logger.d.ts
CHANGED
|
@@ -2,3 +2,4 @@ export declare function logToFile(content: string): void;
|
|
|
2
2
|
export declare function logToolCall(name: string, args: unknown): void;
|
|
3
3
|
export declare function logPrompt(model: string, prompt: string): void;
|
|
4
4
|
export declare function logResponse(model: string, response: string, costInfo: string): void;
|
|
5
|
+
export declare function logServerStart(version: string): void;
|
package/dist/logger.js
CHANGED
|
@@ -28,3 +28,6 @@ export function logPrompt(model, prompt) {
|
|
|
28
28
|
export function logResponse(model, response, costInfo) {
|
|
29
29
|
logToFile(`RESPONSE (model: ${model}):\n${response}\n${costInfo}\n${'='.repeat(80)}`);
|
|
30
30
|
}
|
|
31
|
+
export function logServerStart(version) {
|
|
32
|
+
logToFile(`MCP SERVER STARTED - consult-llm-mcp v${version}\n${'='.repeat(80)}`);
|
|
33
|
+
}
|
package/dist/main.js
CHANGED
|
@@ -8,10 +8,16 @@ import { processFiles } from './file.js';
|
|
|
8
8
|
import { generateGitDiff } from './git.js';
|
|
9
9
|
import { buildPrompt } from './prompt-builder.js';
|
|
10
10
|
import { queryLlm } from './llm-query.js';
|
|
11
|
-
import { logToolCall, logPrompt, logResponse } from './logger.js';
|
|
11
|
+
import { logToolCall, logPrompt, logResponse, logServerStart, } from './logger.js';
|
|
12
|
+
import { readFileSync } from 'fs';
|
|
13
|
+
import { dirname, join } from 'path';
|
|
14
|
+
import { fileURLToPath } from 'url';
|
|
15
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
16
|
+
const packageJson = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf-8'));
|
|
17
|
+
const SERVER_VERSION = packageJson.version;
|
|
12
18
|
const server = new Server({
|
|
13
19
|
name: 'consult_llm',
|
|
14
|
-
version:
|
|
20
|
+
version: SERVER_VERSION,
|
|
15
21
|
}, {
|
|
16
22
|
capabilities: {
|
|
17
23
|
tools: {},
|
|
@@ -61,6 +67,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
61
67
|
throw new Error(`Unknown tool: ${request.params.name}`);
|
|
62
68
|
});
|
|
63
69
|
async function main() {
|
|
70
|
+
logServerStart(SERVER_VERSION);
|
|
64
71
|
const transport = new StdioServerTransport();
|
|
65
72
|
await server.connect(transport);
|
|
66
73
|
}
|