zxfgds
服务介绍
MCP Toolkit
English | 中文
概述
MCP Toolkit 是一个全面的 Model Context Protocol (MCP) 服务器实现,为 AI 助手提供了丰富的工具集,使其能够与本地系统、文件、数据库和外部服务进行交互。它旨在通过保持安全性和控制的同时扩展 AI 的实际交互能力。
特性
-
文件系统操作
- 读写文件
- 创建和删除目录
- 使用正则表达式搜索文件
- 列出目录内容
- 提取代码定义
-
数据库集成
- MySQL 支持
- PostgreSQL 支持
- Redis 支持
- 事务管理
- 参数化查询
-
GitHub 集成
- 仓库管理
- 代码搜索
- 文件操作
- 树结构分析
-
Web 功能
- 网页内容提取
- Brave 搜索集成
- HTTP 请求处理
- 代理支持
-
系统工具
- 命令执行
- Everything 搜索集成
- 堆栈跟踪分析
- 日志系统
安装
bash
npm install mcp-toolkit
配置
在项目中创建一个 config.json 文件:
json
{
"workspace": {
"rootPath": "/path/to/workspace",
"allowedPaths": ["/allowed/path1", "/allowed/path2"]
},
"network": {
"proxy": "http://proxy-server:port" // 可选
},
"database": {
"mysql": {
"host": "localhost",
"port": 3306,
"user": "user",
"password": "password",
"database": "dbname"
}
// 对于 PostgreSQL 和 Redis 类似的配置
}
}
使用
typescript
import { Server } from 'mcp-toolkit';
const server = new Server({
configPath: './config.json'
});
server.start();
工具详情
文件操作工具
read_file: 读取文件内容,支持文本和二进制文件write_to_file: 写入或创建文件apply_diff: 应用差异修改到文件insert_content: 在指定位置插入内容search_and_replace: 搜索并替换文件内容list_files: 列出目录内容search_files: 使用正则表达式搜索文件list_code_definition_names: 提取代码定义
数据库工具
db_connect: 连接到数据库 (MySQL/PostgreSQL/Redis)db_query: 执行数据库查询db_begin_transaction: 开始事务db_commit_transaction: 提交事务db_rollback_transaction: 回滚事务db_close: 关闭数据库连接
GitHub 工具
github_ls: 列出仓库内容github_tree: 显示仓库树结构github_search_repo: 搜索仓库github_search_code: 搜索代码github_cat: 查看文件内容github_list_repos: 列出用户仓库github_create_repo: 创建仓库github_update_repo: 更新仓库设置github_delete_repo: 删除仓库
Web 工具
read_webpage: 提取网页内容brave_search: 使用 Brave 搜索http_request: 发送 HTTP 请求
系统工具
execute_command: 执行系统命令everything_search: 本地文件搜索logger: 日志记录get_stack_trace: 堆栈跟踪分析
安全性
- 可配置的工作区限制
- 命令执行控制
- 数据库访问管理
- 外部服务基于令牌的身份验证
贡献
欢迎贡献!请阅读我们的贡献指南获取详细信息。
许可证
MIT 许可证