Skip to main content
Glama
arikusi

Deepseek MCP Server

by arikusi

v2.0.0 runs on DeepSeek V4. Two models, deepseek-v4-flash (fast and economical) and deepseek-v4-pro (top capability), both with a 1M-token context window and optional chain-of-thought thinking. Existing deepseek-chat and deepseek-reasoner setups keep working through deprecated aliases, so upgrading is drop-in, but new setups should use the V4 names.

Quick Start

Remote (No Install)

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}"
      }
    }
  }
}

Local (stdio)

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 file

Get your API key: https://platform.deepseek.com


Related MCP server: DeepSeek MCP Sample

Features

  • DeepSeek V4: deepseek-v4-flash and deepseek-v4-pro, both with 1M context and optional chain-of-thought thinking mode

  • Multi-Turn Sessions: Conversation context preserved across requests via session_id parameter

  • Model Fallback & Circuit Breaker: Automatic fallback between models with circuit breaker protection against cascading failures

  • MCP Resources: deepseek://models, deepseek://config, deepseek://usage — query model info, config, and usage stats

  • Thinking Mode: Enable chain-of-thought reasoning on either V4 model with thinking: {type: "enabled"}

  • JSON Output Mode: Structured JSON responses with json_mode: true

  • Schema-Validated JSON: Pass a response_schema and the server validates the output against it, with bounded repair retries and a ReDoS guard on schema patterns

  • Function Calling: OpenAI-compatible tool use with up to 128 tool definitions

  • Fill-in-the-Middle (FIM): Code and content completion between a prefix and suffix via the deepseek_fim tool

  • Cache-Aware Cost Tracking: Automatic cost calculation with cache hit/miss breakdown

  • Session Management Tool: List, delete, and clear sessions via deepseek_sessions tool

  • Configurable: Environment-based configuration with validation

  • 12 Prompt Templates: Templates for debugging, code review, function calling, and more

  • Streaming Support: Real-time response generation

  • Multimodal Ready: Content part types for text + image input (enable with ENABLE_MULTIMODAL=true)

  • Remote Endpoint: Hosted at deepseek-mcp.tahirl.com/mcp — BYOK (Bring Your Own Key), no install needed

  • HTTP Transport: Self-hosted remote access via Streamable HTTP with TRANSPORT=http

  • Docker Ready: Multi-stage Dockerfile with health checks for containerized deployment

  • Tested: 280 tests, ~89% line coverage

  • Type-Safe: Full TypeScript implementation

  • MCP Compatible: Works with any MCP-compatible CLI (Claude Code, Gemini CLI, etc.)

Installation

Prerequisites

Manual Installation

If you prefer to install manually:

npm install -g @arikusi/deepseek-mcp-server

From Source

  1. Clone the repository

git clone https://github.com/arikusi/deepseek-mcp-server.git
cd deepseek-mcp-server
  1. Install dependencies

npm install
  1. Build the project

npm run build

Usage

Once configured, your MCP client will have access to deepseek_chat, deepseek_fim, 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.

Manual Configuration (Advanced)

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 Code: ~/.claude.json (add to projects["your-project-path"].mcpServers section)

  • Other MCP clients: Check your client's documentation for config file location

Available Tools

deepseek_chat

Chat 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 text

    • tool_call_id (optional): Required for tool role messages

  • model (optional): "deepseek-v4-flash" (default) or "deepseek-v4-pro". The deprecated "deepseek-chat" and "deepseek-reasoner" aliases are still accepted and resolve to v4-flash (non-thinking / thinking); prefer the V4 names.

  • temperature (optional): 0-2, controls randomness (default: 1.0). Ignored when thinking mode is enabled.

  • max_tokens (optional): Maximum tokens to generate (V4 models support up to 384000)

  • 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): Toggle thinking mode, {type: "enabled"} to reason or {type: "disabled"} for a fast answer (non-thinking is the default)

  • reasoning_effort (optional): "high" (default) or "max", applies only while thinking mode is active

  • json_mode (optional): Enable JSON output mode (supported by both models)

  • response_schema (optional): A JSON Schema to validate the model output against. Implies JSON output. The server validates the parsed result and, on failure, issues up to RESPONSE_SCHEMA_MAX_RETRIES repair retries (default 2, set 0 to disable) that feed the validation error back to the model. Schema regex patterns are screened for ReDoS and an unsafe pattern is rejected up front.

  • session_id (optional): Session ID for multi-turn conversations. Previous context is automatically prepended.

