Deepseek R1 MCP Server
A Model Context Protocol (MCP) server implementation for the Deepseek R1 language model. Deepseek R1 is a powerful language model optimized for reasoning tasks with a context window of 8192 tokens.
Why Node.js? This implementation uses Node.js/TypeScript as it provides the most stable integration with MCP servers. The Node.js SDK offers better type safety, error handling, and compatibility with Claude Desktop.
Quick Start
Installing manually
1# Clone and install 2git clone https://github.com/66julienmartin/MCP-server-Deepseek_R1.git 3cd deepseek-r1-mcp 4npm install 5 6# Set up environment 7cp .env.example .env # Then add your API key 8 9# Build and run 10npm run build
Prerequisites
- Node.js (v18 or higher)
- npm
- Claude Desktop
- Deepseek API key
Model Selection
By default, this server uses the deepseek-R1 model. If you want to use DeepSeek-V3 instead, modify the model name in src/index.ts
:
1// For DeepSeek-R1 (default) 2model: "deepseek-reasoner" 3 4// For DeepSeek-V3 5model: "deepseek-chat"
Project Structure
deepseek-r1-mcp/
├── src/
│ ├── index.ts # Main server implementation
├── build/ # Compiled files
│ ├── index.js
├── LICENSE
├── README.md
├── package.json
├── package-lock.json
└── tsconfig.json
Configuration
- Create a
.env
file:
DEEPSEEK_API_KEY=your-api-key-here
- Update Claude Desktop configuration:
1{ 2 "mcpServers": { 3 "deepseek_r1": { 4 "command": "node", 5 "args": ["/path/to/deepseek-r1-mcp/build/index.js"], 6 "env": { 7 "DEEPSEEK_API_KEY": "your-api-key" 8 } 9 } 10 } 11}
Development
1npm run dev # Watch mode 2npm run build # Build for production
Features
- Advanced text generation with Deepseek R1 (8192 token context window)
- Configurable parameters (max_tokens, temperature)
- Robust error handling with detailed error messages
- Full MCP protocol support
- Claude Desktop integration
- Support for both DeepSeek-R1 and DeepSeek-V3 models
API Usage
1{ 2 "name": "deepseek_r1", 3 "arguments": { 4 "prompt": "Your prompt here", 5 "max_tokens": 8192, // Maximum tokens to generate 6 "temperature": 0.2 // Controls randomness 7 } 8}
The Temperature Parameter
The default value of temperature
is 0.2.
Deepseek recommends setting the temperature
according to your specific use case:
| USE CASE | TEMPERATURE | EXAMPLE | |----------|-------------|---------| | Coding / Math | 0.0 | Code generation, mathematical calculations | | Data Cleaning / Data Analysis | 1.0 | Data processing tasks | | General Conversation | 1.3 | Chat and dialogue | | Translation | 1.3 | Language translation | | Creative Writing / Poetry | 1.5 | Story writing, poetry generation |
Error Handling
The server provides detailed error messages for common issues:
- API authentication errors
- Invalid parameters
- Rate limiting
- Network issues
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT