Production MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Production MCP Serverread the contents of config.json"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Production MCP Server
π»π³ HΖ°α»ng dαΊ«n tiαΊΏng Viα»t: HUONG_DAN.md Β· ThΓͺm tool mα»i: THEM_TOOL.md Β· ChαΊ‘y nhiα»u client (HTTP/SSE): CHAY_NHIEU_CLIENT.md
A production-ready, modular Model Context Protocol (MCP) server built with
FastMCP. It ships 40+ tools across 8 categories and is designed to scale
to 300+ tools without modifying any existing code β you just drop a new file
into tools/<category>/ and it registers itself on startup.
Highlights
Clean architecture & SOLID β tools stay thin; logic lives in
services/; cross-cutting concerns live incore/.Dynamic auto-loading β the loader scans
tools/**and calls each module'sregister(mcp). No manual imports, ever.Standard tool template β every tool has a description, input validation, error handling, logging, type hints and a docstring.
Uniform responses β every tool returns
{ success, data, error }.Security by default β filesystem sandbox, SSRF guard on HTTP, secret redaction, write-guarded SQL.
Async everywhere β
httpx,aiofiles, and threads for blocking libs (sqlite3,openpyxl).Typed config via
.env(pydantic-settings) and structured logging.Local AI β AI tools call your local model over an OpenAI-compatible API (vLLM), with an offline heuristic fallback so they work with zero config.
Related MCP server: MCP Custom Tools Server
Project structure
mcp-server/
βββ main.py # Entrypoint: configures logging, runs the transport
βββ server.py # Builds the FastMCP instance + runs the loader
βββ config.py # Typed settings from .env (pydantic-settings)
βββ requirements.txt
βββ pytest.ini
βββ .env.example
β
βββ core/ # Reusable infrastructure
β βββ logger.py # Logging (stderr-safe for stdio), JSON option
β βββ exceptions.py # Domain exception hierarchy
β βββ decorators.py # @tool_handler: logging + timing + error mapping
β βββ response.py # make_response() / make_error() envelopes
β βββ utils.py # validate_path/validate_url/safe_read/safe_write
β βββ loader.py # Dynamic tool discovery & registration
β
βββ services/ # Stateful / IO logic (reused by tools)
β βββ http_service.py # Shared httpx client + SSRF policy
β βββ database_service.py# Pluggable DB drivers (SQLite now; PG/MySQL later)
β βββ ai_service.py # OpenAI-compatible (vLLM) chat client
β βββ text_heuristics.py # Offline fallback for AI tools
β
βββ models/ # Pydantic models (typed tool outputs)
β βββ common.py
β
βββ tools/ # One folder per category, one file per tool
β βββ system/ # get_system_info, get_os, get_hostname, get_cpu,
β β # get_memory, get_disk, get_env, current_time
β βββ filesystem/ # read/write/append/delete/move/copy/rename files,
β β # create/delete/list directory, search, file_info
β βββ api/ # http_get, http_post, http_put, http_delete
β βββ network/ # dns_lookup (extend freely)
β βββ database/ # execute_query, list_tables, describe_table
β βββ utilities/ # base64, uuid, md5, sha256, json_format, yaml<->json
β βββ ai/ # count_tokens, summarize_text, extract_keywords
β βββ office/ # csv_reader/writer, excel_reader/writer
β
βββ tests/ # pytest suite (loader, core, ~2 tools/category)
βββ examples/ # Example client + Claude/VSCode/Cursor/Windsurf configsQuick start
# 1. Create and activate a virtual environment (Python 3.12+; 3.11 also works)
python -m venv .venv
.\.venv\Scripts\activate # Windows PowerShell
# source .venv/bin/activate # macOS / Linux
# 2. Install dependencies
pip install -r requirements.txt
# 3. Configure
copy .env.example .env # Windows (cp on macOS/Linux)
# edit .env β at minimum set MCP_ALLOWED_ROOT to your working folder
# 4. Run the server (stdio transport by default)
python main.py
# 5. (optional) Run the tests
pytestTo run over HTTP instead of stdio, set MCP_TRANSPORT=http (and MCP_HOST /
MCP_PORT) in .env, then python main.py.
Trying it out with the example client
The in-memory client needs no running server β it imports the server object directly:
python examples/mcp_client.py # in-memory (fastest)
python examples/mcp_client.py --stdio # spawns `python main.py` over stdioConnecting from an IDE / desktop client
Ready-to-edit configs live in examples/. Replace the absolute paths with your
own (point command at your venv's Python and args at main.py).
Client | File to edit | Example |
Claude Desktop |
|
|
VSCode |
|
|
Cursor |
|
|
Windsurf |
|
|
After editing, restart the client. The server's tools appear in the client's tool list.
Configuration reference (.env)
All variables are prefixed MCP_. See .env.example for the full list. Key ones:
Variable | Default | Purpose |
|
|
|
|
| Logging verbosity |
| current working dir | Filesystem sandbox root β tools cannot escape it |
|
| Keep |
|
| DB connection (SQLite today) |
|
| Allow write/DDL SQL statements |
| (unset) | vLLM OpenAI-compatible URL, e.g. |
| (unset) | Model name served by vLLM |
Tool categories (40+ tools)
Every tool returns the same envelope:
{ "success": true, "data": { ... }, "error": null }...and on failure:
{ "success": false, "data": null, "error": { "code": "validation_error", "message": "...", "details": {} } }System β
get_system_info,get_os,get_hostname,get_cpu,get_memory,get_disk,get_env,current_timeFile System (sandboxed) β
read_file,write_file,append_file,delete_file,move_file,copy_file,rename_file,create_directory,delete_directory,list_directory,search_files,file_infoAPI (SSRF-guarded, httpx) β
http_get,http_post,http_put,http_deleteNetwork β
dns_lookupDatabase (SQLite; PG/MySQL-ready) β
execute_query,list_tables,describe_tableUtilities β
base64_encode,base64_decode,uuid,md5,sha256,json_format,yaml_to_json,json_to_yamlAI (local vLLM or heuristic fallback) β
count_tokens,summarize_text,extract_keywordsOffice β
csv_reader,csv_writer,excel_reader,excel_writer
Using the local AI (vLLM) tools
The AI tools call a local model through an OpenAI-compatible API. Start vLLM:
python -m vllm.entrypoints.openai.api_server \
--model Qwen/Qwen2.5-7B-Instruct \
--port 8001Then set in .env:
MCP_OPENAI_BASE_URL=http://localhost:8001/v1
MCP_OPENAI_API_KEY=EMPTY
MCP_OPENAI_MODEL=Qwen/Qwen2.5-7B-InstructWith these set,
summarize_textandextract_keywordsuse the LLM ("backend": "llm").Without them, they fall back to a fast local heuristic (
"backend": "heuristic") β so the tools work out of the box with no model running.count_tokensalways runs locally viatiktoken.
How the dynamic loader works
On startup, core/loader.py walks the tools package
recursively, imports every non-private module, and calls its register(mcp)
function. A broken tool is logged and skipped β it never takes down the server.
That single convention is what makes the project scale to 300+ tools with zero
edits to existing files.
Add a new tool in under a minute
See ADD_A_TOOL.md for the copy-paste template. In short:
Create
tools/<category>/my_tool.py.Paste the template, rename the function, write your logic.
Restart the server β done. It auto-registers.
# tools/utilities/reverse_text.py
from __future__ import annotations
from typing import TYPE_CHECKING
from core.decorators import tool_handler
if TYPE_CHECKING:
from fastmcp import FastMCP
def register(mcp: "FastMCP") -> None:
@mcp.tool()
@tool_handler
async def reverse_text(text: str) -> dict:
"""Reverse a string."""
return {"reversed": text[::-1]}No imports to update, no registry to edit. That's the whole workflow.
Extending the database to PostgreSQL / MySQL
The database layer is built for this. In
services/database_service.py:
Implement a class satisfying the
DatabaseDriverprotocol (execute,list_tables,describe_table).Register it in the
_DRIVERSdict by URL scheme.Point
MCP_DATABASE_URLat the new backend.
The three database tools do not change β they depend on the abstract driver.
Docker
The image defaults to the HTTP transport (stdio can't work in a container)
and exposes port 8000.
# Compose (recommended) β build, run, persist data in a volume
docker compose up --build
# Or plain Docker
docker build -t production-mcp-server:latest .
docker run -d --name mcp-server -p 8000:8000 -v mcp-data:/data \
production-mcp-server:latestThe server is then reachable at http://localhost:8000/mcp. It runs as a
non-root user, and SQLite + the filesystem-tool workspace live under /data
(mounted as a volume). To wire in a local vLLM model, uncomment the vllm
service in docker-compose.yml and set the MCP_OPENAI_* vars.
Testing
pytest # runs the full suite
pytest -v # verboseThe suite covers the dynamic loader, core helpers (response envelope, path/URL
validation, the @tool_handler decorator), and 1β2 representative tools per
category exercised end-to-end.
Security notes
Filesystem tools resolve every path and reject anything outside
MCP_ALLOWED_ROOT(blocks../traversal).HTTP tools reject non-http(s) schemes and, by default, any host resolving to a private/loopback/link-local address (SSRF guard). Toggle with
MCP_HTTP_ALLOW_PRIVATE_HOSTS.get_envredacts values whose names look secret (*key*,*token*,*password*, β¦).SQL write/DDL statements are blocked unless
MCP_DB_ALLOW_WRITE=true; use parameterised queries (?).Logs go to stderr so they never corrupt the stdio JSON-RPC stream.
License
MIT (or your organisation's preferred license).
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityBmaintenanceA unified MCP server with composable tools for GitHub operations, file management, shell execution, kanban boards, Discord messaging, and package management. Features role-based security, HTTP/stdio transports, and a web-based development UI.Last updated
- AlicenseBqualityDmaintenanceA comprehensive MCP server with 30+ custom tools organized into categories: date/time operations, file management, system information, text processing, and web operations. Enables async communication with robust error handling and flexible CLI integration.Last updated311MIT
- FlicenseBqualityCmaintenanceAn MCP server framework featuring dynamic tool loading and a modular one-tool-per-file architecture for rapid development. It supports both Stdio and HTTP transport modes, offering automated test generation and centralized configuration management.Last updated11
- Alicense-qualityCmaintenanceA production-oriented MCP server for coding agents that enables multi-project management through secure file operations, Git integration, and safe command execution. It supports project discovery across multiple root directories and provides robust audit logging with both STDIO and HTTP transport options.Last updated272MIT
Related MCP Connectors
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
Production-grade cryptography toolkit with 31 MCP tools for classical, PQC, and KMS workflows.
A MCP server built for developers enabling Git based project management with project and personalβ¦
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/nhannt95/mcp-server-new'
If you have feedback or need assistance with the MCP directory API, please join our Discord server