mcp-tool-server
A secure, production-grade MCP server that provides filesystem operations, AST math evaluation, and system diagnostics for LLM agents.
README
๐ MCP Tool Server
A secure, production-grade Model Context Protocol (MCP) server that empowers LLM agents with filesystem operations, AST mathematical evaluation, and host system diagnostics.
Built using Python FastMCP SDK and containerized with Docker.
๐๏ธ Architecture
The Model Context Protocol (MCP) establishes a secure JSON-RPC interface over standard I/O (stdio) between a host client (like Claude Desktop or Cursor) and our server:
graph LR
subgraph Host_App ["Host Application (Client)"]
A[LLM Agent] <--> B[MCP Client Interface]
end
subgraph Server_App ["MCP Tool Server (Server)"]
B <-->|Stdio / JSON-RPC| C[FastMCP Entrypoint]
C <--> D[File System Tools]
C <--> E[AST Math Tools]
C <--> F[System Diagnostic Tools]
end
D <-->|Access Guards| G[(Workspace Files)]
F <-->|psutil| H[Host OS Metrics]
โจ Features
- ๐ Secure Filesystem Access โ Paginated reading, directory listing, and recursive regex search with built-in path-traversal protections.
- ๐งฎ Safe AST Calculation โ Evaluates mathematical expressions securely using python's
astparser (no raweval()calls) and blocks resource exhaustion attempts. - ๐ฅ๏ธ Diagnostics Metrics โ Fetches CPU, RAM, and Disk space stats.
- ๐ณ Containerized โ Docker & Docker Compose setup for fast testing and isolation.
- โ CI Validation โ Automated GitHub Actions verifying code linting and unit test coverage.
๐ ๏ธ Exposed Tools
The server registers and exposes the following tools to clients:
| Tool Name | Parameters | Description |
|---|---|---|
calculate_expression |
expression: str |
Safely evaluates arithmetic and core math functions (sin, cos, pi, e, etc.). |
list_directory |
path: str = "." |
Lists files and subdirectories. Locked to workspace boundaries. |
read_file_content |
path: str, start_line: int, end_line: int |
Reads a target file securely with line-bound pagination. |
search_text_pattern |
pattern: str, path: str = "." |
Performs recursive grep-like text search in workspace files. |
check_system_resources |
None | Returns instant system metrics (CPU load, RAM usage, storage space). |
๐ Quick Start
Option A: Running with Docker (Recommended)
Run the server instantly in an isolated environment:
# Build and run the stdio server
docker-compose up --build
# Run the test suite inside the container
docker-compose run tests
Option B: Running with Local Python
If you prefer to run it locally without Docker:
# Install dependencies
pip install -r requirements.txt
# Run the server on stdio
python mcp_server.py
๐ Host Client Integration
1. Claude Desktop
To integrate this server with Claude Desktop, add the configuration below to your claude_desktop_config.json (on Windows, located at %APPDATA%\Claude\claude_desktop_config.json):
{
"mcpServers": {
"mcp-tool-server": {
"command": "python",
"args": ["C:/Github Code/mcp-tool-server/mcp_server.py"],
"env": {
"MCP_WORKSPACE_DIR": "C:/Github Code"
}
}
}
}
2. Cursor IDE
- Open Cursor Settings โ Features โ MCP.
- Click + Add New MCP Server.
- Fill details:
- Name:
mcp-tool-server - Type:
stdio - Command:
python "C:/Github Code/mcp-tool-server/mcp_server.py"
- Name:
- Save and let Cursor auto-detect the registered tools!
๐งช Running Tests Locally
To install testing dependencies and run the pytest suite:
pip install -r requirements-dev.txt
pytest tests/ -v
๐ License
MIT License. See LICENSE for details.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.