DeepSeek MCP-like Server for Terminal
A MCP‑like server using the DeepSeek API for Terminal
OthmaneBlial
README
DeepSeek MCP-like Server for Terminal
This project is a prototype implementation of an MCP‑like server using the DeepSeek API. It aims to demonstrate the core concepts behind the Model Context Protocol (MCP) by exposing endpoints that allow AI assistants to:
- List available tools.
- Invoke commands on an active shell session.
- Integrate with an AI chat (DeepSeek) that can include special instructions (e.g.,
CMD:lines) to trigger command execution.
Note: While this implementation captures many of the MCP ideas, it is not yet a fully compliant MCP server as defined by Anthropic. It is designed as a proof-of-concept, and further enhancements (e.g., JSON‑RPC protocol support, real‑time updates via SSE, session management, and improved security) would be needed for production use.
Features
-
Chat Interface:
A simple web-based chat client (using Flask and Tailwind CSS) where users can interact with the server. -
AI Integration:
Uses the DeepSeek API to generate responses. The AI can instruct the server to execute terminal commands by including lines beginning withCMD:. -
Terminal Command Execution:
Executes shell commands via a persistent Bash session using thepexpectlibrary and returns output to the client. -
MCP Endpoints:
Provides/mcp/list_toolsand/mcp/call_toolendpoints that mimic MCP tool discovery and invocation.
Getting Started
Prerequisites
- Python 3.8+
- pip
- A valid DeepSeek API key
Installation
-
Clone the repository:
git clone https://github.com/OthmaneBlial/term_mcp_deepseek.git cd term_mcp_deepseek -
Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate` -
Install the required dependencies:
pip install -r requirements.txt -
Configure your API key:
Update the
DEEPSEEK_API_KEYin.envwith your DeepSeek API key.
Running the Server
Run the Flask server with:
python server.py
Visit http://127.0.0.1:5000 to access the chat interface.
Endpoints
Chat Endpoint
- URL:
/chat - Method:
POST - Payload:
{ "message": "your message here" } - Description:
Adds the user message to the conversation, sends it to the DeepSeek API, looks for any command instructions (CMD:), executes them, and returns the final response.
MCP Endpoints
List Tools
- URL:
/mcp/list_tools - Method:
POST - Response:
JSON listing available tools (e.g.,write_to_terminal,read_terminal_output,send_control_character).
Call Tool
- URL:
/mcp/call_tool - Method:
POST - Payload:
{ "name": "tool_name", "arguments": { ... } } - Description:
Directly invoke a tool command on the server.
Future Improvements
-
Protocol Standardization:
Implement JSON‑RPC for a more robust and standardized communication protocol. -
Real-time Communication:
Add Server‑Sent Events (SSE) or WebSockets for live command output streaming. -
Session & Security Enhancements:
Introduce per‑user sessions, proper authentication, input sanitization, and comprehensive error handling. -
Modular Code Architecture:
Further separate API logic from business logic for better maintainability and scalability.
License
This project is open-source and available under the MIT License.
Recommended Servers
Sequential Thinking MCP Server
This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.
mixpanel
Connect to your Mixpanel data. Query events, retention, and funnel data from Mixpanel analytics.
Crypto Price & Market Analysis MCP Server
A Model Context Protocol (MCP) server that provides comprehensive cryptocurrency analysis using the CoinCap API. This server offers real-time price data, market analysis, and historical trends through an easy-to-use interface.
MCP PubMed Search
Server to search PubMed (PubMed is a free, online database that allows users to search for biomedical and life sciences literature). I have created on a day MCP came out but was on vacation, I saw someone post similar server in your DB, but figured to post mine.
dbt Semantic Layer MCP Server
A server that enables querying the dbt Semantic Layer through natural language conversations with Claude Desktop and other AI assistants, allowing users to discover metrics, create queries, analyze data, and visualize results.
Vectorize
Vectorize MCP server for advanced retrieval, Private Deep Research, Anything-to-Markdown file extraction and text chunking.
Nefino MCP Server
Provides large language models with access to news and information about renewable energy projects in Germany, allowing filtering by location, topic (solar, wind, hydrogen), and date range.
MATLAB MCP Server
Integrates MATLAB with AI to execute code, generate scripts from natural language, and access MATLAB documentation seamlessly.
Macrostrat MCP Server
Enables Claude to query comprehensive geologic data from the Macrostrat API, including geologic units, columns, minerals, and timescales through natural language.
MCP Word Counter
A Model Context Protocol server that provides tools for analyzing text documents, including counting words and characters. This server helps LLMs perform text analysis tasks by exposing simple document statistics functionality.