converse-mcp-server 1.5.1 → 1.5.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/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright 2025 Converse MCP Server Contributors
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/README.md CHANGED
@@ -1,20 +1,22 @@
1
1
  # Converse MCP Server
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/converse-mcp-server.svg)](https://www.npmjs.com/package/converse-mcp-server)
4
+
3
5
  A simplified, functional Node.js implementation of an MCP (Model Context Protocol) server with chat and consensus tools. Built with modern Node.js practices and official SDKs for seamless AI provider integration.
4
6
 
5
7
  ## 🚀 Quick Start
6
8
 
7
- ### Option 1: Direct from GitHub (Recommended)
9
+ ### Option 1: Direct from NPM (Recommended)
8
10
 
9
11
  ```bash
10
12
  # Using npx (recommended)
11
- npx FallDownTheSystem/converse
13
+ npx converse-mcp-server
12
14
 
13
15
  # Using pnpm dlx (alternative)
14
- pnpm dlx FallDownTheSystem/converse
16
+ pnpm dlx converse-mcp-server
15
17
 
16
18
  # Using yarn dlx (alternative)
17
- yarn dlx FallDownTheSystem/converse
19
+ yarn dlx converse-mcp-server
18
20
  ```
19
21
 
20
22
  ### Option 2: Clone and Install
@@ -63,7 +65,6 @@ LOG_LEVEL=info
63
65
  MAX_MCP_OUTPUT_TOKENS=200000
64
66
 
65
67
  # Optional: Provider-specific settings
66
- GOOGLE_LOCATION=us-central1
67
68
  XAI_BASE_URL=https://api.x.ai/v1
68
69
  OPENROUTER_REFERER=https://github.com/FallDownTheSystem/converse
69
70
  ```
@@ -91,7 +92,7 @@ There are several ways to add the Converse MCP Server to Claude:
91
92
  "mcpServers": {
92
93
  "converse": {
93
94
  "command": "npx",
94
- "args": ["FallDownTheSystem/converse"],
95
+ "args": ["converse-mcp-server"],
95
96
  "env": {
96
97
  "OPENAI_API_KEY": "your_key_here",
97
98
  "GOOGLE_API_KEY": "your_key_here",
@@ -108,31 +109,7 @@ There are several ways to add the Converse MCP Server to Claude:
108
109
  }
109
110
  ```
110
111
 
111
- #### Option B: Using NPX with stdio transport
112
-
113
- ```json
114
- {
115
- "mcpServers": {
116
- "converse": {
117
- "command": "npx",
118
- "args": ["FallDownTheSystem/converse", "--transport", "stdio"],
119
- "env": {
120
- "OPENAI_API_KEY": "your_key_here",
121
- "GOOGLE_API_KEY": "your_key_here",
122
- "XAI_API_KEY": "your_key_here",
123
- "ANTHROPIC_API_KEY": "your_key_here",
124
- "MISTRAL_API_KEY": "your_key_here",
125
- "DEEPSEEK_API_KEY": "your_key_here",
126
- "OPENROUTER_API_KEY": "your_key_here",
127
- "OPENROUTER_REFERER": "https://github.com/YourUsername/YourApp",
128
- "MAX_MCP_OUTPUT_TOKENS": "200000"
129
- }
130
- }
131
- }
132
- }
133
- ```
134
-
135
- #### Option C: Direct Node.js execution
112
+ #### Option B: Direct Node.js execution
136
113
 
137
114
  ```json
138
115
  {
@@ -140,9 +117,7 @@ There are several ways to add the Converse MCP Server to Claude:
140
117
  "converse": {
141
118
  "command": "node",
142
119
  "args": [
143
- "C:\\Users\\YourUsername\\Documents\\Projects\\converse\\src\\index.js",
144
- "--transport",
145
- "stdio"
120
+ "C:\\Users\\YourUsername\\Documents\\Projects\\converse\\src\\index.js"
146
121
  ],
147
122
  "env": {
148
123
  "OPENAI_API_KEY": "your_key_here",
@@ -160,27 +135,7 @@ There are several ways to add the Converse MCP Server to Claude:
160
135
  }
161
136
  ```
162
137
 
163
- #### Option D: Using environment variable for transport
164
-
165
- ```json
166
- {
167
- "mcpServers": {
168
- "converse": {
169
- "command": "npx",
170
- "args": ["FallDownTheSystem/converse"],
171
- "env": {
172
- "MCP_TRANSPORT": "stdio",
173
- "OPENAI_API_KEY": "your_key_here",
174
- "GOOGLE_API_KEY": "your_key_here",
175
- "XAI_API_KEY": "your_key_here",
176
- "MAX_MCP_OUTPUT_TOKENS": "200000"
177
- }
178
- }
179
- }
180
- }
181
- ```
182
-
183
- #### Option E: Local HTTP Development (Advanced)
138
+ #### Option C: Local HTTP Development (Advanced)
184
139
 
185
140
  For local development with HTTP transport (optional, for debugging):
186
141
 
@@ -207,9 +162,16 @@ For local development with HTTP transport (optional, for debugging):
207
162
  #### Installation Steps
208
163
 
209
164
  1. **For Claude Code**:
210
- - Open the command palette (Ctrl/Cmd + Shift + P)
211
- - Run "Claude Code: Edit MCP Settings"
212
- - Add one of the configurations above
165
+ ```bash
166
+ # Add the server globally (for all projects)
167
+ claude mcp add converse npx converse-mcp-server -s user
168
+
169
+ # Then set your API keys
170
+ claude mcp set-env converse OPENAI_API_KEY=your_key_here -s user
171
+ claude mcp set-env converse GOOGLE_API_KEY=your_key_here -s user
172
+ claude mcp set-env converse XAI_API_KEY=your_key_here -s user
173
+ # Add other API keys as needed
174
+ ```
213
175
 
214
176
  2. **For Claude Desktop**:
215
177
  - Navigate to Settings → Developer → MCP Servers
@@ -291,7 +253,9 @@ Programmatic access to documentation:
291
253
  ### OpenAI Models
292
254
  - **o3**: Strong reasoning (200K context)
293
255
  - **o3-mini**: Fast O3 variant (200K context)
256
+ - **o3-pro**: Professional-grade reasoning (200K context) - EXTREMELY EXPENSIVE
294
257
  - **o4-mini**: Latest reasoning model (200K context)
258
+ - **gpt-4.1**: Advanced reasoning (1M context)
295
259
  - **gpt-4o**: Multimodal flagship (128K context)
296
260
  - **gpt-4o-mini**: Fast multimodal (128K context)
297
261
 
@@ -299,12 +263,34 @@ Programmatic access to documentation:
299
263
  - **gemini-2.5-flash** (alias: `flash`): Ultra-fast (1M context)
300
264
  - **gemini-2.5-pro** (alias: `pro`): Deep reasoning (1M context)
301
265
  - **gemini-2.0-flash**: Latest with experimental thinking
266
+ - **gemini-2.0-flash-lite**: Lightweight fast model, text-only
302
267
 
303
268
  ### X.AI/Grok Models
304
269
  - **grok-4-0709** (alias: `grok`): Latest advanced model (256K context)
305
270
  - **grok-3**: Previous generation (131K context)
306
271
  - **grok-3-fast**: Higher performance variant
307
272
 
273
+ ### Anthropic Models
274
+ - **claude-opus-4**: Highest intelligence with extended thinking (200K context)
275
+ - **claude-sonnet-4**: Balanced performance with extended thinking (200K context)
276
+ - **claude-3.7-sonnet**: Enhanced 3.x generation with thinking (200K context)
277
+ - **claude-3.5-sonnet**: Fast and intelligent (200K context)
278
+ - **claude-3.5-haiku**: Fastest model for simple queries (200K context)
279
+
280
+ ### Mistral Models
281
+ - **magistral-medium**: Frontier-class reasoning model (40K context)
282
+ - **magistral-small**: Small reasoning model (40K context)
283
+ - **mistral-medium-3**: Frontier-class multimodal model (128K context)
284
+
285
+ ### DeepSeek Models
286
+ - **deepseek-chat**: Strong MoE model with 671B/37B parameters (64K context)
287
+ - **deepseek-reasoner**: Advanced reasoning model with CoT (64K context)
288
+
289
+ ### OpenRouter Models
290
+ - **qwen3-235b-thinking**: Qwen3 with enhanced reasoning (32K context)
291
+ - **qwen3-coder**: Specialized for programming tasks (32K context)
292
+ - **kimi-k2**: Moonshot AI Kimi K2 with extended context (200K context)
293
+
308
294
  ## 🚀 Development
309
295
 
310
296
  ### Install from Source
@@ -342,8 +328,12 @@ npm run kill-server # Kill any server running on port 3157
342
328
  npm test # Run all tests
343
329
  npm run test:unit # Unit tests only
344
330
  npm run test:integration # Integration tests
331
+ npm run test:mcp-client # MCP client tests (HTTP-based client-server testing)
345
332
  npm run test:real-api # Real API tests (requires keys)
333
+ npm run test:providers # Provider tests
334
+ npm run test:tools # Tool tests
346
335
  npm run test:coverage # Coverage report
336
+ npm run test:watch # Run tests in watch mode
347
337
 
348
338
  # Code quality
349
339
  npm run lint # Check code style
@@ -396,7 +386,7 @@ XAI_API_KEY=xai-...
396
386
  npm run test:real-api
397
387
 
398
388
  # Run comprehensive integration tests
399
- node final-integration-test.js
389
+ node tests/integration/final-integration-test.js
400
390
 
401
391
  # Validate server functionality
402
392
  npm run validate
@@ -417,14 +407,14 @@ npm test
417
407
  npm run test:real-api
418
408
 
419
409
  # 4. Comprehensive validation
420
- node final-integration-test.js
410
+ node tests/integration/final-integration-test.js
421
411
  ```
422
412
 
423
413
  **Expected Results:**
424
414
  - Server starts without errors on port 3157
425
415
  - All unit tests pass
426
416
  - Real API tests connect successfully (if keys configured)
427
- - Integration tests achieve >70% success rate
417
+ - Some real API integration tests may occasionally timeout
428
418
 
429
419
  ## 📦 Publishing to NPM
430
420
 
@@ -530,7 +520,6 @@ converse/
530
520
  | `PORT` | Server port | `3157` | `3157` |
531
521
  | `LOG_LEVEL` | Logging level | `info` | `debug`, `info`, `error` |
532
522
  | `MAX_MCP_OUTPUT_TOKENS` | Token response limit | `25000` | `200000` |
533
- | `GOOGLE_LOCATION` | Google API region | `us-central1` | `us-central1` |
534
523
  | `XAI_BASE_URL` | XAI API endpoint | `https://api.x.ai/v1` | Custom endpoint |
535
524
 
536
525
  ### Model Selection
@@ -633,7 +622,7 @@ git push origin feature/your-feature
633
622
 
634
623
  ## 🙏 Acknowledgments
635
624
 
636
- This MCP Server was inspired by and builds upon the excellent work from [BeehiveInnovations/zen-mcp-server](https://github.com/BeehiveInnovations/zen-mcp-server). We're grateful for their pioneering implementation and innovative approach to MCP server development.
625
+ This MCP Server was inspired by and builds upon the excellent work from [BeehiveInnovations/zen-mcp-server](https://github.com/BeehiveInnovations/zen-mcp-server).
637
626
 
638
627
  ## 📄 License
639
628
 
@@ -643,8 +632,4 @@ MIT License - see [LICENSE](LICENSE) file for details.
643
632
 
644
633
  - **GitHub**: https://github.com/FallDownTheSystem/converse
645
634
  - **Issues**: https://github.com/FallDownTheSystem/converse/issues
646
- - **NPM Package**: https://www.npmjs.com/package/converse-mcp-server
647
-
648
- ---
649
-
650
- **Built with ❤️ using Node.js and modern AI APIs**
635
+ - **NPM Package**: https://www.npmjs.com/package/converse-mcp-server
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "converse-mcp-server",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "Converse MCP Server - Converse with other LLMs with chat and consensus tools",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -351,19 +351,25 @@ export const anthropicProvider = {
351
351
  // Get Anthropic SDK
352
352
  const Anthropic = await getAnthropicSDK();
353
353
 
354
+ // Resolve model name first
355
+ const resolvedModel = resolveModelName(model);
356
+ const modelConfig = SUPPORTED_MODELS[resolvedModel] || {};
357
+
354
358
  // Initialize Anthropic client with default headers
355
359
  // Use both prompt caching and extended cache duration headers for 1-hour caching
360
+ // Add thinking beta for models that support thinking
361
+ const betaHeaders = ['prompt-caching-2024-07-31', 'extended-cache-ttl-2025-04-11'];
362
+ if (modelConfig.supportsThinking && reasoning_effort) {
363
+ betaHeaders.push('thinking-2025-01-27');
364
+ }
365
+
356
366
  const anthropic = new Anthropic({
357
367
  apiKey: config.apiKeys.anthropic,
358
368
  defaultHeaders: {
359
- 'anthropic-beta': 'prompt-caching-2024-07-31,extended-cache-ttl-2025-04-11'
369
+ 'anthropic-beta': betaHeaders.join(',')
360
370
  }
361
371
  });
362
372
 
363
- // Resolve model name
364
- const resolvedModel = resolveModelName(model);
365
- const modelConfig = SUPPORTED_MODELS[resolvedModel] || {};
366
-
367
373
  // Convert messages to Anthropic format (system messages are always cached)
368
374
  const { systemPrompt, messages: anthropicMessages } = convertMessagesToAnthropic(messages);
369
375
 
@@ -380,39 +386,38 @@ export const anthropicProvider = {
380
386
  requestPayload.system = systemPrompt;
381
387
  }
382
388
 
383
- // Add max tokens (required by Anthropic)
384
- const defaultMaxTokens = modelConfig.maxOutputTokens || 8192;
385
-
386
- // If thinking is supported and enabled, we need to reduce max_tokens to leave room for thinking
387
- let effectiveMaxTokens = defaultMaxTokens;
388
- if (modelConfig.supportsThinking && reasoning_effort) {
389
- // Reserve some tokens for thinking - use a more conservative approach
390
- effectiveMaxTokens = Math.min(defaultMaxTokens, 16000); // Cap at 16k for models with thinking
389
+ // Add max tokens only if explicitly requested
390
+ // For Claude 4 series models, let the SDK use its defaults (32k for opus, 64k for sonnet)
391
+ if (maxTokens) {
392
+ requestPayload.max_tokens = Math.min(maxTokens, modelConfig.maxOutputTokens || 8192);
393
+ } else if (!resolvedModel.includes('claude-opus-4') && !resolvedModel.includes('claude-sonnet-4')) {
394
+ // For non-4 series models, we still need to set max_tokens
395
+ requestPayload.max_tokens = modelConfig.maxOutputTokens || 8192;
391
396
  }
392
-
393
- requestPayload.max_tokens = maxTokens
394
- ? Math.min(maxTokens, effectiveMaxTokens)
395
- : effectiveMaxTokens;
397
+ // For 4 series models without explicit maxTokens, don't set max_tokens - let SDK use defaults
396
398
 
397
399
  // Add thinking configuration for models that support it
398
400
  if (modelConfig.supportsThinking && reasoning_effort) {
399
401
  const thinkingBudget = calculateThinkingBudget(modelConfig, reasoning_effort);
400
- if (thinkingBudget > 0) {
401
- // Anthropic docs: thinking budget counts towards total token limit
402
- // So we need to ensure max_tokens + budget_tokens <= model's actual limit
403
- // Reduce max_tokens to make room for thinking
404
- const reducedMaxTokens = requestPayload.max_tokens - thinkingBudget;
405
-
406
- if (reducedMaxTokens >= 1000 && thinkingBudget >= 1024) { // Ensure we have reasonable space for both
407
- requestPayload.max_tokens = reducedMaxTokens;
408
- requestPayload.thinking = {
409
- type: 'enabled',
410
- budget_tokens: thinkingBudget
411
- };
412
- debugLog(`[Anthropic] Thinking enabled with budget: ${thinkingBudget} tokens, max_tokens reduced to: ${reducedMaxTokens} (${reasoning_effort} effort)`);
413
- } else {
414
- debugLog(`[Anthropic] Not enough token budget for thinking. Would need ${thinkingBudget} thinking + ${reducedMaxTokens} output tokens`);
415
- }
402
+ debugLog(`[Anthropic] Model ${resolvedModel}: maxOutputTokens=${modelConfig.maxOutputTokens}, maxThinkingTokens=${modelConfig.maxThinkingTokens}, thinkingBudget=${thinkingBudget}`);
403
+
404
+ // For 4 series models, we trust the SDK defaults work with thinking
405
+ // For other models, check against max_tokens if set
406
+ const maxTokensLimit = requestPayload.max_tokens ||
407
+ (resolvedModel.includes('claude-opus-4') ? 32000 :
408
+ resolvedModel.includes('claude-sonnet-4') ? 64000 :
409
+ modelConfig.maxOutputTokens);
410
+
411
+ if (thinkingBudget > 0 && thinkingBudget < maxTokensLimit) {
412
+ // According to Anthropic docs: thinking tokens count towards max_tokens limit
413
+ // thinking.budget_tokens must be >= 1024 and < max_tokens
414
+ requestPayload.thinking = {
415
+ type: 'enabled',
416
+ budget_tokens: thinkingBudget
417
+ };
418
+ debugLog(`[Anthropic] Thinking enabled with budget: ${thinkingBudget} tokens (${reasoning_effort} effort)`);
419
+ } else {
420
+ debugLog(`[Anthropic] Thinking not enabled: budget ${thinkingBudget} must be < max_tokens limit ${maxTokensLimit}`);
416
421
  }
417
422
  }
418
423
 
@@ -429,6 +434,14 @@ export const anthropicProvider = {
429
434
 
430
435
  try {
431
436
  debugLog(`[Anthropic] Calling ${resolvedModel} with ${anthropicMessages.length} messages`);
437
+ debugLog(`[Anthropic] Request payload:`, JSON.stringify({
438
+ model: requestPayload.model,
439
+ max_tokens: requestPayload.max_tokens,
440
+ thinking: requestPayload.thinking,
441
+ temperature: requestPayload.temperature,
442
+ message_count: requestPayload.messages?.length,
443
+ system_length: Array.isArray(requestPayload.system) ? requestPayload.system[0]?.text?.length : requestPayload.system?.length
444
+ }, null, 2));
432
445
  if (systemPrompt) {
433
446
  debugLog(`[Anthropic] System prompt length: ${systemPrompt.length} characters`);
434
447
  }
@@ -507,8 +520,21 @@ export const anthropicProvider = {
507
520
  throw new AnthropicProviderError(`Invalid request: ${error.error.message}`, ErrorCodes.INVALID_REQUEST, error);
508
521
  } else if (error.error?.type === 'not_found_error') {
509
522
  throw new AnthropicProviderError(`Model ${resolvedModel} not found`, ErrorCodes.MODEL_NOT_FOUND, error);
510
- } else if (error.message?.includes('context length') || error.message?.includes('token')) {
511
- throw new AnthropicProviderError('Context length exceeded for model', ErrorCodes.CONTEXT_LENGTH_EXCEEDED, error);
523
+ } else if (error.message?.includes('context length') || error.message?.includes('context_length') ||
524
+ (error.message?.includes('token') && error.message?.includes('limit'))) {
525
+ debugError(`[Anthropic] Context length error - Full error:`, error);
526
+ debugError(`[Anthropic] Error message:`, error.message);
527
+ debugError(`[Anthropic] Error response:`, error.response);
528
+ throw new AnthropicProviderError(`Context length exceeded for model: ${error.message}`, ErrorCodes.CONTEXT_LENGTH_EXCEEDED, error);
529
+ } else if (error.message?.includes('Streaming is strongly recommended')) {
530
+ // This is just a warning from the SDK about long requests
531
+ debugLog(`[Anthropic] SDK streaming recommendation warning`);
532
+ debugError(`[Anthropic] Full error object:`, error);
533
+ // Check if there's an actual error response
534
+ if (error.response || error.status) {
535
+ debugError(`[Anthropic] Error response status:`, error.status);
536
+ debugError(`[Anthropic] Error response data:`, error.response);
537
+ }
512
538
  }
513
539
 
514
540
  // Generic error handling
@@ -18,11 +18,11 @@ const SUPPORTED_MODELS = {
18
18
  supportsStreaming: true,
19
19
  supportsImages: true,
20
20
  supportsTemperature: true,
21
- supportsThinking: true,
21
+ supportsThinking: false,
22
22
  supportsWebSearch: true,
23
- maxThinkingTokens: 24576,
23
+ maxThinkingTokens: 0,
24
24
  timeout: 300000,
25
- description: 'Gemini 2.0 Flash (1M context) - Latest fast model with experimental thinking, supports audio/video input and grounding',
25
+ description: 'Gemini 2.0 Flash (1M context) - Latest fast model, supports audio/video input and grounding',
26
26
  aliases: ['flash-2.0', 'flash2', 'flash 2.0', 'gemini flash 2.0', 'gemini-2.0-flash-latest']
27
27
  },
28
28
  'gemini-2.0-flash-lite': {