MCP开发环境信息
一个MCP服务器,它向Cursor代码编辑器提供有关您的开发环境的详细信息,从而实现更具上下文感知能力的帮助。
服务介绍
DevEnvInfoServer - 用于开发环境信息的 Cursor MCP 服务器
该项目实现了一个 Cursor 模型上下文协议 (MCP) 服务器,该服务器向 Cursor 代码编辑器提供关于您的开发环境的详细信息。通过利用此服务器,Cursor 的智能代理可以更深入地了解您系统的配置、已安装的工具和正在运行的进程,从而提供更具上下文感知和帮助性的支持。
功能
此 MCP 服务器提供了以下关于您的开发环境的信息类别:
- System Information:
- Operating System Version and Platform Details
- Hardware Details (Processor, Machine, System Architecture)
- Python Versions and Locations
- Installed Package Managers (brew, npm, pip, yarn, uv, conda) and their versions
- Virtual Environment Information (detected environments and active environment)
- System Locale and Timezone
- Top 20 Environment Variables
- Available Shells (bash, zsh, fish, sh, powershell, cmd.exe)
- Simplified Firewall and Network Configurations (OS-dependent)
- Development Environment Details:
- Installed Compilers and Interpreters (gcc, clang, javac, node, ruby, perl, php, ghc, rustc, go)
- Jupyter Kernels and Running Containers (Docker, Podman)
- Virtual Machines (Hyper-V, VMware, VirtualBox)
- GPU and CUDA Information (NVIDIA GPUs and CUDA Compiler Version)
- Top Running Development Processes and Services
- Python Specific Information:
- Installed Python Packages (pip, conda, poetry, pyenv)
- Python Site-Packages Locations
- Active Python Environments
- Package Manager Details:
- Homebrew Installed Packages (macOS and Linux)
- Global Packages (npm, yarn, Rust toolchain, Go environment)
- Configuration and Dotfiles:
- Shell Configuration Files (.bashrc, .zshrc, .profile, .bash_profile, .config/fish/config.fish)
- Git, NPM, and Editor Configurations (VSCode, JetBrains, Neovim)
- Shell Aliases, Functions, and Custom Scripts (from shell config files)
- Installed Applications:
- Installed IDEs and Extensions (VSCode, JetBrains, Vim, Emacs)
- System Installed Applications (Simplified List)
- System and Hardware Performance (Simplified Metrics):
- CPU Load Average
- Battery and Power Management Configurations
- Temperature Sensors and Fan Speeds
- Network and Security (Simplified):
- Running Network Services and Open Ports
- VPN and Proxy Settings
- SSH Keys and Active Connections
- Simplified Firewall Logs and Rules
- Containerization and Virtualization:
- WSL (Windows Subsystem for Linux)
- Docker and Kubernetes (kubectl)
- Vagrant
- Virtual Machines (Hyper-V, VMware, VirtualBox)
- Development Tools and Languages:
- Installed Development Languages (Rust, Node.js, Perl, Ruby, PHP, Haskell)
- Version Management Tools (nvm, rbenv, rustup, pyenv)
- Debugging and Performance Monitoring:
- Load Averages, Memory Usage, IO Bottlenecks, GPU Utilization
- Available Debugger Tools (lldb, gdb, strace, dtrace)
- Version Control and CI/CD:
- Git Configuration and Remote Origins
- CI/CD Pipeline Configuration Files (Common types)
- Cloud and Remote Development:
- SSH Configurations and Active Remote Sessions
- Cloud SDKs (AWS, GCP, Azure, DigitalOcean)
- Remote Code Execution Environments (GitHub Codespaces, Gitpod)
- Code Execution and Debugging:
- Active Debugger Sessions (Basic check)
- Installed Debugging Tools (lldb, gdb, xdebug, pdb)
- Build Systems and Dependency Management:
- Installed Build Tools (Make, CMake, Bazel, Ninja)
- Detected Dependency Files (requirements.txt, package.json, Cargo.toml, etc.)
- Installed Compilers (gcc, clang, javac)
- Infrastructure and DevOps Tools:
- Local Kubernetes Configuration
- DevOps Tools (Terraform, Pulumi)
- Local Databases and Running Services (Simplified check for common DB services)
- Testing and Quality Assurance:
- Installed Testing Frameworks (pytest, Jest, Mocha)
- Code Linters and Formatters (flake8, pylint, eslint, prettier)
- Machine Learning and AI Development:
- GPU and CUDA Information
- PyTorch and TensorFlow Status (Installation and GPU availability)
- Embedded Development / IoT:
- Installed Embedded SDKs (Arduino, ESP-IDF, Raspberry Pi Tools)
- Connected Devices and Serial Ports (Simplified list of serial ports)
- Productivity and Workflow Enhancements:
- Shell Aliases, Functions, and Custom Scripts
- Shell History Analysis (Basic - last 20 lines of history)
- Background Automation and Task Scheduling (Simplified check for cron/Scheduled Tasks)
工作原理
此服务器使用 Model Context Protocol (MCP) 构建,并按以下方式工作:
- MCP 协议: 它实现了 MCP 服务器协议,允许 Cursor 与其通信以发现和利用其功能。
- 标准输入输出传输: 服务器使用
stdio传输,这意味着它通过标准输入和输出流与 Cursor 通信。 - 信息收集: 当 Cursor 的 Agent 请求信息时,该服务器执行各种系统命令(使用
subprocess)和 Python 库(如platform,os,sys,psutil,pyserial等)来收集有关您的开发环境的数据。 - 基于工具的访问: 每个信息类别都作为 MCP 服务器中的一个工具暴露出来。然后,Cursor 的 Agent 可以调用这些工具来检索特定的信息。
- Markdown 输出(可选): 服务器可以可选地生成一个 Markdown 文件 (
development_environment_info.md),其中包含所有收集到的信息,以便于审查和调试。 - Cursor 集成: 作为 MCP 客户端的 Cursor 可以连接到此服务器,并自动利用提供的工具来增强其对您开发上下文的理解。
安装
要安装并运行此 MCP 服务器,请按照以下步骤操作:
-
克隆仓库:
git clone https://github.com/carterlasalle/system_information_mcp.git cd system_information_mcp -
创建 Python 虚拟环境(推荐):
python -m venv venv -
激活虚拟环境:
- 在 Linux/macOS 上:
source venv/bin/activate - 在 Windows 上:
venv\Scripts\activate
- 在 Linux/macOS 上:
-
安装依赖项:
pip install -r requirements.txt
配置 Cursor
要将此 MCP 服务器连接到 Cursor,您需要在 Cursor 的设置中进行配置:
- 打开光标设置: 转到
光标设置>功能>MCP。 - 添加新的 MCP 服务器: 点击
+ 添加新的 MCP 服务器按钮。 - 配置服务器: 填写表单,输入以下详细信息:
- 类型:
stdio - 名称:
DevEnvInfoServer(或您喜欢的任何名称) - 命令: 输入运行服务器的命令。如果您位于
system_information_mcp目录中并已激活虚拟环境,则可以使用:
注意: 如果python claudemcp.pypython不在您的系统 PATH 中,或者您正在使用特定的 Python 可执行文件,可能需要提供 Python 解释器的完整路径,后跟claudemcp.py的路径。例如:/path/to/your/python venv/bin/python claudemcp.py
- 类型:
- 添加服务器: 点击“添加服务器”按钮。
- 刷新工具列表(可选): 您可能需要手动按下 MCP 服务器列表右上角的刷新按钮,以填充工具列表。
现在,在 Cursor 的 MCP 服务器列表中应该会出现名为 DevEnvInfoServer 的服务器,并且其工具对 Composer 中的代理可用。
在 Cursor 中的使用
配置完成后,当 Cursor 的代理认为这些工具与您的请求相关时,它将自动利用 DevEnvInfoServer 提供的工具。
- 自动工具使用: 当您在 Composer 中与 Cursor 的代理交互时,它会智能地决定是否需要有关开发环境的信息来回答您的问题或满足您的请求。如果需要,它将在后台自动使用该服务器提供的工具。
- 明确指示工具使用: 您也可以通过在提示中引用这些工具的名称或描述,明确指示代理使用这些工具。例如,您可以询问:
- "我当前环境中安装了哪些 Python 包?"
- "使用 DevEnvInfoServer 工具列出我的系统上的可用 shell。"
- 工具批准: 默认情况下,Cursor 在执行任何 MCP 工具之前会请求您的批准。您可以在批准前查看工具调用参数。
- YOLO 模式(可选): 如果您希望自动执行工具而无需批准提示,可以在 Cursor 的 MCP 设置中启用“YOLO 模式”。请谨慎使用此模式,因为它允许自动执行 MCP 工具。
Cursor 将直接在聊天中显示来自 DevEnvInfoServer 工具的响应,为您提供所需的开发环境信息。