关于 Development Environment MCP Server
Dev Environment Copilot 是面向跨平台开发流程的 MCP 服务,可检测环境并提供命令语法建议,适用于 VS Code Insiders 与 GitHub Copilot。它结合操作系统、Shell 和项目结构信息生成相应上下文。
主要功能
- 01检测操作系统、Shell 和硬件
- 02提供环境适配的命令语法
- 03格式化带变量的命令模板
- 04分析项目结构与依赖
- 05支持 NPM、PyPI 和 Docker 安装
适用场景
- 01为不同操作系统生成测试命令
- 02生成适用于当前 Shell 的部署语法
- 03根据项目文件获取上下文
- 04在 VS Code Insiders 中为 Copilot 提供环境信息
MCP 相关
它作为 MCP 服务公开环境检测、命令语法、命令格式化和项目上下文工具,可在 VS Code Insiders 中与 GitHub Copilot 集成。README 说明了 NPM、Python 和 Docker 等运行方式。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。
工具
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
Dev Environment Copilot
一款可用于生产环境的 Model Context Protocol(MCP)服务,可为跨平台开发工作流提供智能环境检测和命令语法辅助。
使命: 这款 MCP 服务会自动向 AI Agent 和工具提供丰富且能感知上下文的环境信息,确保用户在使用提示词时获得流畅体验。
✨ 功能
- 🔍 自动检测环境 - Windows、Linux 和 macOS
- 🐚 适配 Shell 的命令 - 优化 PowerShell、Bash、Zsh 语法
- 🤖 VS Code Insiders MCP 集成 - 与 GitHub Copilot 无缝集成
- 🌐 跨平台 - 适用于各种开发环境
- 📦 多种安装方式 - NPM、PyPI、Docker Hub
- 🔧 可扩展 - 易于自定义和扩展
- 🖥️ 感知架构 - 始终检测并报告系统架构
- 🚀 可用于生产环境 - 全面的测试覆盖率和自动化 CI/CD
🚀 快速开始
NPM(推荐)
# Install globally
npm install -g dev-env-copilot
# Or use without installing
npx dev-env-copilot
Python/PyPI
# Install from PyPI
pip install dev-env-copilot
# Run the server
python -m dev_environment_mcp.server
Docker(最简单)
# Run from Docker Hub (no installation needed)
docker run -i 0nilinkz/dev-env-copilot
# Or from GitHub Container Registry
docker run -i ghcr.io/yourusername/dev-env-copilot
# Test with a simple MCP request
echo '{"jsonrpc": "2.0", "method": "tools/list", "id": 1}' | docker run -i 0nilinkz/dev-env-copilot
🔧 VS Code Insiders 集成
MCP 服务设置(推荐)
将以下内容添加到 VS Code Insiders MCP 配置文件中:
Windows:%APPDATA%\Code - Insiders\User\globalStorage\rooveterinaryinc.roo-cline\settings\cline_mcp_settings.json
macOS:~/Library/Application Support/Code - Insiders/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json
Linux:~/.config/Code - Insiders/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json
{
"mcpServers": {
"dev-environment": {
"command": "npx",
"args": ["dev-env-copilot"]
}
}
}
请参阅 VSCODE_INSIDERS_MCP_SETUP.md,了解完整的设置说明。
其他集成方式
方式 1:Docker 集成
{
"mcpServers": {
"dev-env-copilot-docker": {
"command": "docker",
"args": [
"run", "--rm", "--interactive",
"0nilinkz/dev-env-copilot"
]
}
}
}
方式 2:Python 安装
{
"mcpServers": {
"dev-env-copilot-python": {
"command": "python",
"args": ["-m", "dev_environment_mcp.server"]
}
}
}
Copilot 使用示例
User: "Run the tests"
Copilot: (detects Windows PowerShell) "python -m pytest test/"
User: "Run the tests"
Copilot: (detects Linux) "python3 -m pytest test/"
User: "Set environment variable"
Copilot: (Windows) "$env:PYTHONPATH = 'c:\dev\project'"
Copilot: (Linux) "export PYTHONPATH=/home/user/project"
📊 可用于生产环境
自动化 CI/CD 流水线
- ✅ 多平台测试 - Ubuntu、Windows、macOS
- ✅ 多版本支持 - Python 3.8-3.12
- ✅ 自动发布 - NPM、PyPI、Docker Hub
- ✅ 分阶段部署 - 测试必须通过后才能部署
- ✅ 独立部署 - 每个注册表均单独部署
全面的测试覆盖率
# All installation methods verified
✅ Python/PyPI - Native execution
✅ NPM/Node.js - Cross-platform wrapper
✅ Docker - Multi-architecture builds
✅ MCP Protocol - Full protocol compliance
请参阅 DEPLOYMENT_SETUP.md,了解部署架构详情。
可用工具
MCP 服务提供以下工具:
detect_environment
检测当前操作系统、Shell 和硬件,并提供环境上下文。
参数:
format(string):输出格式 - "json"、"summary"、"copilot"
get_command_syntax
提供适用于当前环境的正确命令语法。
参数:
operation(string):操作类型 - "test"、"build"、"deploy"、"install"target(string,可选):目标环境 - "local"、"remote"、"pi"format(string):输出格式 - "shell"、"explanation"、"examples"
format_command
为当前环境格式化通用命令。
参数:
command_template(string):包含占位符的模板命令variables(object):要在模板中替换的变量
get_project_context
分析当前项目结构并提供相关上下文。
参数:
include_files(布尔值):在输出中包含文件列表analyze_dependencies(布尔值):分析 package.json/requirements.txt
配置
环境变量
DEV_ENV_MCP_CONFIG:自定义配置文件的路径DEV_ENV_MCP_LOG_LEVEL:日志级别(DEBUG、INFO、WARN、ERROR)DEV_ENV_MCP_CACHE_TTL:环境检测缓存 TTL(秒)
自定义配置
创建 dev-env-mcp.json 配置文件:
{
"detection": {
"cache_ttl": 300,
"enable_hardware_detection": true,
"custom_environments": {
"my-docker": {
"detect_command": "cat /.dockerenv",
"shell": "bash",
"python_cmd": "python3"
}
}
},
"commands": {
"custom_operations": {
"my-build": {
"windows": "msbuild /p:Configuration=Release",
"linux": "make build",
"macos": "xcodebuild -configuration Release"
}
}
}
}
💻 命令行用法
独立命令
# Environment detection
npx dev-env-copilot detect-environment --format json
# Command syntax help
npx dev-env-copilot get-command-syntax --operation test --target local
npx dev-env-copilot get-command-syntax --operation deploy --target pi --format explanation
# MCP server modes
npx dev-env-copilot --mcp-mode --transport stdio
npx dev-env-copilot --mcp-mode --transport http --host 0.0.0.0 --port 9000
高级配置
环境变量
DEV_ENV_MCP_LOG_LEVEL:设置日志级别(DEBUG、INFO、WARN、ERROR)DEV_ENV_MCP_CACHE_TTL:环境检测缓存时长(秒)DEV_ENV_MCP_CONFIG:自定义配置文件的路径
自定义配置文件
创建 ~/.config/dev-env-mcp/config.json:
{
"detection": {
"cache_ttl": 300,
"enable_hardware_detection": true,
"custom_project_roots": [
"/custom/dev/path",
"c:\\custom\\dev\\path"
]
},
"commands": {
"custom_operations": {
"my-test": {
"windows": "npm test",
"linux": "npm test",
"pi": "sudo npm test"
}
}
},
"logging": {
"level": "INFO",
"file": "~/.local/logs/dev-env-mcp.log"
}
}
🔥 集成示例
GitHub Copilot Chat
该服务通过环境感知能力增强 GitHub Copilot:
👤 User: "How do I run tests in this project?"
🤖 Copilot: Based on your Windows PowerShell environment and package.json, run:
npm test
👤 User: "Set up a Python virtual environment"
🤖 Copilot: For Windows PowerShell:
python -m venv venv
.\venv\Scripts\Activate.ps1
终端命令生成
👤 User: "Install dependencies and start dev server"
🤖 Copilot: (detects Node.js project on Windows)
npm install && npm run dev
👤 User: "Same command but for production"
🤖 Copilot: npm ci && npm run build && npm start
🛠 API 参考
MCP 工具
detect_environment
返回全面的环境信息。
响应:
{
"os": "windows",
"shell": "powershell",
"architecture": "x64",
"python_version": "3.11.0",
"node_version": "18.17.0",
"hardware": "desktop"
}
get_command_syntax
参数:
operation:「test」|「build」|「deploy」|「install」|「run」target:「local」|「remote」|「pi」|「docker」format:「shell」|「explanation」|「examples」
format_command
参数:
command_template:包含{variables}的模板variables:包含替换值的对象
🐛 故障排除
常见问题
“Command not found” 错误
# Check NPM installation
npm list -g dev-env-copilot
# Reinstall if needed
npm install -g dev-env-copilot
# Check Python installation
pip show dev-env-copilot
VS Code Insiders MCP 集成无法正常工作
- 确认 MCP 配置文件的位置和格式
- 更改配置后重启 VS Code Insiders
- 检查 VS Code 开发人员控制台中的错误(
Help > Toggle Developer Tools) - 确保使用的是 VS Code Insiders(而不是普通版 VS Code)
Docker 权限问题
# Linux/macOS - add user to docker group
sudo usermod -aG docker $USER
newgrp docker
# Windows - ensure Docker Desktop is running
MCP 协议问题
# Test MCP server directly
echo '{"jsonrpc": "2.0", "method": "tools/list", "id": 1}' | npx dev-env-copilot
# Test Python server
echo '{"jsonrpc": "2.0", "method": "tools/list", "id": 1}' | python -m dev_environment_mcp.server
调试模式
启用详细日志记录:
# Set environment variable
export DEV_ENV_MCP_LOG_LEVEL=DEBUG
# Or create config file with debug logging
echo '{"logging": {"level": "DEBUG"}}' > ~/.config/dev-env-mcp/config.json
📚 补充文档
- VS Code Insiders MCP 设置 - 完整集成指南
- 部署设置 - CI/CD 流水线和工作流架构
- Docker 设置 - 容器部署指南
- Docker VS Code 集成 - 高级容器化设置
- 集成指南 - 技术集成详情
- 分发摘要 - 部署和发布概览
🏗️ 开发与贡献
快速开发设置
git clone https://github.com/yourusername/dev-env-copilot.git
cd dev-env-copilot
# Install dependencies
npm install
pip install -e .
# Run tests
python tests/test_mcp_proper.py
node bin/dev-env-copilot.js < echo '{"jsonrpc":"2.0","method":"initialize","id":1,"params":{}}'
工作流结构
我们的 CI/CD 使用 GitHub Actions,并采用现代化的阶段式架构:
Test Stage (test-and-build.yml)
├── Multi-platform testing (Ubuntu, Windows, macOS)
├── Multi-version testing (Python 3.8-3.12)
└── MCP protocol compliance verification
Deploy Stage (on release)
├── deploy-pypi.yml → PyPI publishing
├── deploy-npm.yml → npm registry
└── docker-deploy.yml → Docker Hub + GHCR
主要特性:
- 🔒 可靠:测试未通过时不会部署
- 🔧 模块化:每种部署类型相互独立
- ⚡ 高效:工作流可复用,不重复
- 🎯 灵活:可独立部署到指定的注册表
贡献
欢迎贡献!本项目结构清晰,具备:
- ✅ 全面的测试覆盖
- ✅ 自动化质量检查
- ✅ 清晰的文档
- ✅ 现代化的开发工作流
请提交 issue 或 pull request,开始参与贡献。
📄 许可证
本项目采用 MIT 许可证,详情请参阅 LICENSE 文件。
🙏 致谢
- Anthropic 推出的 Model Context Protocol(MCP)
- GitHub Copilot 团队提供的 MCP 集成
- 跨平台开发社区
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。