Response includes:

  • Content with formatting (recovered as clean JSON when JSON output is requested)

  • Function call results (if tools were used)

  • Request information (tokens, model, cost in USD)

  • structuredContent.request: a self-contained per-request usage and cost summary (token counts, cache hit/miss, cost_usd), aggregated across any repair retries

  • structuredContent.effective and fallback: what was actually sent after alias/thinking resolution, and any silent model fallback that fired

  • structuredContent.schema: when response_schema is used, {valid, attempts, error?}; json_parse_error when JSON output could not be recovered

Example:

{
  "messages": [
    {
      "role": "user",
      "content": "Explain the theory of relativity in simple terms"
    }
  ],
  "model": "deepseek-v4-flash",
  "temperature": 0.7,
  "max_tokens": 1000
}

Reasoning Example (v4-flash with thinking enabled):

{
  "messages": [
    {
      "role": "user",
      "content": "If I have 10 apples and eat 3, then buy 5 more, how many do I have?"
    }
  ],
  "model": "deepseek-v4-flash",
  "thinking": { "type": "enabled" }
}

Thinking mode returns the chain-of-thought in <thinking> tags followed by the final answer.

DeepSeek V4 Pro Example (hardest tasks):

{
  "messages": [
    {
      "role": "user",
      "content": "Prove that the square root of 2 is irrational."
    }
  ],
  "model": "deepseek-v4-pro",
  "thinking": { "type": "enabled" }
}

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-v4-flash",
  "thinking": { "type": "enabled" }
}

When thinking mode is enabled, temperature and top_p 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-v4-flash",
  "json_mode": true
}

JSON mode ensures the model outputs valid JSON. Include the word "json" in your prompt for best results. Supported by all models.

Schema-Validated JSON Example:

{
  "messages": [
    {
      "role": "user",
      "content": "Classify this review sentiment as json: \"Absolutely loved it\""
    }
  ],
  "model": "deepseek-v4-flash",
  "response_schema": {
    "type": "object",
    "properties": {
      "sentiment": { "type": "string", "enum": ["positive", "negative", "neutral"] },
      "confidence": { "type": "number", "minimum": 0, "maximum": 1 }
    },
    "required": ["sentiment", "confidence"],
    "additionalProperties": false
  }
}

The server validates the parsed output against the schema. If it does not match, it retries up to RESPONSE_SCHEMA_MAX_RETRIES times (default 2), feeding the validation error back to the model, and returns the first schema-valid object. A persistent mismatch is surfaced as structuredContent.schema.valid = false rather than a silently coerced answer. Regex patterns in the schema are screened for catastrophic backtracking (ReDoS); an unsafe pattern is rejected up front as an invalid schema.

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_fim

Fill-in-the-Middle completion. You give a prompt (the prefix) and an optional suffix, and the model completes the text in between. It is built for code completion and content infilling rather than conversation. FIM runs on DeepSeek's Beta endpoint in non-thinking mode, and the API caps output at 4096 tokens.

Parameters:

  • prompt (required): The prefix text before the gap. For code completion, this is the code up to the cursor.

  • suffix (optional): The text after the gap. The model fills the space between prompt and suffix.

  • model (optional): "deepseek-v4-flash" (default) or "deepseek-v4-pro". The deprecated "deepseek-chat" and "deepseek-reasoner" aliases are still accepted and resolve to v4-flash (FIM has no thinking mode).

  • max_tokens (optional): Maximum tokens to generate, up to 4096.

  • temperature (optional): 0-2, controls randomness (default: 1.0).

  • stop (optional): A stop string or an array of up to 16 stop strings.

Response includes:

  • The completion text

  • Request information (tokens, model, cost in USD)

  • Structured data with text, usage, finish_reason, and cost_usd fields

Example (code completion):

{
  "prompt": "def fib(n):\n    if n < 2:\n        return n\n    return ",
  "suffix": "\n\nprint(fib(10))",
  "model": "deepseek-v4-flash",
  "max_tokens": 64
}

The model returns the missing middle, e.g. fib(n-1) + fib(n-2), using both the prefix and the suffix as context. Available on both the npm/stdio server and the hosted worker endpoint.

deepseek_sessions

Manage 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"}

Available Resources

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)

Model Fallback & Circuit Breaker

When a model fails with a retryable error (429, 503, timeout), the server automatically falls back to the other model:

  • deepseek-v4-flash fails → tries deepseek-v4-pro

  • deepseek-v4-pro fails → tries deepseek-v4-flash

