MCP ProcFS Server
A powerful MCP server for reading and modifying Linux /proc filesystem values, providing system monitoring, process management, and sysctl operations via JSON-RPC and SSE.
README
MCP ProcFS Server
A powerful Model Context Protocol (MCP) server for reading and modifying Linux /proc filesystem values. Provides both JSON-RPC (stdio) and Server-Sent Events (SSE) interfaces with full Swagger API documentation.
Features
- 🔍 Comprehensive ProcFS Access: Read and write to
/procfilesystem - 🎛️ System Monitoring: CPU, memory, load, network, and disk statistics
- ⚙️ Sysctl Management: Read and modify kernel parameters
- 🔧 Process Control: Monitor and manage processes (priority, affinity, signals)
- 📡 Dual Protocols: JSON-RPC over stdio and HTTP with SSE
- 📚 Full API Documentation: Interactive Swagger UI
- 🔐 Type-Safe: Written in TypeScript with comprehensive type definitions
- ✅ Validated: Zod schemas for request/response validation
Installation
From npm
npm install -g @mcp/procfs-server
From source
git clone https://github.com/user/mcp-proc.git
cd mcp-proc
npm install
npm run build
Quick Start
JSON-RPC Server (stdio)
# Start the MCP server on stdio
mcp-procfs
# Or with npm
npm start
HTTP Server with SSE
# Start HTTP server on port 3000
npm run start:sse
# Custom port
PORT=8080 npm run start:sse
Then open your browser to:
- API Documentation: http://localhost:3000/api-docs
- SSE Endpoint: http://localhost:3000/mcp/sse
- RPC Endpoint: http://localhost:3000/mcp/rpc
Usage
As MCP Tool
Configure in your MCP client (e.g., Claude Desktop):
{
"mcpServers": {
"procfs": {
"command": "mcp-procfs"
}
}
}
Available Tools
System Information
- get_cpu_info: Get detailed CPU information
- get_memory_info: Get memory statistics
- get_load_average: Get system load average
- get_network_stats: Get network interface statistics
- get_disk_stats: Get disk I/O statistics
ProcFS Operations
- read_procfs: Read any file from
/proc - write_procfs: Write to writable
/procfiles
Process Management
- get_process_info: Get detailed process information
- list_processes: List all process IDs
- set_process_priority: Change process nice value
- set_process_affinity: Set CPU affinity
Sysctl Management
- read_sysctl: Read kernel parameter
- write_sysctl: Modify kernel parameter
- list_sysctl: List all parameters
Example: Using HTTP API
# Get CPU information
curl http://localhost:3000/api/cpu
# Get memory information
curl http://localhost:3000/api/memory
# Read a sysctl parameter
curl http://localhost:3000/api/sysctl/net.ipv4.ip_forward
# Write a sysctl parameter (requires permissions)
curl -X POST http://localhost:3000/api/sysctl \
-H "Content-Type: application/json" \
-d '{"key": "net.ipv4.ip_forward", "value": 1}'
# Get process information
curl http://localhost:3000/api/processes/1
# Read custom procfs file
curl "http://localhost:3000/api/procfs?path=sys/kernel/hostname"
Example: Using JSON-RPC
import { MCPProcFSServer } from '@mcp/procfs-server';
const server = new MCPProcFSServer();
await server.run();
Example: Direct Library Usage
import { ProcFSReader, ProcFSWriter } from '@mcp/procfs-server';
const reader = new ProcFSReader();
const writer = new ProcFSWriter();
// Get CPU info
const cpuInfo = await reader.getCPUInfo();
console.log(cpuInfo);
// Get memory info
const memInfo = await reader.getMemInfo();
console.log(memInfo);
// Read sysctl
const param = await writer.readSysctl('net.ipv4.ip_forward');
console.log(param);
// Write sysctl (requires root)
await writer.writeSysctl('net.ipv4.ip_forward', 1);
API Documentation
When running the HTTP server, full interactive API documentation is available at:
http://localhost:3000/api-docs
The documentation includes:
- All endpoints with request/response schemas
- Try-it-out functionality
- Example requests and responses
- Authentication requirements
API Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /health |
Health check |
| GET | /api/cpu |
CPU information |
| GET | /api/memory |
Memory information |
| GET | /api/load |
Load average |
| GET | /api/network |
Network statistics |
| GET | /api/disk |
Disk statistics |
| GET | /api/procfs |
Read procfs file |
| POST | /api/procfs |
Write procfs file |
| GET | /api/sysctl |
List sysctl parameters |
| GET | /api/sysctl/:key |
Read sysctl parameter |
| POST | /api/sysctl |
Write sysctl parameter |
| GET | /api/processes |
List all processes |
| GET | /api/processes/:pid |
Get process info |
| POST | /api/processes/:pid/priority |
Set process priority |
| GET | /mcp/sse |
SSE endpoint |
| POST | /mcp/rpc |
JSON-RPC endpoint |
MCP Resources
The server exposes the following MCP resources:
procfs://cpuinfo- CPU informationprocfs://meminfo- Memory informationprocfs://loadavg- Load averageprocfs://net/dev- Network statisticsprocfs://diskstats- Disk statistics
Permissions
Some operations require elevated permissions:
- Read-only operations: Most read operations work without special permissions
- Write operations: Require appropriate permissions (usually root)
- Process management: Some operations require CAP_SYS_NICE or root
- Sysctl writes: Usually require root or specific capabilities
Running with elevated permissions
# Run with sudo (not recommended for production)
sudo mcp-procfs
# Better: Use capabilities
sudo setcap cap_sys_nice,cap_sys_admin+ep $(which node)
mcp-procfs
Development
Setup
npm install
npm run build
Development Mode
npm run dev # Watch mode with hot reload
Testing
npm test # Run tests
npm run test:watch # Watch mode
npm run test:coverage # Coverage report
Linting
npm run lint # Check code
npm run format # Format code
Architecture
mcp-proc/
├── src/
│ ├── lib/
│ │ ├── procfs-reader.ts # ProcFS reading logic
│ │ └── procfs-writer.ts # ProcFS writing logic
│ ├── types/
│ │ ├── procfs.ts # ProcFS type definitions
│ │ ├── mcp.ts # MCP protocol types
│ │ └── schemas.ts # Zod validation schemas
│ ├── server.ts # MCP JSON-RPC server
│ ├── server-sse.ts # HTTP/SSE server
│ ├── cli.ts # JSON-RPC CLI entry
│ ├── cli-sse.ts # HTTP/SSE CLI entry
│ └── index.ts # Main exports
├── scripts/
│ ├── setup.sh # Setup script
│ ├── build.sh # Build script
│ └── release.sh # Release script
└── tests/ # Test files
Technology Stack
- Runtime: Node.js 18+
- Language: TypeScript
- Validation: Zod
- Web Framework: Express
- Documentation: Swagger/OpenAPI
- MCP SDK: @modelcontextprotocol/sdk
- Testing: Jest
Security Considerations
⚠️ Important Security Notes:
- This server provides direct access to system resources
- Write operations can affect system behavior
- Always run with minimum required permissions
- Consider using read-only mode for untrusted clients
- Implement authentication for production deployments
- Monitor and log all write operations
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Submit a pull request
License
MIT License - see LICENSE file for details
Resources
Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Changelog
See CHANGELOG.md for version history.
Made with ❤️ for the MCP community
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。