A DeepSeek MCP-like Server for Terminal
This project showcases a prototype implementation of a server inspired by the Model Context Protocol (MCP), leveraging the DeepSeek API to facilitate seamless interaction between Large Language Models (LLMs) and a terminal environment. It demonstrates how AI assistants can be empowered to:
CMD:
directives) to trigger command execution.Important Note: This implementation, while embodying the core principles of MCP, is not a fully compliant MCP server as defined by Anthropic. It serves as a proof-of-concept, highlighting the potential of MCP and requiring further development for production-ready deployment. Key areas for improvement include adherence to the JSON-RPC protocol, implementation of real-time updates via Server-Sent Events (SSE), robust session management, and enhanced security measures.
CMD:
.pexpect
library to establish and maintain a persistent Bash session, allowing for the execution of shell commands and the capture of their output, which is then relayed back to the client./mcp/list_tools
and /mcp/call_tool
endpoints, mimicking the MCP's mechanism for tool discovery and invocation, providing a standardized interface for LLMs to interact with the terminal environment.pip
(Python package installer)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 Dependencies:
pip install -r requirements.txt
Configure API Key:
Edit the .env
file and replace the placeholder value for DEEPSEEK_API_KEY
with your actual DeepSeek API key.
Execute the following command to start the Flask server:
python server.py
Access the chat interface by navigating to http://127.0.0.1:5000 in your web browser.
/chat
POST
{ "message": "your message here" }
CMD:
), executes those commands in the terminal, and returns the AI's response, incorporating the results of the command execution./mcp/list_tools
POST
write_to_terminal
, read_terminal_output
, and send_control_character
, along with their descriptions and expected arguments.URL: /mcp/call_tool
Method: POST
Payload:
{ "name": "tool_name", "arguments": { ... } }
Description: This endpoint allows for the direct invocation of a specific tool on the server. The name
field specifies the tool to be called, and the arguments
field provides the necessary parameters for the tool's execution.
๐ ๐ Autonomous shell execution, computer control and coding agent. (Mac)
๐ MCP server that can execute commands such as keyboard input and mouse movement
๐ ๐ ๐ฆ Analyzes your codebase identifying important files based on dependency relationships. Generates diagrams and importance scores, helping AI assistants understand the codebase.
๐ ๐ An MCP Server and VS Code Extension which enables (language agnostic) automatic debugging via breakpoints and expression evaluation.