The deprecated aliases (which resolve to v4-flash) fall back to deepseek-v4-pro.

The circuit breaker protects against cascading failures:

  • After CIRCUIT_BREAKER_THRESHOLD consecutive failures (default: 5), the circuit opens (fast-fail mode)

  • After CIRCUIT_BREAKER_RESET_TIMEOUT ms (default: 30000), it enters half-open state and sends a probe request

  • If the probe succeeds, the circuit closes and normal operation resumes

Fallback can be disabled with FALLBACK_ENABLED=false.

Available Prompts

Prompt templates (12 total):

Core Reasoning

  • debug_with_reasoning: Debug code with step-by-step analysis

  • code_review_deep: Comprehensive code review (security, performance, quality)

  • research_synthesis: Research topics and create structured reports

  • strategic_planning: Create strategic plans with reasoning

  • explain_like_im_five: Explain complex topics in simple terms

Advanced

  • mathematical_proof: Prove mathematical statements rigorously

  • argument_validation: Analyze arguments for logical fallacies

  • creative_ideation: Generate creative ideas with feasibility analysis

  • cost_comparison: Compare LLM costs for tasks

  • pair_programming: Interactive coding with explanations

Function Calling

  • function_call_debug: Debug function calling issues with tool definitions and messages

  • create_function_schema: Generate JSON Schema for function calling from natural language

Each prompt is optimized for thinking mode (v4-flash with thinking: {type: "enabled"}) to provide detailed reasoning.

Models

Both V4 models have a 1M-token context window, up to 384K output tokens, and support function calling, JSON mode, and optional chain-of-thought thinking. They are non-thinking by default here for fast responses; enable reasoning with thinking: {type: "enabled"}.

deepseek-v4-flash (default)

  • Best for: General conversations, coding, content generation, agent loops

  • Speed: Fast and economical

  • Context: 1M tokens

  • Max Output: 384K tokens

  • Pricing: $0.0028/1M cache hit, $0.14/1M cache miss, $0.28/1M output

deepseek-v4-pro

  • Best for: Complex reasoning, math, hard multi-step tasks, top-quality output

  • Speed: Slower than flash, highest capability

  • Context: 1M tokens

  • Max Output: 384K tokens

  • Pricing: $0.003625/1M cache hit, $0.435/1M cache miss, $0.87/1M output

Deprecated aliases

deepseek-chat and deepseek-reasoner are deprecated. They are still accepted and resolve to deepseek-v4-flash (chat = non-thinking, reasoner = thinking), so existing configs keep working, but they will be removed in the next major release. The DeepSeek API itself retired those two names on 2026-07-24; this server keeps translating them to V4 for you in the meantime. New setups should use deepseek-v4-flash or deepseek-v4-pro directly.

Configuration

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-v4-flash

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)

RESPONSE_SCHEMA_MAX_RETRIES

2

Repair retries when a response_schema validation fails (0 disables)

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

Development

Project Structure

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-fim.ts   # deepseek_fim tool (fill-in-the-middle)
│   │   ├── 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

Building

npm run build

Watch Mode (for development)

npm run watch

Testing

# Run all tests
npm test

# Watch mode
npm run test:watch

# With coverage report
npm run test:coverage

Testing Locally

# 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.

Remote Endpoint (Hosted)

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: Thinking mode 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. When latency matters, the default non-thinking mode is 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}'

HTTP Transport (Self-Hosted)

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:

  1. 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.

  2. To accept remote connections, set 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.

  3. For an internet-facing deployment, put an authenticating reverse proxy with TLS in front and set 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.

Docker

# 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.

Troubleshooting

"DEEPSEEK_API_KEY environment variable is not set"

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:

  1. For Claude Code: Open ~/.claude.json (Windows: C:\Users\USERNAME\.claude.json)

  2. Find the "mcpServers" section under your project path

  3. Add the env field with your API key:

"deepseek": {
  "type": "stdio",
  "command": "npx",
  "args": ["@arikusi/deepseek-mcp-server"],
  "env": {
    "DEEPSEEK_API_KEY": "your-api-key-here"
  }
}
  1. Save and restart Claude Code

"Failed to connect to DeepSeek API"

  1. Check your API key is valid

  2. Verify you have internet connection

  3. Check DeepSeek API status at https://status.deepseek.com

