mcp-tool-hub
A modular, extensible MCP multi-server hub that gives LLMs sandboxed file access, Git operations, web fetching, and persistent memory, deployable via Ansible.
README
MCP Tool Hub
A modular, extensible Model Context Protocol multi-server hub — built in TypeScript for IT automation teams.
Give your LLM access to real-world tools: files, Git, web content, and persistent memory. Deploy to any number of client machines simultaneously via Ansible.
Architecture
mcp-tool-hub/
├── packages/
│ ├── core/ ← Shared types + BaseMCPServer abstract class
│ ├── server-filesystem/ ← Sandboxed local file access (read/write/list/delete)
│ ├── server-git/ ← Git log, diff, file contents, branches, status
│ ├── server-fetch/ ← Web fetching: HTML, JSON APIs, URL health checks
│ └── server-memory/ ← Persistent JSON knowledge base (survives restarts)
├── host/ ← Orchestrator: registry + CLI + stdio JSON interface
├── ansible/ ← Playbook, inventory, systemd service templates
└── docs/ ← How to add new servers (with template)
The architecture follows the Model Context Protocol pattern:
- Each server is completely independent — its own package, its own build
- The registry in the host maps
toolName → serverat runtime - The CLI exposes a stdio JSON interface — any LLM integration sends
{"toolName":"...", "arguments":{...}}on stdin, reads the result from stdout - Adding a new server = create a package, extend
BaseMCPServer, register incli.ts
Quick Start
1. Install & Build
git clone https://github.com/your-org/mcp-tool-hub.git
cd mcp-tool-hub
npm install
npm run build
2. Configure
cp .env.example .env
# Edit .env with your paths and settings
3. Run
# Via npm
npm run start --workspace=host
# Or directly
node host/dist/cli.js
4. Call a tool
Send JSON to stdin, get JSON from stdout:
echo '{"toolName":"read_file","arguments":{"path":"hello.txt"}}' | node host/dist/cli.js
Available Tools
📁 Filesystem Server
All operations sandboxed to MCP_FS_ROOT. Path traversal (../) is blocked.
| Tool | Description |
|---|---|
read_file |
Read file contents (utf8 or base64) |
write_file |
Write or append to a file |
list_directory |
List directory contents (optionally recursive) |
delete_file |
Delete a file |
move_file |
Move or rename a file |
get_file_info |
Get size, dates, and type of a path |
🔀 Git Server
Read-only. No write operations.
| Tool | Description |
|---|---|
git_log |
Commit history for a repo or file |
git_show_file |
File contents at a specific commit/branch |
git_diff |
Diff between two refs |
git_status |
Working tree status |
git_branches |
List branches (local + optional remote) |
git_show_commit |
Full commit details and diff |
🌐 Fetch Server
Supports optional domain allowlist via MCP_FETCH_ALLOWED_DOMAINS.
| Tool | Description |
|---|---|
fetch_url |
Fetch HTML or text from a URL |
fetch_json |
Fetch and parse a JSON API response |
check_url |
Check if a URL is reachable (HEAD request) |
🧠 Memory Server
Persistent across restarts. Backed by a JSON file.
| Tool | Description |
|---|---|
memory_set |
Store a value with key, namespace, and tags |
memory_get |
Retrieve a value by key |
memory_search |
Full-text search across all entries |
memory_delete |
Delete an entry |
memory_list_namespaces |
List all namespaces with counts |
memory_clear_namespace |
Delete all entries in a namespace |
Ansible Deployment
Deploy to all your client machines simultaneously:
cd ansible
# First time
ansible-playbook -i inventory.yml deploy-mcp-hub.yml
# Update only (rebuild + restart)
ansible-playbook -i inventory.yml deploy-mcp-hub.yml --tags update
# Deploy to specific group
ansible-playbook -i inventory.yml deploy-mcp-hub.yml --limit servers
The playbook:
- Installs Node.js 20 (if not present)
- Creates a dedicated
mcp-hubsystem user - Copies and builds the project
- Writes the
.envconfig from your Ansible variables - Installs and starts a systemd service (auto-restart on failure)
Per-host variables in inventory.yml let you configure different allowed domains, log levels, and paths per machine group.
Adding a New Server
See docs/adding-a-new-server.template.ts for the full template with comments.
In short:
// 1. Create packages/server-myservice/src/my-server.ts
export class MyServer extends BaseMCPServer {
constructor(options: MyOptions) {
super(SERVER_INFO, options);
this.registerTool("my_tool", this.handleMyTool.bind(this));
}
private async handleMyTool(args) {
return this.ok({ result: "done" });
}
}
// 2. Register in host/src/cli.ts
hub.use(new MyServer({ apiKey: process.env.MY_API_KEY! }));
Ideas: server-slack, server-postgres, server-docker, server-ansible, server-ssh, server-jira
Environment Variables
| Variable | Default | Description |
|---|---|---|
MCP_DATA_DIR |
./mcp-data |
Root for all hub data |
MCP_FS_ROOT |
./mcp-data/files |
Filesystem sandbox root |
MCP_GIT_WORKSPACE |
./mcp-data/repos |
Git repos base path |
MCP_MEMORY_PATH |
./mcp-data/memory.json |
Memory store file |
MCP_FETCH_ALLOWED_DOMAINS |
(empty = all) | Comma-separated domain allowlist |
MCP_LOG_LEVEL |
info |
debug|info|warn|error |
Security Notes
- Filesystem: Strictly sandboxed. Path traversal attacks return an error, not data.
- Git: Read-only. No
commit,push, orcloneoperations exposed. - Fetch: Optional domain allowlist prevents SSRF to internal services.
- Systemd service: Runs as a non-root user with
PrivateTmp=trueandNoNewPrivileges=true.
Requirements
- Node.js ≥ 18 (for native
fetchAPI) - Git (for
server-git) - Linux with systemd (for Ansible deployment)
SSH Server added and tested Sat May 2 14:23:33 -03 2026
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。