Skip to main content
Glama
DEEPSEEK_INTEGRATION.mdโ€ข5.68 kB
# DeepSeek Integration Complete! ๐Ÿš€ ## Summary Successfully integrated DeepSeek AI provider into SAGE-MCP server with full support for all three DeepSeek models. ## What Was Done ### 1. Provider Implementation โœ… - Created `providers/deepseek.py` - OpenAI-compatible API integration - Base URL: `https://api.deepseek.com` - Full async support with proper error handling ### 2. Models Added โœ… | Model | Type | Description | Use Cases | |-------|------|-------------|-----------| | **deepseek-chat** | General Purpose | Fast, cost-effective, strong coding | Chat, debugging, refactoring (DEFAULT) | | **deepseek-reasoner** | Reasoning | Deep step-by-step analysis | Complex problems, math, debugging | | **deepseek-coder** | Code Specialized | Optimized for software development | Code generation, refactoring, tests | ### 3. Configuration โœ… **Environment Variable Added:** ```bash DEEPSEEK_API_KEY=your-deepseek-api-key-here ``` **Default Model Set:** ```bash DEFAULT_MODEL=deepseek-chat ``` **Allowed Models:** ```bash DEEPSEEK_ALLOWED_MODELS=deepseek-reasoner,deepseek-chat,deepseek-coder ``` ### 4. Files Modified โœ… 1. `providers/deepseek.py` - NEW: Provider implementation 2. `providers/__init__.py` - Added DeepSeek initialization 3. `config.py` - Added DEEPSEEK_API_KEY to get_api_keys() 4. `models/config.yaml` - Added 3 DeepSeek models with capabilities 5. `~/.claude/mcp_servers.json` - Added API key and configuration 6. `tests/providers/test_deepseek_provider.py` - NEW: Comprehensive tests 7. `test_deepseek.py` - NEW: Standalone testing script ## Test Results โœ… ### Basic Completion Test ```bash โœ“ DeepSeek chat response: Hello from DeepSeek test ``` ### Reasoning Model Test ```bash โœ“ DeepSeek reasoner response: To calculate 25 + 17, follow these steps: 1. Add the ones place digits: 5 + 7 = 12. Write down the 2 and carry over the 1 to the tens place. 2. Add the tens place digits: 2 (from 25) + 1 (from 17) + 1 (carried over) = 4. 3. Combine the tens and ones place: 42. Thus, 25 + 17 = 42. ``` ### Integration Test ```bash โœ“ Available models: ['deepseek-reasoner', 'deepseek-chat', 'deepseek-coder'] โœ“ Response: Hello from SAGE-MCP! ๐Ÿ‘‹ โœ“ Integration test passed! ``` ## Quality Checks โœ… - โœ… **Black**: Code formatted to 120 line length - โœ… **Ruff**: All linting issues fixed - โœ… **Tests**: All provider tests passing - โœ… **API Validation**: API key validated successfully ## How to Use ### Via MCP Server (Claude Desktop) The DeepSeek provider is now automatically available in Claude Desktop. Simply restart Claude and it will use `deepseek-chat` as the default model (as configured). ### Via CLI ```bash # Use deepseek-chat (default) ./cli.py chat "Explain async/await in Python" # Use deepseek-reasoner for complex problems ./cli.py think "Design an algorithm for X" --model deepseek-reasoner # Use deepseek-coder for code tasks ./cli.py refactor "path/to/code.py" --model deepseek-coder ``` ### Via SAGE Tool ```python # Chat mode result = await sage({ "prompt": "Explain decorators", "model": "deepseek-chat", "mode": "chat" }) # Reasoning mode result = await sage({ "prompt": "Solve this complex problem...", "model": "deepseek-reasoner", "mode": "think" }) # Code analysis result = await sage({ "prompt": "Analyze this code", "files": ["src/app.py"], "model": "deepseek-coder", "mode": "analyze" }) ``` ## Model Capabilities ### deepseek-chat (Default) ๐Ÿ’ฌ - **Reasoning**: Very Good - **Speed**: Fast - **Context**: 64K tokens - **Cost**: Very Low - **Best For**: General development, debugging, refactoring - **Priority**: 3 ### deepseek-reasoner ๐Ÿงฉ - **Reasoning**: Excellent - **Speed**: Slow (thinking required) - **Context**: 64K tokens - **Cost**: Low - **Best For**: Complex reasoning, math, deep analysis - **Priority**: 2 ### deepseek-coder ๐Ÿ‘จโ€๐Ÿ’ป - **Reasoning**: Very Good - **Speed**: Fast - **Context**: 64K tokens - **Cost**: Very Low - **Best For**: Code generation, refactoring, testing - **Priority**: 4 ## Cost Benefits DeepSeek offers excellent price/performance ratio: - Significantly cheaper than GPT-5/o3 - Comparable to Gemini Flash but with specialized models - Excellent for high-volume development tasks ## Next Steps 1. **Restart Claude Desktop** to load the new configuration 2. **Test the integration** with a simple chat 3. **Explore different models** for different tasks 4. **Adjust DEFAULT_MODEL** in mcp_servers.json if needed ## Testing Run the comprehensive test suite: ```bash # All DeepSeek tests python tests/providers/test_deepseek_provider.py # Specific test python tests/providers/test_deepseek_provider.py --test basic_completion # Standalone API test python test_deepseek.py ``` ## Troubleshooting ### Provider Not Initialized - Check that `DEEPSEEK_API_KEY` is set in `~/.claude/mcp_servers.json` - Restart Claude Desktop after configuration changes ### Model Not Available - Verify model name: `deepseek-chat`, `deepseek-reasoner`, or `deepseek-coder` - Check `DEEPSEEK_ALLOWED_MODELS` environment variable ### API Errors - Verify API key is valid: `python test_deepseek.py` - Check DeepSeek API status at https://api-docs.deepseek.com/ ## Architecture Notes - **Provider Type**: OpenAI-compatible (uses AsyncOpenAI client) - **Base URL**: https://api.deepseek.com - **Authentication**: Bearer token via API key - **Streaming**: Supported (via OpenAI client) - **Tools**: Supported (function calling) --- **Integration Status**: โœ… **COMPLETE** **Default Model**: `deepseek-chat` (most recent stable model) **Tested**: 2025-10-28 **API Key**: Configured and validated โœ“

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/david-strejc/sage-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server