Server not appearing in your MCP client

  1. Verify the path to dist/index.js is correct

  2. Make sure you ran npm run build

  3. Check your MCP client's logs for errors

  4. Restart your MCP client completely

Permission Denied on macOS/Linux

Make the file executable:

chmod +x dist/index.js

Publishing to npm

To share this MCP server with others:

  1. Run npm login

  2. Run npm publish --access public

Users can then install with:

npm install -g @arikusi/deepseek-mcp-server

Contributing

Contributions are welcome! Please read our Contributing Guidelines before submitting PRs.

Reporting Issues

Found a bug or have a feature request? Please open an issue using our templates.

Development

# 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

Changelog

See CHANGELOG.md for version history and updates.

License

MIT License - see LICENSE file for details

Support

Resources

Acknowledgments


Made by @arikusi

An independent, community-maintained MCP server for the DeepSeek API.

Available Tools

3 tools
deepseek_chatDeepSeek Chat CompletionA

Chat with DeepSeek V4 models. deepseek-v4-flash (fast, economical) and deepseek-v4-pro (most capable), both 1M context with optional chain-of-thought thinking mode. deepseek-chat and deepseek-reasoner are accepted as backward-compatible aliases (resolve to v4-flash). Features: multi-turn sessions (session_id), function calling (tools parameter), thinking mode, JSON output mode, multimodal input (when enabled), automatic cost tracking, and model fallback with circuit breaker resilience.

ParametersJSON Schema
NameRequiredDescriptionDefault
modelNoModel to use. deepseek-v4-flash (default, fast/economical) or deepseek-v4-pro (most capable), both 1M context, up to 384K output. Non-thinking by default for speed; pass thinking:{type:"enabled"} to reason. Aliases: deepseek-chat -> v4-flash non-thinking, deepseek-reasoner -> v4-flash thinking.deepseek-v4-flash
toolsNoArray of tool definitions for function calling. Each tool has type "function" and a function object with name, description, and parameters (JSON Schema).
streamNoEnable streaming mode. Returns full response after streaming completes.
messagesYesArray of conversation messages. Each message has role (system/user/assistant/tool) and content (string or array of content parts for multimodal). Tool messages require tool_call_id.
thinkingNoToggle chain-of-thought thinking mode. Use {type: "enabled"} to reason, {type: "disabled"} for a fast direct answer (the default here). When enabled, temperature/top_p are ignored.
json_modeNoEnable JSON output mode. The model will output valid JSON. Include the word "json" in your prompt for best results. Supported by both models.
max_tokensNoMaximum tokens to generate. V4 models support up to 384000 output tokens.
session_idNoSession ID for multi-turn conversations. When provided, previous messages from this session are prepended to the current messages. If the session does not exist, it is created automatically. Omit for stateless single-turn requests.
temperatureNoSampling temperature (0-2). Higher = more random. Default: 1.0. Ignored when thinking mode is enabled.
tool_choiceNoControls which tool the model calls. "auto" (default), "none", "required", or {type:"function",function:{name:"..."}}
reasoning_effortNoReasoning effort while thinking mode is active: "high" (default) or "max". Only applies when thinking is enabled.

Output Schema

ParametersJSON Schema
NameRequiredDescription
modelYes
usageYes
contentYes
cost_usdNo
session_idNo
tool_callsNo
routed_fromNo
finish_reasonYes
reasoning_contentNo

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Despite no annotations, the description discloses key behavioral traits: model capabilities (1M context, up to 384K output), thinking mode, streaming, cost tracking, and circuit breaker resilience. However, it does not mention error handling, rate limits, or idempotency, which would improve transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single dense paragraph but remains informative and front-loaded with purpose. It could be more scannable with bullet points, but every sentence adds value. No superfluous content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (11 parameters, output schema present), the description covers features, model options, and capabilities. It lacks details on error handling but is otherwise complete enough for an AI agent to select and invoke the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description adds significant value beyond schema by explaining model aliases, default thinking behavior, JSON output hints, and session_id auto-creation. This enhances parameter understanding and usage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Chat with DeepSeek V4 models'. It specifies verb (chat), resource (DeepSeek V4 models), and key capabilities. It also distinguishes from the sibling tool 'deepseek_sessions' by focusing on chat completion rather than session management.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear guidance on when to use the tool (chat completion tasks) and explains model alias mapping (deepseek-chat -> v4-flash, deepseek-reasoner -> v4-flash thinking). It implies when not to use (e.g., if session management is needed, use deepseek_sessions), though it does not explicitly state exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

