@arikusi/deepseek-mcp-server 1.0.2 → 1.1.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/dist/index.js CHANGED
@@ -9,64 +9,64 @@
9
9
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
10
10
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
11
11
  import { z } from 'zod';
12
+ import { loadConfig, getConfig } from './config.js';
13
+ import { calculateCost, formatCost } from './cost.js';
14
+ import { ExtendedMessageSchema, ChatInputWithToolsSchema, ToolDefinitionSchema, ToolChoiceSchema, } from './schemas.js';
12
15
  import { DeepSeekClient } from './deepseek-client.js';
13
- // Get API key from environment variable
14
- const DEEPSEEK_API_KEY = process.env.DEEPSEEK_API_KEY;
15
- if (!DEEPSEEK_API_KEY) {
16
- console.error('Error: DEEPSEEK_API_KEY environment variable is not set');
17
- console.error('Please set your DeepSeek API key:');
18
- console.error(' export DEEPSEEK_API_KEY="your-api-key-here"');
19
- process.exit(1);
20
- }
21
- // Initialize DeepSeek client
22
- const deepseek = new DeepSeekClient(DEEPSEEK_API_KEY);
16
+ // Load and validate configuration
17
+ const config = loadConfig();
18
+ // Initialize DeepSeek client (uses getConfig() internally)
19
+ const deepseek = new DeepSeekClient();
23
20
  // Create MCP server
24
21
  const server = new McpServer({
25
22
  name: 'deepseek-mcp-server',
26
- version: '1.0.0',
27
- });
28
- // Define Zod schemas for input validation
29
- const MessageSchema = z.object({
30
- role: z.enum(['system', 'user', 'assistant']),
31
- content: z.string(),
32
- });
33
- const ChatInputSchema = z.object({
34
- messages: z.array(MessageSchema).min(1),
35
- model: z.enum(['deepseek-chat', 'deepseek-reasoner']).default('deepseek-chat'),
36
- temperature: z.number().min(0).max(2).optional(),
37
- max_tokens: z.number().min(1).max(32768).optional(),
38
- stream: z.boolean().optional().default(false),
23
+ version: '1.1.0',
39
24
  });
40
25
  /**
41
26
  * Tool: deepseek_chat
42
27
  *
43
28
  * Chat completion with DeepSeek models.
44
29
  * Supports both deepseek-chat and deepseek-reasoner (R1) models.
30
+ * Supports function calling via the tools parameter.
45
31
  */
46
32
  server.registerTool('deepseek_chat', {
47
33
  title: 'DeepSeek Chat Completion',
48
34
  description: 'Chat with DeepSeek AI models. Supports deepseek-chat for general conversations and ' +
49
35
  'deepseek-reasoner (R1) for complex reasoning tasks with chain-of-thought explanations. ' +
36
+ 'Supports function calling via the tools parameter for structured tool use. ' +
50
37
  'The reasoner model provides both reasoning_content (thinking process) and content (final answer).',
51
38
  inputSchema: {
52
- messages: z.array(MessageSchema).min(1).describe('Array of conversation messages'),
53
- model: z.enum(['deepseek-chat', 'deepseek-reasoner'])
39
+ messages: z
40
+ .array(ExtendedMessageSchema)
41
+ .min(1)
42
+ .describe('Array of conversation messages. Each message has role (system/user/assistant/tool) and content. Tool messages require tool_call_id.'),
43
+ model: z
44
+ .enum(['deepseek-chat', 'deepseek-reasoner'])
54
45
  .default('deepseek-chat')
55
46
  .describe('Model to use. deepseek-chat for general tasks, deepseek-reasoner for complex reasoning'),
56
- temperature: z.number()
47
+ temperature: z
48
+ .number()
57
49
  .min(0)
58
50
  .max(2)
59
51
  .optional()
60
52
  .describe('Sampling temperature (0-2). Higher = more random. Default: 1.0'),
61
- max_tokens: z.number()
53
+ max_tokens: z
54
+ .number()
62
55
  .min(1)
63
56
  .max(32768)
64
57
  .optional()
65
58
  .describe('Maximum tokens to generate. Default: model maximum'),
66
- stream: z.boolean()
59
+ stream: z
60
+ .boolean()
67
61
  .optional()
68
62
  .default(false)
69
63
  .describe('Enable streaming mode. Returns full response after streaming completes.'),
64
+ tools: z
65
+ .array(ToolDefinitionSchema)
66
+ .max(128)
67
+ .optional()
68
+ .describe('Array of tool definitions for function calling. Each tool has type "function" and a function object with name, description, and parameters (JSON Schema).'),
69
+ tool_choice: ToolChoiceSchema.optional().describe('Controls which tool the model calls. "auto" (default), "none", "required", or {type:"function",function:{name:"..."}}'),
70
70
  },
71
71
  outputSchema: {
72
72
  content: z.string(),
@@ -78,12 +78,22 @@ server.registerTool('deepseek_chat', {
78
78
  total_tokens: z.number(),
79
79
  }),
80
80
  finish_reason: z.string(),
81
+ tool_calls: z
82
+ .array(z.object({
83
+ id: z.string(),
84
+ type: z.literal('function'),
85
+ function: z.object({
86
+ name: z.string(),
87
+ arguments: z.string(),
88
+ }),
89
+ }))
90
+ .optional(),
81
91
  },
82
92
  }, async (input) => {
83
93
  try {
84
- // Validate input
85
- const validated = ChatInputSchema.parse(input);
86
- console.error(`[DeepSeek MCP] Request: model=${validated.model}, messages=${validated.messages.length}, stream=${validated.stream}`);
94
+ // Validate input with extended schema (supports tools)
95
+ const validated = ChatInputWithToolsSchema.parse(input);
96
+ console.error(`[DeepSeek MCP] Request: model=${validated.model}, messages=${validated.messages.length}, stream=${validated.stream}${validated.tools ? `, tools=${validated.tools.length}` : ''}`);
87
97
  // Call appropriate method based on stream parameter
88
98
  const response = validated.stream
89
99
  ? await deepseek.createStreamingChatCompletion({
@@ -91,14 +101,18 @@ server.registerTool('deepseek_chat', {
91
101
  messages: validated.messages,
92
102
  temperature: validated.temperature,
93
103
  max_tokens: validated.max_tokens,
104
+ tools: validated.tools,
105
+ tool_choice: validated.tool_choice,
94
106
  })
95
107
  : await deepseek.createChatCompletion({
96
108
  model: validated.model,
97
109
  messages: validated.messages,
98
110
  temperature: validated.temperature,
99
111
  max_tokens: validated.max_tokens,
112
+ tools: validated.tools,
113
+ tool_choice: validated.tool_choice,
100
114
  });
101
- console.error(`[DeepSeek MCP] Response: tokens=${response.usage.total_tokens}, finish_reason=${response.finish_reason}`);
115
+ console.error(`[DeepSeek MCP] Response: tokens=${response.usage.total_tokens}, finish_reason=${response.finish_reason}${response.tool_calls ? `, tool_calls=${response.tool_calls.length}` : ''}`);
102
116
  // Format response
103
117
  let responseText = '';
104
118
  // Add reasoning content if available (for deepseek-reasoner)
@@ -106,9 +120,27 @@ server.registerTool('deepseek_chat', {
106
120
  responseText += `<thinking>\n${response.reasoning_content}\n</thinking>\n\n`;
107
121
  }
108
122
  responseText += response.content;
109
- // Add usage stats
110
- responseText += `\n\n---\n**Model:** ${response.model}\n`;
111
- responseText += `**Tokens:** ${response.usage.prompt_tokens} prompt + ${response.usage.completion_tokens} completion = ${response.usage.total_tokens} total`;
123
+ // Format tool calls if present
124
+ if (response.tool_calls?.length) {
125
+ responseText += '\n\n**Function Calls:**\n';
126
+ for (const tc of response.tool_calls) {
127
+ responseText += `\`${tc.function.name}\`\n`;
128
+ responseText += `- Call ID: ${tc.id}\n`;
129
+ responseText += `- Arguments: ${tc.function.arguments}\n\n`;
130
+ }
131
+ }
132
+ // Calculate cost
133
+ const cost = calculateCost(response.usage.prompt_tokens, response.usage.completion_tokens, response.model);
134
+ // Add usage stats with cost information (controlled by config)
135
+ if (getConfig().showCostInfo) {
136
+ responseText += `\n---\n**Request Information:**\n`;
137
+ responseText += `- **Tokens:** ${response.usage.total_tokens} (${response.usage.prompt_tokens} prompt + ${response.usage.completion_tokens} completion)\n`;
138
+ responseText += `- **Model:** ${response.model}\n`;
139
+ responseText += `- **Cost:** ${formatCost(cost)}`;
140
+ if (response.tool_calls?.length) {
141
+ responseText += `\n- **Tool Calls:** ${response.tool_calls.length}`;
142
+ }
143
+ }
112
144
  return {
113
145
  content: [
114
146
  {
@@ -116,7 +148,10 @@ server.registerTool('deepseek_chat', {
116
148
  text: responseText,
117
149
  },
118
150
  ],
119
- structuredContent: response,
151
+ structuredContent: {
152
+ ...response,
153
+ cost_usd: parseFloat(cost.toFixed(6)),
154
+ },
120
155
  };
121
156
  }
122
157
  catch (error) {
@@ -133,9 +168,452 @@ server.registerTool('deepseek_chat', {
133
168
  };
134
169
  }
135
170
  });
171
+ /**
172
+ * Register MCP Prompts
173
+ * Pre-built prompt templates for common reasoning tasks
174
+ */
175
+ // Core Reasoning Prompts
176
+ server.registerPrompt('debug_with_reasoning', {
177
+ title: 'Debug Code with Reasoning',
178
+ description: 'Debug code issues using DeepSeek R1 reasoning model with step-by-step analysis',
179
+ argsSchema: {
180
+ code: z.string().describe('Code to debug'),
181
+ error: z
182
+ .string()
183
+ .optional()
184
+ .describe('Error message or description of the issue'),
185
+ language: z.string().optional().describe('Programming language'),
186
+ },
187
+ }, ({ code, error, language }, _extra) => ({
188
+ messages: [
189
+ {
190
+ role: 'user',
191
+ content: {
192
+ type: 'text',
193
+ text: `You are an expert debugging assistant. Analyze this code using deep reasoning.
194
+
195
+ ${language ? `Language: ${language}` : ''}
196
+ ${error ? `Error/Issue: ${error}` : ''}
197
+
198
+ Code:
199
+ \`\`\`
200
+ ${code}
201
+ \`\`\`
202
+
203
+ Please:
204
+ 1. Identify the bug or issue
205
+ 2. Explain your reasoning process step-by-step
206
+ 3. Suggest a fix with explanation
207
+ 4. Provide the corrected code
208
+
209
+ Use the deepseek_chat tool with model: "deepseek-reasoner" for detailed reasoning.`,
210
+ },
211
+ },
212
+ ],
213
+ }));
214
+ server.registerPrompt('code_review_deep', {
215
+ title: 'Deep Code Review',
216
+ description: 'Comprehensive code review analyzing quality, security, performance, and best practices',
217
+ argsSchema: {
218
+ code: z.string().describe('Code to review'),
219
+ language: z.string().optional().describe('Programming language'),
220
+ focus: z
221
+ .enum(['security', 'performance', 'quality', 'all'])
222
+ .default('all')
223
+ .describe('Review focus area'),
224
+ },
225
+ }, ({ code, language, focus }, _extra) => ({
226
+ messages: [
227
+ {
228
+ role: 'user',
229
+ content: {
230
+ type: 'text',
231
+ text: `You are an expert code reviewer. Perform a comprehensive code review.
232
+
233
+ ${language ? `Language: ${language}` : ''}
234
+ Focus: ${focus === 'all' ? 'Security, Performance, Code Quality, Best Practices' : focus}
235
+
236
+ Code:
237
+ \`\`\`
238
+ ${code}
239
+ \`\`\`
240
+
241
+ For each issue found, provide:
242
+ 1. **Issue**: What's wrong
243
+ 2. **Reasoning**: Why it's a problem
244
+ 3. **Severity**: Critical/High/Medium/Low
245
+ 4. **Fix**: How to resolve it
246
+
247
+ Use the deepseek_chat tool with model: "deepseek-reasoner" for thorough analysis.`,
248
+ },
249
+ },
250
+ ],
251
+ }));
252
+ server.registerPrompt('research_synthesis', {
253
+ title: 'Research & Synthesis',
254
+ description: 'Research a topic and synthesize information into a structured report',
255
+ argsSchema: {
256
+ topic: z.string().describe('Topic to research'),
257
+ context: z
258
+ .string()
259
+ .optional()
260
+ .describe('Additional context or specific questions'),
261
+ depth: z
262
+ .enum(['brief', 'moderate', 'comprehensive'])
263
+ .default('moderate')
264
+ .describe('Research depth'),
265
+ },
266
+ }, ({ topic, context, depth }, _extra) => ({
267
+ messages: [
268
+ {
269
+ role: 'user',
270
+ content: {
271
+ type: 'text',
272
+ text: `You are a research assistant. Research and synthesize information about this topic.
273
+
274
+ Topic: ${topic}
275
+ ${context ? `Context: ${context}` : ''}
276
+ Depth: ${depth}
277
+
278
+ Please provide:
279
+ 1. **Overview**: Brief summary
280
+ 2. **Key Findings**: Main points with reasoning
281
+ 3. **Analysis**: Deep dive with reasoning process
282
+ 4. **Conclusion**: Synthesis and implications
283
+ 5. **Sources**: Cite reasoning steps
284
+
285
+ Use the deepseek_chat tool with model: "deepseek-reasoner" for comprehensive analysis.`,
286
+ },
287
+ },
288
+ ],
289
+ }));
290
+ server.registerPrompt('strategic_planning', {
291
+ title: 'Strategic Planning',
292
+ description: 'Analyze options and create strategic plans with reasoning for each decision',
293
+ argsSchema: {
294
+ goal: z.string().describe('Goal or objective'),
295
+ context: z.string().optional().describe('Situational context'),
296
+ constraints: z.string().optional().describe('Constraints or limitations'),
297
+ },
298
+ }, ({ goal, context, constraints }, _extra) => ({
299
+ messages: [
300
+ {
301
+ role: 'user',
302
+ content: {
303
+ type: 'text',
304
+ text: `You are a strategic planning expert. Create a detailed plan with reasoning.
305
+
306
+ Goal: ${goal}
307
+ ${context ? `Context: ${context}` : ''}
308
+ ${constraints ? `Constraints: ${constraints}` : ''}
309
+
310
+ Please provide:
311
+ 1. **Situation Analysis**: Current state with reasoning
312
+ 2. **Options**: List possible approaches
313
+ 3. **Evaluation**: Pros/cons of each option with reasoning
314
+ 4. **Recommendation**: Best approach with detailed reasoning
315
+ 5. **Action Plan**: Step-by-step plan with rationale
316
+
317
+ Use the deepseek_chat tool with model: "deepseek-reasoner" for thorough strategic thinking.`,
318
+ },
319
+ },
320
+ ],
321
+ }));
322
+ server.registerPrompt('explain_like_im_five', {
323
+ title: "Explain Like I'm Five",
324
+ description: 'Explain complex topics in simple terms using analogies and reasoning',
325
+ argsSchema: {
326
+ topic: z.string().describe('Complex topic to explain'),
327
+ audience: z
328
+ .enum(['child', 'beginner', 'intermediate'])
329
+ .default('beginner')
330
+ .describe('Target audience level'),
331
+ },
332
+ }, ({ topic, audience }, _extra) => ({
333
+ messages: [
334
+ {
335
+ role: 'user',
336
+ content: {
337
+ type: 'text',
338
+ text: `You are an expert explainer. Make complex topics simple and understandable.
339
+
340
+ Topic: ${topic}
341
+ Audience: ${audience}
342
+
343
+ Please:
344
+ 1. Start with a simple analogy or metaphor
345
+ 2. Break down the concept step-by-step
346
+ 3. Use everyday examples
347
+ 4. Show your reasoning for why this explanation works
348
+ 5. Build up complexity gradually if needed
349
+
350
+ Use the deepseek_chat tool with model: "deepseek-reasoner" to ensure logical explanations.`,
351
+ },
352
+ },
353
+ ],
354
+ }));
355
+ // Advanced Prompts
356
+ server.registerPrompt('mathematical_proof', {
357
+ title: 'Mathematical Proof',
358
+ description: 'Prove mathematical statements with rigorous step-by-step reasoning',
359
+ argsSchema: {
360
+ statement: z.string().describe('Mathematical statement to prove'),
361
+ context: z.string().optional().describe('Mathematical context or axioms'),
362
+ },
363
+ }, ({ statement, context }, _extra) => ({
364
+ messages: [
365
+ {
366
+ role: 'user',
367
+ content: {
368
+ type: 'text',
369
+ text: `You are a mathematician. Provide a rigorous proof.
370
+
371
+ Statement to prove: ${statement}
372
+ ${context ? `Context/Axioms: ${context}` : ''}
373
+
374
+ Provide:
375
+ 1. **Given**: What we know
376
+ 2. **To Prove**: What we're proving
377
+ 3. **Proof**: Step-by-step logical reasoning
378
+ 4. **Conclusion**: QED statement
379
+
380
+ Use the deepseek_chat tool with model: "deepseek-reasoner" for strict logical reasoning.`,
381
+ },
382
+ },
383
+ ],
384
+ }));
385
+ server.registerPrompt('argument_validation', {
386
+ title: 'Argument Validation',
387
+ description: 'Analyze arguments for logical fallacies and reasoning errors',
388
+ argsSchema: {
389
+ argument: z.string().describe('Argument to validate'),
390
+ type: z
391
+ .enum(['informal', 'formal', 'both'])
392
+ .default('informal')
393
+ .describe('Analysis type'),
394
+ },
395
+ }, ({ argument, type }, _extra) => ({
396
+ messages: [
397
+ {
398
+ role: 'user',
399
+ content: {
400
+ type: 'text',
401
+ text: `You are a logic expert. Analyze this argument for validity.
402
+
403
+ Argument:
404
+ ${argument}
405
+
406
+ Analysis type: ${type}
407
+
408
+ Please identify:
409
+ 1. **Structure**: Break down the argument's structure
410
+ 2. **Premises**: List all premises and assumptions
411
+ 3. **Conclusion**: What's being claimed
412
+ 4. **Reasoning**: Analyze the logical flow
413
+ 5. **Fallacies**: Any logical fallacies or errors
414
+ 6. **Validity**: Is the reasoning sound?
415
+ 7. **Improvements**: How to strengthen the argument
416
+
417
+ Use the deepseek_chat tool with model: "deepseek-reasoner" for thorough logical analysis.`,
418
+ },
419
+ },
420
+ ],
421
+ }));
422
+ server.registerPrompt('creative_ideation', {
423
+ title: 'Creative Ideation',
424
+ description: 'Generate creative ideas with reasoning for feasibility and value',
425
+ argsSchema: {
426
+ challenge: z.string().describe('Problem or challenge to solve'),
427
+ constraints: z
428
+ .string()
429
+ .optional()
430
+ .describe('Constraints or requirements'),
431
+ quantity: z
432
+ .number()
433
+ .min(1)
434
+ .max(20)
435
+ .default(5)
436
+ .describe('Number of ideas to generate'),
437
+ },
438
+ }, ({ challenge, constraints, quantity }, _extra) => ({
439
+ messages: [
440
+ {
441
+ role: 'user',
442
+ content: {
443
+ type: 'text',
444
+ text: `You are a creative problem solver. Generate innovative ideas with reasoning.
445
+
446
+ Challenge: ${challenge}
447
+ ${constraints ? `Constraints: ${constraints}` : ''}
448
+ Ideas needed: ${quantity}
449
+
450
+ For each idea, provide:
451
+ 1. **Idea**: The concept
452
+ 2. **Reasoning**: Why this could work
453
+ 3. **Feasibility**: How realistic it is (High/Medium/Low)
454
+ 4. **Value**: Potential impact
455
+ 5. **Next Steps**: How to validate/implement
456
+
457
+ Use the deepseek_chat tool with model: "deepseek-reasoner" for reasoned creativity.`,
458
+ },
459
+ },
460
+ ],
461
+ }));
462
+ server.registerPrompt('cost_comparison', {
463
+ title: 'LLM Cost Comparison',
464
+ description: 'Compare costs of different LLMs for a task and show savings with DeepSeek',
465
+ argsSchema: {
466
+ task: z.string().describe('Task description'),
467
+ estimated_tokens: z
468
+ .number()
469
+ .min(100)
470
+ .describe('Estimated token count (prompt + completion)'),
471
+ },
472
+ }, ({ task, estimated_tokens }, _extra) => ({
473
+ messages: [
474
+ {
475
+ role: 'user',
476
+ content: {
477
+ type: 'text',
478
+ text: `You are a cost analysis expert. Compare LLM costs for this task.
479
+
480
+ Task: ${task}
481
+ Estimated tokens: ${estimated_tokens} (prompt + completion)
482
+
483
+ Calculate costs for:
484
+ 1. **DeepSeek Chat**: $0.14/1M prompt + $0.28/1M completion
485
+ 2. **DeepSeek Reasoner**: $0.42/1M prompt + $0.42/1M completion
486
+ 3. **Claude Sonnet**: $3/1M prompt + $15/1M completion
487
+ 4. **GPT-4**: $2.50/1M prompt + $10/1M completion
488
+
489
+ Show:
490
+ - Cost breakdown per model
491
+ - Savings percentage with DeepSeek
492
+ - When to use which model (cost vs quality)
493
+
494
+ Use the deepseek_chat tool with model: "deepseek-chat" for this analysis.`,
495
+ },
496
+ },
497
+ ],
498
+ }));
499
+ server.registerPrompt('pair_programming', {
500
+ title: 'Pair Programming',
501
+ description: 'Interactive coding assistant that explains reasoning for code decisions',
502
+ argsSchema: {
503
+ task: z.string().describe('Coding task'),
504
+ language: z.string().describe('Programming language'),
505
+ style: z
506
+ .enum(['beginner', 'intermediate', 'expert'])
507
+ .default('intermediate')
508
+ .describe('Code complexity level'),
509
+ },
510
+ }, ({ task, language, style }, _extra) => ({
511
+ messages: [
512
+ {
513
+ role: 'user',
514
+ content: {
515
+ type: 'text',
516
+ text: `You are a pair programming partner. Help me write code with clear reasoning.
517
+
518
+ Task: ${task}
519
+ Language: ${language}
520
+ Level: ${style}
521
+
522
+ Please:
523
+ 1. **Plan**: Break down the task with reasoning
524
+ 2. **Code**: Write clean, commented code
525
+ 3. **Explain**: Explain each major decision
526
+ 4. **Test**: Suggest test cases with reasoning
527
+ 5. **Optimize**: Mention potential improvements
528
+
529
+ Use the deepseek_chat tool with model: "deepseek-reasoner" for thoughtful code generation.`,
530
+ },
531
+ },
532
+ ],
533
+ }));
534
+ // Function Calling Prompts
535
+ server.registerPrompt('function_call_debug', {
536
+ title: 'Function Calling Debug',
537
+ description: 'Debug function calling issues with DeepSeek models',
538
+ argsSchema: {
539
+ tools_json: z.string().describe('JSON string of tool definitions'),
540
+ messages_json: z
541
+ .string()
542
+ .describe('JSON string of conversation messages'),
543
+ error: z
544
+ .string()
545
+ .optional()
546
+ .describe('Error message or unexpected behavior'),
547
+ },
548
+ }, ({ tools_json, messages_json, error }, _extra) => ({
549
+ messages: [
550
+ {
551
+ role: 'user',
552
+ content: {
553
+ type: 'text',
554
+ text: `You are a function calling expert. Debug this function calling setup.
555
+
556
+ Tool Definitions:
557
+ \`\`\`json
558
+ ${tools_json}
559
+ \`\`\`
560
+
561
+ Messages:
562
+ \`\`\`json
563
+ ${messages_json}
564
+ \`\`\`
565
+
566
+ ${error ? `Error/Issue: ${error}` : 'The model is not calling the expected function.'}
567
+
568
+ Please analyze:
569
+ 1. **Tool Schema**: Are the tool definitions valid and well-structured?
570
+ 2. **Messages**: Are messages properly formatted for function calling?
571
+ 3. **Issue**: What might be causing the problem?
572
+ 4. **Fix**: Suggest corrected tool definitions and/or messages
573
+ 5. **Best Practices**: Tips for reliable function calling
574
+
575
+ Use the deepseek_chat tool with model: "deepseek-reasoner" for thorough analysis.`,
576
+ },
577
+ },
578
+ ],
579
+ }));
580
+ server.registerPrompt('create_function_schema', {
581
+ title: 'Create Function Schema',
582
+ description: 'Generate JSON Schema for function calling from natural language description',
583
+ argsSchema: {
584
+ description: z
585
+ .string()
586
+ .describe('Natural language description of the function'),
587
+ examples: z.string().optional().describe('Example inputs/outputs'),
588
+ },
589
+ }, ({ description, examples }, _extra) => ({
590
+ messages: [
591
+ {
592
+ role: 'user',
593
+ content: {
594
+ type: 'text',
595
+ text: `You are an expert at creating JSON Schemas for function calling. Create a tool definition from this description.
596
+
597
+ Function Description: ${description}
598
+ ${examples ? `\nExamples:\n${examples}` : ''}
599
+
600
+ Generate:
601
+ 1. **Tool Definition**: Complete JSON tool definition with type, function name, description, and parameters schema
602
+ 2. **Parameters**: Well-typed JSON Schema with descriptions for each parameter
603
+ 3. **Required Fields**: Which parameters are required
604
+ 4. **Example Call**: Show an example of how the model would call this function
605
+ 5. **Usage**: How to use this with the deepseek_chat tool's \`tools\` parameter
606
+
607
+ Output the tool definition as a JSON code block ready to use.
608
+
609
+ Use the deepseek_chat tool with model: "deepseek-reasoner" for precise schema generation.`,
610
+ },
611
+ },
612
+ ],
613
+ }));
136
614
  // Start server with stdio transport
137
615
  async function main() {
138
- console.error('[DeepSeek MCP] Starting server...');
616
+ console.error('[DeepSeek MCP] Starting server v1.1.0...');
139
617
  // Test connection
140
618
  console.error('[DeepSeek MCP] Testing API connection...');
141
619
  const isConnected = await deepseek.testConnection();
@@ -150,7 +628,8 @@ async function main() {
150
628
  const transport = new StdioServerTransport();
151
629
  await server.connect(transport);
152
630
  console.error('[DeepSeek MCP] Server running on stdio');
153
- console.error('[DeepSeek MCP] Available tools: deepseek_chat');
631
+ console.error('[DeepSeek MCP] Available tools: deepseek_chat (with function calling support)');
632
+ console.error('[DeepSeek MCP] Available prompts: 12 reasoning templates');
154
633
  }
155
634
  // Error handling
156
635
  process.on('uncaughtException', (error) => {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":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