English | 中文
MCP Toolkit 是一个全面的模型上下文协议(MCP)服务器实现,提供了丰富的工具集,使AI助手能够与本地系统、文件、数据库以及外部服务进行交互。它旨在通过实际互动扩展AI的能力,同时确保安全性和控制性。
文件系统操作
数据库集成
参数化查询
GitHub 集成
网络能力
系统工具
npm install mcp-toolkit
在项目中创建一个 config.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
}
}
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_ls: 列出仓库内容github_tree: 显示仓库树结构github_search_repo: 搜索仓库github_search_code: 搜索代码github_cat: 查看文件内容github_list_repos: 列出用户仓库github_create_repo: 创建仓库github_update_repo: 更新仓库设置github_delete_repo: 删除仓库read_webpage: 提取网页内容brave_search: 使用 Brave 搜索http_request: 发送 HTTP 请求execute_command: 执行系统命令everything_search: 本地文件搜索logger: 日志记录get_stack_trace: 堆栈跟踪分析欢迎贡献!请阅读我们的贡献指南以获取详细信息。
MIT 许可证