deepseek_fimDeepSeek FIM CompletionA

Fill-in-the-Middle (FIM) completion with DeepSeek V4. Provide a prompt (prefix) and an optional suffix; the model completes the text in between. Ideal for code completion and content infilling. Runs in non-thinking mode on the Beta endpoint; output is capped at 4K tokens. Aliases deepseek-chat and deepseek-reasoner resolve to deepseek-v4-flash (FIM has no thinking mode). Includes automatic cost tracking and model fallback with circuit breaker resilience.

ParametersJSON Schema
NameRequiredDescriptionDefault
stopNoOptional stop sequence(s). Generation stops when any is produced. A single string or an array of up to 16 strings.
modelNoModel to use. deepseek-v4-flash (default, fast/economical) or deepseek-v4-pro (most capable). Aliases deepseek-chat / deepseek-reasoner resolve to v4-flash. FIM is always non-thinking.deepseek-v4-flash
promptYesThe prefix text that comes before the content to generate. Required. For code completion, this is the code up to the cursor.
suffixNoOptional suffix text that comes after the content to generate. The model fills the gap between prompt and suffix.
max_tokensNoMaximum tokens to generate. FIM completions are capped at 4096 tokens by the API.
temperatureNoSampling temperature (0-2). Higher = more random. Default: 1.0.

Output Schema

ParametersJSON Schema
NameRequiredDescription
textYes
modelYes
usageYes
cost_usdNo
routed_fromNo
finish_reasonYes

TDQS

A3.9/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses non-thinking mode, Beta endpoint, 4K token cap, aliases resolution, automatic cost tracking, and model fallback with circuit breaker resilience.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise at three sentences, covering key points without fluff. However, it could be slightly better structured by front-loading the core purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the presence of an output schema (so return values need not be explained) and the description covering cost tracking and resilience, it is sufficiently complete for the complexity of the tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so baseline is 3. The description adds context like 'Ideal for code completion' but does not add meaning beyond what the schema provides for parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it is for Fill-in-the-Middle completion with DeepSeek V4, suitable for code completion and content infilling. It distinguishes itself from siblings by noting it has no thinking mode, but does not explicitly differentiate from deepseek_chat or deepseek_sessions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides context for when to use (code completion, content infilling) and mentions it runs in non-thinking mode, implying that for thinking tasks, deepseek_chat should be used. However, it does not explicitly state when not to use or compare to deepseek_sessions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

deepseek_sessionsDeepSeek Session ManagementA

Manage multi-turn conversation sessions. List active sessions, delete a specific session, or clear all sessions. Sessions store conversation history for use with the session_id parameter in deepseek_chat.

ParametersJSON Schema
NameRequiredDescriptionDefault
actionYesAction to perform. "list": show all active sessions, "clear": remove all sessions, "delete": remove a specific session (requires session_id)
session_idNoSession ID to delete (required when action is "delete")

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, so the description alone must convey behavioral traits. It lists actions but does not mention impacts like data loss on deletion, authentication needs, or rate limits. Basic transparency but insufficient for a management tool with destructive potential.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with two sentences, front-loading the purpose. Could be slightly more structured but is efficient and avoids unnecessary words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema is provided, yet the description does not specify what the 'list' action returns (e.g., session IDs). The tool is fairly complete given the schema and context signals, but missing output details and error conditions.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with both parameters described. The description adds useful context about sessions used with deepseek_chat, but adds no new details beyond what the schema already provides for parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool manages multi-turn conversation sessions with specific actions (list, delete, clear), and distinguishes from the sibling tool deepseek_chat by noting sessions are used with that tool's session_id parameter.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains that sessions store history used by deepseek_chat, providing context for when to use this management tool. However, it lacks explicit when-not-to-use guidance or alternative conditions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A4.2/5.0
Disambiguation5/5

Each tool has a distinctly separate purpose: chat, fill-in-the-middle completion, and session management. There is no overlap or ambiguity between them.

Naming Consistency5/5

All tools follow a consistent 'deepseek_verb' pattern in snake_case, making it easy to predict functionality from the name.

Tool Count5/5

Three tools cover the core interactions (chat, completion, session management) without being too few or too many for the server's stated scope.

Completeness4/5

The set provides the essential operations for the domain, but lacks auxiliary features like model listing or cost queries, which would enhance completeness.

Maintenance

ActivityMaintained
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

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/arikusi/deepseek-mcp-server'

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