DeepSeek MCP Server for Model Context APIs
Integrate with the DeepSeek MCP server to access advanced language models and versatile API endpoints for model context.
npx -y @DMontgomery40/deepseek-mcp-serverOverview
DeepSeek MCP Server is an open-source implementation of the Model Context Protocol (MCP) that exposes a standardized HTTP/WebSocket API for exchanging context with language models, orchestrating multi-model workflows, and persisting context artifacts. It acts as a middle layer between client applications and one or more model backends, unifying prompts, context fragments, embeddings, and metadata so developers can build reproducible, context-aware AI features.
Designed for teams building retrieval-augmented generation (RAG), multi-turn chat, or hybrid tool chains, DeepSeek makes it easier to manage model sessions, attach auxiliary resources (documents, embeddings, tool outputs), and serve streaming responses to clients. The server provides a compact set of endpoints that align with MCP conventions while remaining adaptable to different model hosts and vector stores.
Features
- HTTP and WebSocket APIs implementing core MCP endpoints
- Session and context management for multi-turn interactions
- Support for adding/searching context resources (documents, embeddings)
- Pluggable backend model hosts and vector stores
- Streaming inference responses (SSE/WebSocket)
- API key or token-based access control via environment variables
- Docker-friendly deployment with adjustable configuration via env vars
Installation / Configuration
Prerequisites: Docker (recommended) or a host runtime compatible with the repository (see project README for language/toolchain specifics).
Clone the repo:
Quick start with Docker:
# Build (if Dockerfile is present) or pull if an image exists
# Run with environment variables
Example docker-compose.yml:
version: '3.8'
services:
deepseek:
image: deepseek-mcp-server:latest
ports:
- "8080:8080"
environment:
- PORT=8080
- API_KEY=supersecret
- MODEL_BACKEND_URL=https://your-model-host.example.com
- VECTOR_DB_URL=http://vector-db:8200
vector-db:
image: your/vector-db:latest
ports:
- "8200:8200"
Common environment variables:
- PORT: HTTP port (default 8080)
- API_KEY: token to restrict access
- MODEL_BACKEND_URL: URL for the model inference host (can be an aggregator)
- VECTOR_DB_URL: vector store endpoint for embeddings and search
- LOG_LEVEL: debug/info/warn/error
Available Resources
The server exposes MCP-aligned endpoints to manage sessions, contexts, models, and streaming responses. Below is a concise reference:
| Method | Path | Purpose |
|---|---|---|
| POST | /v1/sessions | Create a new session/context |
| GET | /v1/sessions/{id} | Retrieve session state |
| POST | /v1/sessions/{id}/resources | Add documents/embeddings to session |
| POST | /v1/infer | Submit inference request (non-streaming) |
| GET / WS | /v1/stream/{session_id} | Stream model responses (SSE or WebSocket) |
| POST | /v1/search | Vector search across stored resources |
| GET | /v1/models | List configured model backends |
Example: add a resource to a session
Use Cases
Retrieval-Augmented Generation (RAG)
- Store a corpus of documents as session resources (text + embeddings).
- On user query, call /v1/search to fetch the most relevant passages and include them in /v1/infer payload to produce grounded answers.
Multi-turn Chat with Persistent Context
- Create a session per user (/v1/sessions).
- Append user messages and model outputs to the session resources.
- Use /v1/stream/{session_id} to deliver incremental responses to client UIs while preserving conversation history.
Multi-model Orchestration
- Configure multiple model backends via MODEL_BACKEND_URL or a registry.
- Route generation requests to different models based on profile (e.g., fast/cheap vs. high-quality) through the /v1/infer endpoint.
Tool Integration and Metadata Tracking
- Record the outputs of external tools (search engines, knowledge graph lookups) as session resources with metadata.
- Include tool outputs as context before calling a model to ensure deterministic, auditable behavior.
Example inference request (non-streaming):
Getting Help and Contributing
- Repository: https://github.com/DMontgomery40/deepseek-mcp-server
- Open issues or pull requests in the GitHub project for feature requests, bug reports, and community contributions.
- Check the repository README and docs subdirectory (if present) for platform-specific build instructions and extension points (e.g., adding new model adapters or vector store connectors).