This project is 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. - Chat Interf
Add this skill
npx mdskills install OthmaneBlial/term-mcp-deepseekWell-documented MCP-like server with terminal execution via DeepSeek API, though not fully MCP-compliant
1# DeepSeek MCP-like Server for Terminal23[](https://archestra.ai/mcp-catalog/othmaneblial__term_mcp_deepseek)4This project is 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:56- List available tools.7- Invoke commands on an active shell session.8- Integrate with an AI chat (DeepSeek) that can include special instructions (e.g., `CMD:` lines) to trigger command execution.910> **Note:** While this implementation captures many of the MCP ideas and includes features like real-time streaming, session management, and basic security, 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., complete JSON‑RPC protocol support, advanced authentication, and comprehensive error handling) would be needed for production use.1112## Features1314- **Chat Interface:**15 A modern web-based chat client (using Flask and Tailwind CSS) where users can interact with the server, now with real-time updates and improved error handling.1617- **AI Integration:**18 Uses the DeepSeek API to generate responses. The AI can instruct the server to execute terminal commands by including lines beginning with `CMD:`.1920- **Terminal Command Execution:**21 Executes shell commands via a persistent Bash session using the `pexpect` library and returns output to the client, with added real-time streaming capabilities.2223- **MCP Endpoints:**24 Provides `/mcp/list_tools` and `/mcp/call_tool` endpoints that mimic MCP tool discovery and invocation, with expanded protocol support including prompts, resources, and roots.2526- **Real-time Streaming:**27 Server-Sent Events (SSE) for live command execution updates and terminal output.2829- **Security Enhancements:**30 Basic authentication, rate limiting, input validation, and security headers for safer operation.3132- **Multiple Transport Options:**33 Supports both HTTP REST API and STDIO command-line interface for flexibility.3435- **Session Management:**36 Improved session handling and conversation storage.3738- **Docker Support:**39 Containerization for easier deployment and testing.4041## Getting Started4243### Prerequisites4445- Python 3.8+46- [pip](https://pip.pypa.io/)47- A valid DeepSeek API key4849### Installation50511. **Clone the repository:**5253 ```bash54 git clone https://github.com/OthmaneBlial/term_mcp_deepseek.git55 cd term_mcp_deepseek56 ```57582. **Create and activate a virtual environment:**5960 ```bash61 python3 -m venv venv62 source venv/bin/activate # On Windows, use `venv\Scripts\activate`63 ```64653. **Install the required dependencies:**6667 ```bash68 pip install -r requirements.txt69 ```70714. **Configure your API key:**7273 Update the `DEEPSEEK_API_KEY` in `.env` with your DeepSeek API key.7475### Running the Server7677#### Quick Start7879Use the provided startup script for convenience:8081```bash82chmod +x startup.sh83./startup.sh84```8586#### Manual Start8788Run the Flask server with:8990```bash91python server.py92```9394Visit [http://127.0.0.1:8000](http://127.0.0.1:8000) to access the chat interface.9596#### Docker9798For containerized deployment:99100```bash101docker-compose up -d102```103104## Endpoints105106### Chat Endpoint107- **URL:** `/chat`108- **Method:** `POST`109- **Payload:** `{ "message": "your message here" }`110- **Description:**111 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.112113### MCP Endpoints114115#### List Tools116- **URL:** `/mcp/list_tools`117- **Method:** `POST`118- **Response:**119 JSON listing available tools (e.g., `write_to_terminal`, `read_terminal_output`, `send_control_character`).120121#### Call Tool122- **URL:** `/mcp/call_tool`123- **Method:** `POST`124- **Payload:**125 ```json126 {127 "name": "tool_name",128 "arguments": { ... }129 }130 ```131- **Description:**132 Directly invoke a tool command on the server.133134### Real-time Streaming135- **URL:** `/stream?session_id=session_id`136- **Method:** `GET`137- **Description:** Server-Sent Events endpoint for real-time command output updates.138139## Future Improvements140141- **Protocol Standardization:**142 Implement JSON‑RPC for a more robust and standardized communication protocol.143144- **Real-time Communication:**145 Add Server‑Sent Events (SSE) or WebSockets for live command output streaming.146147- **Session & Security Enhancements:**148 Introduce per‑user sessions, proper authentication, input sanitization, and comprehensive error handling.149150- **Modular Code Architecture:**151 Further separate API logic from business logic for better maintainability and scalability.152153## License154155This project is open-source and available under the [MIT License](LICENSE).
Full transparency — inspect the skill content before installing.