mcp-toolkit-server
Enables file operations, database queries, web search, and calculations through the Model Context Protocol, allowing integration with clients like Claude Desktop and Cursor.
README
🔧 MCP Toolkit Server
基于 Model Context Protocol (MCP) 的多功能工具服务器,提供文件操作、数据库查询、Web 搜索、计算等工具,可被 Claude Desktop、Cursor、Cline 等 MCP 客户端接入。
✨ 功能特性
📁 文件操作工具
list_directory- 列出目录内容read_file- 读取文本文件write_file- 写入/追加文件file_info- 获取文件元信息search_files- 按通配符搜索文件
🗄️ 数据库工具
query_database- 执行 SQL SELECT 查询(只读安全)list_tables- 列出所有表describe_table- 查看表结构init_sample_database- 初始化示例数据库
🌐 Web 工具
web_search- DuckDuckGo 网页搜索(无需 API Key)fetch_webpage- 抓取网页正文内容webpage_info- 获取网页元信息
🧮 计算工具
calculate- 安全数学表达式计算convert_unit- 单位转换(长度/重量/温度/面积/体积)date_calculation- 日期计算(差值/加减)percentage_calculation- 百分比计算
🏗️ 架构设计
┌─────────────────────────────────────────────────────┐
│ MCP 客户端 (Claude/Cursor) │
└──────────────────────┬──────────────────────────────┘
│ MCP Protocol (stdio / HTTP)
┌──────────────────────▼──────────────────────────────┐
│ FastMCP Server 核心 │
│ ┌──────────┐ ┌──────────┐ ┌────────┐ ┌──────────┐ │
│ │ 文件工具 │ │ 数据库工具│ │Web工具 │ │ 计算工具 │ │
│ └──────────┘ └──────────┘ └────────┘ └──────────┘ │
└─────────────────────────────────────────────────────┘
📦 安装
# 克隆仓库
git clone <repo-url>
cd mcp-toolkit-server
# 创建虚拟环境
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# 安装依赖
pip install -r requirements.txt
# 配置环境变量
cp .env.example .env
🚀 使用方法
1. 直接运行(stdio 模式)
python server.py
2. HTTP 模式
python server.py --transport http --host 127.0.0.1 --port 8000
3. 接入 Claude Desktop
编辑 Claude Desktop 配置文件(claude_desktop_config.json):
{
"mcpServers": {
"toolkit": {
"command": "python",
"args": ["path/to/mcp-toolkit-server/server.py"],
"env": {
"ALLOWED_DIRS": "/path/to/your/workspace"
}
}
}
}
4. 接入 Cursor
在 Cursor 设置 → MCP 中添加:
{
"mcpServers": {
"toolkit": {
"command": "python",
"args": ["path/to/mcp-toolkit-server/server.py"]
}
}
}
📁 项目结构
mcp-toolkit-server/
├── server.py # MCP 服务器主入口
├── config.py # 配置管理
├── requirements.txt # 依赖
├── .env.example # 环境变量模板
├── .gitignore
├── README.md
└── src/
├── __init__.py
└── tools/
├── __init__.py
├── file_tools.py # 文件操作工具
├── db_tools.py # 数据库查询工具
├── web_tools.py # Web 搜索/抓取工具
└── calc_tools.py # 计算/转换工具
🔒 安全机制
- 路径隔离: 文件操作限制在
ALLOWED_DIRS配置的目录内,防止路径遍历 - SQL 只读: 数据库工具仅允许 SELECT 查询,禁止写操作
- 标识符校验: 表名等标识符通过正则校验,防止 SQL 注入
- 表达式沙箱: 数学计算使用受限的 eval 环境,禁止访问内置函数
🎯 核心亮点
- 符合 MCP 规范: 基于官方 FastMCP 框架,兼容所有 MCP 客户端
- 工具丰富: 4 大类 17 个工具,覆盖常见开发场景
- 安全优先: 多层安全机制,防止滥用
- 易于扩展: 模块化设计,新增工具只需编写函数并注册
- 双传输模式: 支持 stdio(本地)和 HTTP(远程)两种传输方式
🤝 扩展方向
- [ ] 添加 Git 操作工具
- [ ] 添加代码执行工具(沙箱化)
- [ ] 添加邮件发送工具
- [ ] 添加日历管理工具
- [ ] 支持工具权限细粒度控制
- [ ] 添加工具调用审计日志
📄 License
MIT
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.