
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
A Model Context Protocol (MCP) server that provides process management and monitoring capabilities for AI agents, with strict security boundaries enforced by executable allowlists and resource limits.
This package is now maintained in its own repository: https://github.com/Digital-Defiance/mcp-process
This repository is part of the https://github.com/Digital-Defiance/ai-capabilities-suite on GitHub.
This server implements defense-in-depth security with 6 layers of validation:
See SECURITY.md for detailed security implementation.
bashdocker pull digitaldefiance/mcp-process:latest
See DOCKER.md for detailed Docker usage instructions.
bashnpm install @ai-capabilities-suite/mcp-process
bashyarn add @ai-capabilities-suite/mcp-process
bashnpm install -g @ai-capabilities-suite/mcp-process
bash# Pull the image docker pull digitaldefiance/mcp-process:latest # Create config directory mkdir -p config # Create configuration cat > config/mcp-process-config.json << EOF { "allowedExecutables": ["node", "python3", "npm"], "maxConcurrentProcesses": 5, "enableAuditLog": true } EOF # Run with docker-compose docker-compose up -d
See DOCKER.md for detailed Docker instructions.
1. Create Configuration File
bashmcp-process --create-config ./mcp-process-config.json
This creates a sample configuration file with secure defaults.
Edit mcp-process-config.json to add your allowed executables:
json{ "allowedExecutables": ["node", "python3", "npm", "git"], "defaultResourceLimits": { "maxCpuPercent": 80, "maxMemoryMB": 1024, "maxCpuTime": 300 }, "maxConcurrentProcesses": 10, "maxProcessLifetime": 3600, "enableAuditLog": true, "blockShellInterpreters": true, "blockSetuidExecutables": true, "allowProcessTermination": true, "allowGroupTermination": true, "allowForcedTermination": false, "allowStdinInput": true, "allowOutputCapture": true, "requireConfirmation": false }
bashmcp-process --config ./mcp-process-config.json
Or use environment variables:
bashexport MCP_PROCESS_CONFIG_PATH=./mcp-process-config.json mcp-process
Configure your AI agent (e.g., Kiro, Claude Desktop) to connect to the MCP server via stdio transport.
The server looks for configuration in the following order:
--config command line argumentMCP_PROCESS_CONFIG_PATH environment variableMCP_PROCESS_CONFIG environment variable (JSON string)./mcp-process-config.json./config/mcp-process.jsonSee SECURITY.md for detailed configuration options and security settings.
json{ "allowedExecutables": ["node", "python3"], "defaultResourceLimits": { "maxCpuPercent": 80, "maxMemoryMB": 1024 }, "maxConcurrentProcesses": 10, "maxProcessLifetime": 3600, "enableAuditLog": true, "blockShellInterpreters": true, "blockSetuidExecutables": true, "allowProcessTermination": true, "allowGroupTermination": true, "allowForcedTermination": false, "allowStdinInput": true, "allowOutputCapture": true, "requireConfirmation": false }
The server exposes 12 MCP tools for process management:
Launch a new process.
Parameters:
executable (string, required): Path to executableargs (string[], optional): Command-line argumentscwd (string, optional): Working directoryenv (object, optional): Environment variablestimeout (number, optional): Timeout in millisecondscaptureOutput (boolean, optional): Whether to capture stdout/stderrresourceLimits (object, optional): Resource limitsReturns:
pid (number): Process IDstartTime (string): ISO timestamp of process startTerminate a process.
Parameters:
pid (number, required): Process IDforce (boolean, optional): Use SIGKILL instead of SIGTERMtimeout (number, optional): Timeout for graceful termination (ms)Returns:
exitCode (number): Process exit codeterminationReason (string): "graceful" or "forced"Get process resource usage statistics.
Parameters:
pid (number, required): Process IDincludeHistory (boolean, optional): Include historical dataReturns:
cpuPercent (number): CPU usage percentagememoryMB (number): Memory usage in MBthreadCount (number): Number of threadsioRead (number): Bytes readioWrite (number): Bytes writtenuptime (number): Process uptime in secondshistory (array, optional): Historical statisticsSend input to process stdin.
Parameters:
pid (number, required): Process IDdata (string, required): Data to sendencoding (string, optional): Text encoding (default: "utf-8")Returns:
bytesWritten (number): Number of bytes writtenGet captured process output.
Parameters:
pid (number, required): Process IDstream (string, optional): "stdout", "stderr", or "both" (default: "both")encoding (string, optional): Text encoding (default: "utf-8")Returns:
stdout (string): Captured stdoutstderr (string): Captured stderrstdoutBytes (number): Stdout buffer sizestderrBytes (number): Stderr buffer sizeList all managed processes.
Returns:
Get detailed process status.
Parameters:
pid (number, required): Process IDReturns:
state (string): "running", "stopped", or "crashed"uptime (number): Process uptime in secondsstats (object): Current resource usage statisticsCreate a process group.
Parameters:
name (string, required): Group namepipeline (boolean, optional): Whether to create a pipelineReturns:
groupId (string): Group identifierAdd a process to a group.
Parameters:
groupId (string, required): Group identifierpid (number, required): Process IDTerminate all processes in a group.
Parameters:
groupId (string, required): Group identifierStart a long-running service with auto-restart.
Parameters:
name (string, required): Service nameexecutable (string, required): Path to executableargs (string[], optional): Command-line argumentscwd (string, optional): Working directoryenv (object, optional): Environment variablesrestartPolicy (object, optional): Restart configurationhealthCheck (object, optional): Health check configurationReturns:
serviceId (string): Service identifierpid (number): Initial process IDStop a service and disable auto-restart.
Parameters:
serviceId (string, required): Service identifiertypescript// Launch a process const result = await mcpClient.callTool("process_start", { executable: "node", args: ["--version"], captureOutput: true, }); console.log("Process started:", result.pid); // Wait a moment for it to complete await new Promise((resolve) => setTimeout(resolve, 1000)); // Get output const output = await mcpClient.callTool("process_get_output", { pid: result.pid, }); console.log("Output:", output.stdout);
typescript// Start a process const result = await mcpClient.callTool("process_start", { executable: "python3", args: ["my_script.py"], resourceLimits: { maxCpuPercent: 50, maxMemoryMB: 512, }, }); // Monitor resources const stats = await mcpClient.callTool("process_get_stats", { pid: result.pid, includeHistory: true, }); console.log("CPU:", stats.cpuPercent + "%"); console.log("Memory:", stats.memoryMB + "MB");
typescript// Start an interactive process const result = await mcpClient.callTool("process_start", { executable: "python3", args: ["-i"], captureOutput: true, }); // Send input await mcpClient.callTool("process_send_stdin", { pid: result.pid, data: 'print("Hello from AI agent")\n', }); // Wait and get output await new Promise((resolve) => setTimeout(resolve, 500)); const output = await mcpClient.callTool("process_get_output", { pid: result.pid, }); console.log("Output:", output.stdout);
typescript// Start a service with auto-restart const service = await mcpClient.callTool("process_start_service", { name: "my-api-server", executable: "node", args: ["server.js"], restartPolicy: { enabled: true, maxRetries: 3, backoffMs: 5000, }, healthCheck: { command: "curl http://localhost:3000/health", interval: 30000, timeout: 5000, }, }); console.log("Service started:", service.serviceId);
typescript// Create a process group const group = await mcpClient.callTool("process_create_group", { name: "data-pipeline", pipeline: true, }); // Start first process const proc1 = await mcpClient.callTool("process_start", { executable: "cat", args: ["data.txt"], captureOutput: true, }); // Add to group await mcpClient.callTool("process_add_to_group", { groupId: group.groupId, pid: proc1.pid, }); // Start second process (will receive output from first) const proc2 = await mcpClient.callTool("process_start", { executable: "grep", args: ["pattern"], captureOutput: true, }); await mcpClient.callTool("process_add_to_group", { groupId: group.groupId, pid: proc2.pid, });
Cause: The executable you're trying to launch is not in the allowedExecutables configuration.
Solution: Add the executable to your configuration file:
json{ "allowedExecutables": ["node", "python3", "/path/to/your/executable"] }
You can use:
/usr/bin/nodenode/usr/bin/*Cause: You're trying to launch a shell (bash, sh, cmd.exe, etc.) and blockShellInterpreters is enabled.
Solution: Either:
blockShellInterpreters: false in your configuration (not recommended)Cause: The process has already terminated or the PID is invalid.
Solution: Check if the process is still running using process_list or process_get_status.
Cause: The process exceeded configured resource limits.
Solution: Increase resource limits in your configuration or when launching the process:
json{ "defaultResourceLimits": { "maxCpuPercent": 90, "maxMemoryMB": 2048 } }
Cause: You've reached the maxConcurrentProcesses limit.
Solution:
maxConcurrentProcesses in your configurationCause: The process stdin is closed or the process doesn't support stdin input.
Solution: Ensure the process is still running and was started with stdin enabled.
Cause: The server can't find your configuration file.
Solution:
--config flag: mcp-process --config /path/to/config.jsonexport MCP_PROCESS_CONFIG_PATH=/path/to/config.json./mcp-process-config.jsonEnable debug logging by setting the audit log level:
json{ "enableAuditLog": true, "auditLogLevel": "debug" }
Check the audit log for detailed information about process operations and security violations.
bash# Clone the repository git clone https://github.com/digital-defiance/ai-capabilities-suite.git cd ai-capabilities-suite/packages/mcp-process # Install dependencies npm install # Build npm run build
bash# Run all tests (unit, integration, and e2e) npm test # Run tests with coverage npm run test:coverage # Run tests in watch mode npm run test:watch # Run specific test file npm test -- SecurityManager.spec.ts # Run only e2e tests npm run test:e2e # Run minimal e2e smoke tests (quick validation) npm run test:e2e:minimal
End-to-End (E2E) Testing
The MCP ACS Process Server includes comprehensive e2e tests that validate the complete system behavior by spawning the server as a child process and communicating via stdio using JSON-RPC protocol. These tests ensure the server works correctly in real-world usage scenarios.
E2E Test Structure:
server.e2e.spec.ts - Comprehensive e2e tests covering all MCP tools and protocol featuresserver.minimal.e2e.spec.ts - Quick smoke tests for basic functionality validation (< 30 seconds)Running E2E Tests:
bash# Run comprehensive e2e tests npm run test:e2e # Run minimal smoke tests for quick feedback npm run test:e2e:minimal # Run e2e tests with specific pattern npm test -- --testPathPattern=e2e.spec.ts # Run e2e tests with verbose output npm test -- --testPathPattern=e2e.spec.ts --verbose
What E2E Tests Validate:
E2E Test Requirements:
npm run builddist/cli.jsDebugging E2E Test Failures:
If e2e tests fail, follow these steps:
Ensure the server is built:
bashnpm run build
Check if the CLI exists:
bashls -la dist/cli.js
Run tests with verbose output:
bashnpm test -- --testPathPattern=e2e.spec.ts --verbose
Check for server startup errors:
Verify server can start manually:
bashnode dist/cli.js --help
Run minimal tests first:
bashnpm run test:e2e:minimal
If minimal tests pass but comprehensive tests fail, the issue is likely with specific functionality rather than basic server operation.
Check process cleanup:
bash# List any orphaned node processes ps aux | grep node
Enable debug logging:
Set DEBUG=* environment variable to see detailed logs:
bashDEBUG=* npm test -- --testPathPattern=e2e.spec.ts
Common E2E Test Issues:
| Issue | Cause | Solution |
|---|---|---|
| "Server executable not found" | Server not built or wrong path | Run npm run build |
| "Server failed to start" | Server crash on startup | Check stderr output in test logs |
| "Request timeout" | Server not responding | Increase timeout or check server logs |
| "Process not cleaned up" | Test cleanup failure | Run npm test -- --forceExit |
| "Port already in use" | Previous test didn't clean up | Kill orphaned processes |
| "Permission denied" | Insufficient permissions | Check file permissions on dist/cli.js |
**CI Environment *ations:
E2E tests are designed to run in CI environments with the following ***ations:
CI Configuration Example:
yaml# .github/workflows/test.yml - name: Build run: npm run build - name: Run minimal e2e tests run: npm run test:e2e:minimal - name: Run full test suite run: npm test env: CI: true
Property-Based Testing:
E2E tests include property-based tests using fast-check to validate universal properties:
These tests run multiple iterations with randomly generated inputs to ensure correctness across a wide range of scenarios.
bashnpm run lint
bash# Clean build directory npm run clean # Build TypeScript npm run build
bash# Publish to npm (requires authentication) npm run publish:public
The MCP ACS Process Server consists of several core components:
Contributions are welcome! Please see the main repository for contribution guidelines: https://github.com/digital-defiance/ai-capabilities-suite
MIT License - see LICENSE file for details.
Built with:
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务