by arikusi
Provides MCP endpoints that expose DeepSeek chat and reasoner models, supporting multi‑turn sessions, function calling, streaming, cost tracking, thinking mode, JSON output, and optional multimodal input.
The server acts as a bridge between MCP‑compatible clients (Claude Code, Gemini CLI, Cursor, Windsurf, etc.) and DeepSeek's V3.2 chat and reasoner models. It implements the Model Context Protocol, handling request routing, session management, fallback between models, circuit‑breaker protection, and real‑time cost calculation.
https://deepseek-mcp.tahirl.com/mcp and supply your DeepSeek API key via the Authorization: Bearer <key> header.npx @arikusi/deepseek-mcp-server and set DEEPSEEK_API_KEY in the environment. Example for Claude Code:
claude mcp add -s user deepseek npx @arikusi/deepseek-mcp-server -e DEEPSEEK_API_KEY=your-key
TRANSPORT=http and run the built package. Configure HTTP_PORT, HTTP_AUTH_TOKEN, etc., to expose a secure /mcp endpoint.deepseek-chat (fast, general) and deepseek-reasoner (chain‑of‑thought reasoning) both run on V3.2.session_id parameter.ENABLE_MULTIMODAL=true.Q: What if I forget to set DEEPSEEK_API_KEY?
A: The server will exit with an error stating the variable is missing. Add the variable in the MCP server config or pass -e DEEPSEEK_API_KEY=your-key when registering the server.
Q: How do I secure a self‑hosted HTTP endpoint?
A: Bind to 127.0.0.1 by default. If you need remote access, set HTTP_HOST=0.0.0.0 and provide HTTP_AUTH_TOKEN. Use a reverse proxy with TLS and configure HTTP_ALLOWED_HOSTS for DNS‑rebinding protection.
Q: My request times out on the reasoner model. What can I do?
A: Increase REQUEST_TIMEOUT (default 60000 ms) or switch to deepseek-chat for faster responses. The fallback mechanism can automatically switch models if enabled.
Q: Can I limit the number of concurrent sessions?
A: Yes, use MAX_SESSIONS (default 100) and SESSION_TTL_MINUTES to control lifespan.
Q: Is multimodal support ready?
A: Set ENABLE_MULTIMODAL=true and provide image parts in the request payload. The feature is experimental and requires a DeepSeek API key that supports image inputs.
Q: How do I view available models and usage statistics?
A: Query the MCP resources deepseek://models, deepseek://config, and deepseek://usage from any MCP‑compatible client.
Use the hosted endpoint directly — no npm install, no Node.js required. Bring your own DeepSeek API key:
Claude Code:
claude mcp add --transport http deepseek \
https://deepseek-mcp.tahirl.com/mcp \
--header "Authorization: Bearer YOUR_DEEPSEEK_API_KEY"
Cursor / Windsurf / VS Code:
{
"mcpServers": {
"deepseek": {
"url": "https://deepseek-mcp.tahirl.com/mcp",
"headers": {
"Authorization": "Bearer ${DEEPSEEK_API_KEY}"
}
}
}
}
Claude Code:
claude mcp add -s user deepseek npx @arikusi/deepseek-mcp-server -e DEEPSEEK_API_KEY=your-key-here
Gemini CLI:
gemini mcp add deepseek npx @arikusi/deepseek-mcp-server -e DEEPSEEK_API_KEY=your-key-here
Scope options (Claude Code):
-s user: Available in all your projects (recommended)-s local: Only in current project (default)-s project: Project-specific .mcp.json fileGet your API key: https://platform.deepseek.com
session_id parameterdeepseek://models, deepseek://config, deepseek://usage — query model info, config, and usage statsthinking: {type: "enabled"}json_mode: truedeepseek_sessions toolENABLE_MULTIMODAL=true)deepseek-mcp.tahirl.com/mcp — BYOK (Bring Your Own Key), no install neededTRANSPORT=httpIf you prefer to install manually:
npm install -g @arikusi/deepseek-mcp-server
git clone https://github.com/arikusi/deepseek-mcp-server.git
cd deepseek-mcp-server
npm install
npm run build
Once configured, your MCP client will have access to deepseek_chat and deepseek_sessions tools, plus 3 MCP resources.
Example prompts:
"Use DeepSeek to explain quantum computing"
"Ask DeepSeek Reasoner to solve: If I have 10 apples and buy 5 more..."
Your MCP client will automatically call the deepseek_chat tool.
If your MCP client doesn't support the add command, manually add to your config file:
{
"mcpServers": {
"deepseek": {
"command": "npx",
"args": ["@arikusi/deepseek-mcp-server"],
"env": {
"DEEPSEEK_API_KEY": "your-api-key-here"
}
}
}
}
Config file locations:
~/.claude.json (add to projects["your-project-path"].mcpServers section)deepseek_chatChat with DeepSeek AI models with automatic cost tracking and function calling support.
Parameters:
messages (required): Array of conversation messages
role: "system" | "user" | "assistant" | "tool"content: Message texttool_call_id (optional): Required for tool role messagesmodel (optional): "deepseek-chat" (default) or "deepseek-reasoner"temperature (optional): 0-2, controls randomness (default: 1.0). Ignored when thinking mode is enabled.max_tokens (optional): Maximum tokens to generate (deepseek-chat: max 8192, deepseek-reasoner: max 65536)stream (optional): Enable streaming mode (default: false)tools (optional): Array of tool definitions for function calling (max 128)tool_choice (optional): "auto" | "none" | "required" | {type: "function", function: {name: "..."}}thinking (optional): Enable thinking mode {type: "enabled"}json_mode (optional): Enable JSON output mode (supported by both models)session_id (optional): Session ID for multi-turn conversations. Previous context is automatically prepended.Response includes:
cost_usd and tool_calls fieldsExample:
{
"messages": [
{
"role": "user",
"content": "Explain the theory of relativity in simple terms"
}
],
"model": "deepseek-chat",
"temperature": 0.7,
"max_tokens": 1000
}
DeepSeek Reasoner Example:
{
"messages": [
{
"role": "user",
"content": "If I have 10 apples and eat 3, then buy 5 more, how many do I have?"
}
],
"model": "deepseek-reasoner"
}
The reasoner model will show its thinking process in <thinking> tags followed by the final answer.
Function Calling Example:
{
"messages": [
{
"role": "user",
"content": "What's the weather in Istanbul?"
}
],
"tools": [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get current weather for a location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "City name"
}
},
"required": ["location"]
}
}
}
],
"tool_choice": "auto"
}
When the model decides to call a function, the response includes tool_calls with the function name and arguments. You can then send the result back using a tool role message with the matching tool_call_id.
Thinking Mode Example:
{
"messages": [
{
"role": "user",
"content": "Analyze the time complexity of quicksort"
}
],
"model": "deepseek-chat",
"thinking": { "type": "enabled" }
}
When thinking mode is enabled, temperature, top_p, frequency_penalty, and presence_penalty are automatically ignored.
JSON Output Mode Example:
{
"messages": [
{
"role": "user",
"content": "Return a json object with name, age, and city fields for a sample user"
}
],
"model": "deepseek-chat",
"json_mode": true
}
JSON mode ensures the model outputs valid JSON. Include the word "json" in your prompt for best results. Supported by both deepseek-chat and deepseek-reasoner.
Multi-Turn Session Example:
{
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
],
"session_id": "my-session-1"
}
Use the same session_id across requests to maintain conversation context. Messages are stored in memory and prepended automatically. In HTTP transport each connected MCP session has its own isolated session store — a session_id created by one HTTP client is not visible to another (see HTTP Transport below).
deepseek_sessionsManage conversation sessions.
Parameters:
action (required): "list" | "clear" | "delete"session_id (optional): Required when action is "delete"Examples:
{"action": "list"}
{"action": "delete", "session_id": "my-session-1"}
{"action": "clear"}
MCP Resources provide read-only data about the server:
| Resource URI | Description |
|---|---|
deepseek://models |
Available models with capabilities, context limits, and pricing |
deepseek://config |
Current server configuration (API key masked) |
deepseek://usage |
Real-time usage statistics (requests, tokens, costs, sessions) |
When a model fails with a retryable error (429, 503, timeout), the server automatically falls back to the other model:
deepseek-chat fails → tries deepseek-reasonerdeepseek-reasoner fails → tries deepseek-chatThe circuit breaker protects against cascading failures:
CIRCUIT_BREAKER_THRESHOLD consecutive failures (default: 5), the circuit opens (fast-fail mode)CIRCUIT_BREAKER_RESET_TIMEOUT ms (default: 30000), it enters half-open state and sends a probe requestFallback can be disabled with FALLBACK_ENABLED=false.
Prompt templates (12 total):
Each prompt is optimized for the DeepSeek Reasoner model to provide detailed reasoning.
Both models run DeepSeek-V3.2 with unified pricing.
The server is configured via environment variables. All settings except DEEPSEEK_API_KEY are optional.
| Variable | Default | Description |
|---|---|---|
DEEPSEEK_API_KEY |
(required) | Your DeepSeek API key |
DEEPSEEK_BASE_URL |
https://api.deepseek.com |
Custom API endpoint |
DEFAULT_MODEL |
deepseek-chat |
Default model for requests |
SHOW_COST_INFO |
true |
Show cost info in responses |
REQUEST_TIMEOUT |
60000 |
Request timeout in milliseconds |
MAX_RETRIES |
2 |
Maximum retry count for failed requests |
SKIP_CONNECTION_TEST |
false |
Skip startup API connection test |
MAX_MESSAGE_LENGTH |
100000 |
Maximum message content length (characters) |
SESSION_TTL_MINUTES |
30 |
Session time-to-live in minutes |
MAX_SESSIONS |
100 |
Maximum number of concurrent sessions |
FALLBACK_ENABLED |
true |
Enable automatic model fallback on errors |
CIRCUIT_BREAKER_THRESHOLD |
5 |
Consecutive failures before circuit opens |
CIRCUIT_BREAKER_RESET_TIMEOUT |
30000 |
Milliseconds before circuit half-opens |
MAX_SESSION_MESSAGES |
200 |
Max messages per session (sliding window) |
ENABLE_MULTIMODAL |
false |
Enable multimodal (image) input support |
TRANSPORT |
stdio |
Transport mode: stdio or http |
HTTP_PORT |
3000 |
HTTP server port (when TRANSPORT=http) |
HTTP_HOST |
127.0.0.1 |
Bind address for HTTP transport. Loopback by default so a fresh run is not exposed. Set to 0.0.0.0 to accept remote connections (do this only with auth or a proxy in front) |
HTTP_AUTH_TOKEN |
(unset) | When set, POST /mcp requires Authorization: Bearer <token>. /health stays open. Strongly recommended whenever the port is reachable beyond localhost |
HTTP_ALLOWED_HOSTS |
(unset) | Comma-separated list of allowed Host headers for DNS rebinding protection when binding to 0.0.0.0 (e.g. mcp.example.com,localhost) |
Example with custom config:
claude mcp add -s user deepseek npx @arikusi/deepseek-mcp-server \
-e DEEPSEEK_API_KEY=your-key \
-e SHOW_COST_INFO=false \
-e REQUEST_TIMEOUT=30000
deepseek-mcp-server/
├── worker/ # Cloudflare Worker (remote BYOK endpoint)
│ ├── src/index.ts # Worker entry point
│ ├── wrangler.toml # Cloudflare config
│ └── package.json
├── src/
│ ├── index.ts # Entry point, bootstrap
│ ├── server.ts # McpServer factory (auto-version)
│ ├── deepseek-client.ts # DeepSeek API wrapper (circuit breaker + fallback)
│ ├── config.ts # Centralized config with Zod validation
│ ├── cost.ts # Cost calculation and formatting
│ ├── schemas.ts # Zod input validation schemas
│ ├── types.ts # TypeScript types + type guards
│ ├── errors.ts # Custom error classes
│ ├── session.ts # In-memory session store (multi-turn)
│ ├── circuit-breaker.ts # Circuit breaker pattern
│ ├── usage-tracker.ts # Usage statistics tracker
│ ├── transport-http.ts # Streamable HTTP transport (Express)
│ ├── tools/
│ │ ├── deepseek-chat.ts # deepseek_chat tool (sessions + fallback)
│ │ ├── deepseek-sessions.ts # deepseek_sessions tool
│ │ └── index.ts # Tool registration aggregator
│ ├── resources/
│ │ ├── models.ts # deepseek://models resource
│ │ ├── config.ts # deepseek://config resource
│ │ ├── usage.ts # deepseek://usage resource
│ │ └── index.ts # Resource registration aggregator
│ └── prompts/
│ ├── core.ts # 5 core reasoning prompts
│ ├── advanced.ts # 5 advanced prompts
│ ├── function-calling.ts # 2 function calling prompts
│ └── index.ts # Prompt registration aggregator
├── dist/ # Compiled JavaScript
├── llms.txt # AI discoverability index
├── llms-full.txt # Full docs for LLM context
├── vitest.config.ts # Test configuration
├── package.json
├── tsconfig.json
└── README.md
npm run build
npm run watch
# Run all tests
npm test
# Watch mode
npm run test:watch
# With coverage report
npm run test:coverage
# Set API key
export DEEPSEEK_API_KEY="your-key"
# Run the server
npm start
The server will start and wait for MCP client connections via stdio.
A hosted BYOK (Bring Your Own Key) endpoint is available at:
https://deepseek-mcp.tahirl.com/mcp
Send your DeepSeek API key as Authorization: Bearer <key>. No server-side API key stored — your key is used directly per request. Powered by Cloudflare Workers (global edge, zero cold start).
Note: The
deepseek-reasonermodel may take over 30 seconds for complex queries. Some MCP clients (e.g. Claude Code) have built-in tool call timeouts that may interrupt long-running requests. For complex tasks,deepseek-chatis recommended.
# Test health
curl https://deepseek-mcp.tahirl.com/health
# Test MCP (requires auth)
curl -X POST https://deepseek-mcp.tahirl.com/mcp \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_KEY" \
-d '{"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{}},"id":1}'
Run your own HTTP endpoint:
TRANSPORT=http HTTP_PORT=3000 DEEPSEEK_API_KEY=your-key node dist/index.js
Test the health endpoint:
curl http://localhost:3000/health
The MCP endpoint is available at POST /mcp (Streamable HTTP protocol).
Securing the endpoint (read before exposing it). In self-hosted HTTP mode the
server holds your DEEPSEEK_API_KEY and uses it for every deepseek_chat call.
Anyone who can reach POST /mcp can invoke tools and spend that key, so the
endpoint must not sit open on a public interface. The defaults are built around
this:
HTTP_HOST defaults to 127.0.0.1, so a plain run only listens on loopback and the SDK's DNS rebinding protection is active. Nothing off the machine can reach it.HTTP_HOST=0.0.0.0, but then set HTTP_AUTH_TOKEN as well so /mcp requires Authorization: Bearer <token>. If you bind to 0.0.0.0 without a token, the server prints a loud warning on startup.HTTP_ALLOWED_HOSTS to your real hostname(s).# Exposed deployment with a bearer token
TRANSPORT=http HTTP_HOST=0.0.0.0 HTTP_PORT=3000 \
HTTP_AUTH_TOKEN=$(openssl rand -hex 32) \
HTTP_ALLOWED_HOSTS=mcp.example.com \
DEEPSEEK_API_KEY=your-key node dist/index.js
# Calling it
curl -X POST http://mcp.example.com:3000/mcp \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{}},"id":1}'
HTTP_AUTH_TOKEN is a static gateway token for the self-hosted endpoint and is
unrelated to your DeepSeek key. It is separate from the hosted BYOK endpoint
above, where clients pass their own DeepSeek key as the bearer.
Session isolation (1.7.0+): In HTTP transport each connected MCP session
gets its own McpServer instance and its own SessionStore. Conversation
history, session listings, and deletions are scoped to the MCP session that
created them, so one client cannot read, enumerate, or wipe another client's
sessions. STDIO transport is single-tenant by nature and unaffected.
# Build
docker build -t deepseek-mcp-server .
# Run, reachable only from the host's loopback, with a bearer token
docker run -d -p 127.0.0.1:3000:3000 \
-e DEEPSEEK_API_KEY=your-key \
-e HTTP_AUTH_TOKEN=your-token \
deepseek-mcp-server
# Or use docker-compose
DEEPSEEK_API_KEY=your-key HTTP_AUTH_TOKEN=your-token docker compose up -d
The image runs HTTP transport on port 3000 with a health check. Inside the
container it binds 0.0.0.0 (required for the port mapping to work), so control
exposure at the publish layer: the example above and the bundled
docker-compose.yml publish to 127.0.0.1 only. If you publish the port on a
public interface, set HTTP_AUTH_TOKEN.
Option 1: Use the correct installation command
# Make sure to include -e flag with your API key
claude mcp add deepseek npx @arikusi/deepseek-mcp-server -e DEEPSEEK_API_KEY=your-key-here
Option 2: Manually edit the config file
If you already installed without the API key, edit your config file:
~/.claude.json (Windows: C:\Users\USERNAME\.claude.json)"mcpServers" section under your project pathenv field with your API key:"deepseek": {
"type": "stdio",
"command": "npx",
"args": ["@arikusi/deepseek-mcp-server"],
"env": {
"DEEPSEEK_API_KEY": "your-api-key-here"
}
}
dist/index.js is correctnpm run buildMake the file executable:
chmod +x dist/index.js
To share this MCP server with others:
npm loginnpm publish --access publicUsers can then install with:
npm install -g @arikusi/deepseek-mcp-server
Contributions are welcome! Please read our Contributing Guidelines before submitting PRs.
Found a bug or have a feature request? Please open an issue using our templates.
# Clone the repo
git clone https://github.com/arikusi/deepseek-mcp-server.git
cd deepseek-mcp-server
# Install dependencies
npm install
# Build in watch mode
npm run watch
# Run tests
npm test
# Lint
npm run lint
See CHANGELOG.md for version history and updates.
MIT License - see LICENSE file for details
Made by @arikusi
This is an unofficial community project and is not affiliated with DeepSeek.
Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by DMontgomery40
A Model Context Protocol server that proxies DeepSeek's language models, enabling seamless integration with MCP‑compatible applications.
by deepfates
Runs Replicate models through the Model Context Protocol, exposing tools for model discovery, prediction management, and image handling via a simple CLI interface.
by 66julienmartin
A Model Context Protocol (MCP) server implementation connecting Claude Desktop with DeepSeek's language models (R1/V3)
by ruixingshi
Provides Deepseek model's chain‑of‑thought reasoning to MCP‑enabled AI clients, supporting both OpenAI API mode and local Ollama mode.
by groundlight
Expose HuggingFace zero‑shot object detection models as tools for large language or vision‑language models, enabling object localisation and zoom functionality on images.
by tan-yong-sheng
Provides AI‑powered analysis of images and videos using Google Gemini or Vertex AI, supporting URLs, local files, and base64 inputs, and returning detailed descriptions, comparisons, object detection with annotated output, and video summarization.
by kumo-ai
Build, manage, and query relational graphs from CSV/Parquet, convert natural language to PQL, and obtain predictions, evaluations, and explanations from KumoRFM without any training.
by 66julienmartin
Provides a Model Context Protocol server for the Qwen Max language model, enabling seamless integration with Claude Desktop and other MCP‑compatible clients.
by Verodat
Enables AI models to interact with Verodat's data management capabilities through a set of standardized tools for retrieving, creating, and managing datasets.
{
"mcpServers": {
"deepseek": {
"command": "npx",
"args": [
"@arikusi/deepseek-mcp-server"
],
"env": {
"DEEPSEEK_API_KEY": "<YOUR_API_KEY>"
}
}
}
}claude mcp add deepseek npx @arikusi/deepseek-mcp-server