Cover image
Try Now
2025-03-29

使用DeepSeek API进行终端的类似MCP的服务器

3 years

Works with Finder

1

Github Watches

0

Github Forks

4

Github Stars

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 with CMD:.

  • Terminal Command Execution:
    Executes shell commands via a persistent Bash session using the pexpect library and returns output to the client.

  • MCP Endpoints:
    Provides /mcp/list_tools and /mcp/call_tool endpoints that mimic MCP tool discovery and invocation.

Getting Started

Prerequisites

  • Python 3.8+
  • pip
  • A valid DeepSeek API key

Installation

  1. Clone the repository:

    git clone https://github.com/OthmaneBlial/term_mcp_deepseek.git
    cd term_mcp_deepseek
    
  2. Create and activate a virtual environment:

    python3 -m venv venv
    source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
    
  3. Install the required dependencies:

    pip install -r requirements.txt
    
  4. Configure your API key:

    Update the DEEPSEEK_API_KEY in .env with 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.

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Daren White
  • A supportive coach for mastering all Spanish tenses.

  • J. DE HARO OLLE
  • Especialista en juegos de palabras en varios idiomas.

  • albert tan
  • Japanese education, creating tailored learning experiences.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • rahulc0dy
  • 测试您的MCP服务器。

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • 1Panel-dev
  • 🔥1Panel提供了直观的Web接口和MCP服务器,用于在Linux服务器上管理网站,文件,容器,数据库和LLMS。

  • Mintplex-Labs
  • 带有内置抹布,AI代理,无代理构建器,MCP兼容性等的多合一桌面和Docker AI应用程序。

  • GeyserMC
  • 与Minecraft客户端/服务器通信的库。

  • awslabs
  • AWS MCP服务器 - 将AWS最佳实践直接带入您的开发工作流程的专门MCP服务器

    Reviews

    1 (1)
    Avatar
    user_MtIngbcE
    2025-04-16

    As a devoted user of term_mcp_deepseek, I am thoroughly impressed with its performance and efficiency. The tool offers a robust solution for deep term search, making my workflow significantly smoother. OthmaneBlial has done a fantastic job with this project. The seamless integration and user-friendly interface have made it a staple in my daily tasks. Highly recommended!