DE

DeepSeek R1/V3 MCP Server for Claude Desktop

Connect Claude Desktop to DeepSeek R1/V3 using an MCP server for seamless model access, low-latency inference, and efficient context management.

Quick Install
npx -y @66julienmartin/MCP-server-Deepseek_R1

Overview

This MCP (Model Context Protocol) server lets Claude Desktop connect to DeepSeek R1 and V3 models so you can run inference with low latency and efficient context management. It implements an MCP-compatible API layer that forwards Claude Desktop requests to a DeepSeek model backend (local or remote), handling tokenization, request/response routing, streaming, and context window behavior. The result is a drop-in bridge between the Claude Desktop UI and DeepSeek model instances.

The server is useful when you want Claude Desktop to use DeepSeek models for interactive sessions, private on-premise inference, or experimentation with R1 vs V3 variants. It provides model selection, simple auth, health checks, and optional streaming support so desktop clients can receive partial output as it is generated. This reduces integration friction and keeps latency low by minimizing intermediate transformations.

Features

  • MCP-compatible API for Claude Desktop integration
  • Support for DeepSeek R1 and V3 model variants
  • HTTP endpoints and optional WebSocket streaming for incremental output
  • Configurable model selection, context/window size, and request timeouts
  • Simple API key / token forwarding to DeepSeek backend
  • Health and readiness endpoints for orchestration
  • Lightweight, easy to run locally or in containerized environments

Installation / Configuration

Basic setup steps (clone, configure, run). Replace environment values with your DeepSeek backend endpoint and API key.

Clone the repository:

git clone https://github.com/66julienmartin/MCP-server-Deepseek_R1.git
cd MCP-server-Deepseek_R1

Run with Docker (recommended):

# Build image
docker build -t mcp-deepseek .

# Run container with environment variables
docker run -d \
  -e MCP_PORT=8080 \
  -e DEEPSEEK_BASE_URL="https://deepseek.example.com/api" \
  -e DEEPSEEK_API_KEY="sk-xxx" \
  -e DEFAULT_MODEL="deepseek-r1" \
  -p 8080:8080 \
  --name mcp-deepseek \
  mcp-deepseek

Run locally (if a runtime is available):

# install dependencies if provided (example for Node/Python)
# npm install
# or
# pip install -r requirements.txt

# Start server (example command; repository may provide a start script)
./start-server.sh

Example environment variables to configure:

MCP_PORT=8080
DEEPSEEK_BASE_URL="https://deepseek.example.com/api"
DEEPSEEK_API_KEY="sk-..."
DEFAULT_MODEL="deepseek-r1"   # or "deepseek-v3"
CONTEXT_WINDOW=4096
REQUEST_TIMEOUT=60           # seconds

Configure Claude Desktop to use the server:

  • Backend URL: http://localhost:8080 (or your host)
  • Model id: deepseek-r1 or deepseek-v3
  • Leave API key empty if using no-auth locally, or set token header if required

Available Resources

Common endpoints and their purposes:

EndpointMethodPurpose
/healthGETSimple health/status check
/modelsGETList available DeepSeek models (r1, v3)
/mcpPOSTMCP-compatible inference request (sync)
/mcp/streamWS or POST with SSEStreaming inference output
/metricsGETOptional runtime metrics / Prometheus endpoint

Example curl (sync request):

curl -X POST "http://localhost:8080/mcp" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-local" \
  -d '{
    "model": "deepseek-r1",
    "input": "Explain how backpropagation works in simple terms",
    "max_tokens": 300
  }'

Streaming via WebSocket (pseudocode):

  • Connect to ws://localhost:8080/mcp/stream
  • Send a JSON message with model and input
  • Receive incremental chunks until finalization

Use Cases

  • Interactive desktop assistant: Point Claude Desktop at this MCP server to use DeepSeek R1 for fast, concise answers or V3 for higher-fidelity responses while preserving conversation context.
  • Private on-prem inference: Keep sensitive data and models inside your network; Claude Desktop can connect to a local MCP server that forwards to a private DeepSeek instance.
  • Low-latency conversational apps: Use streaming endpoints to surface partial model output in the UI for more responsive interactions.
  • Model comparison and A/B testing: Switch the DEFAULT_MODEL or change model parameter per request to compare R1 vs V3 output quality and latency under the same UI workflow.
  • Development and debugging: Health and metrics endpoints help integrate the server into CI, monitoring, or load testing to observe behavior under different payloads and contexts.

Tips & Troubleshooting

  • Ensure the DEEPSEEK_API_KEY and base URL are correct and reachable from the machine running the MCP server.
  • If streaming is not working in Claude Desktop, verify WebSocket/SSE support and use the non-streaming /mcp endpoint as a fallback.
  • Monitor /metrics for request latencies and error rates during heavy usage; adjust REQUEST_TIMEOUT or CONCURRENCY settings if supported by the server.
  • For multi-user setups, run the MCP server behind a reverse proxy (nginx) and use TLS to secure traffic.

For source code, issues, and updates, see the GitHub repository: https://github.com/66julienmartin/MCP-server-Deepseek