关于 @obiwan90/edgedb-mcp-server
@obiwan90/edgedb-mcp-server 为 EdgeDB 提供查询和管理能力,适合通过命令行或项目库调用数据库的开发者。它涵盖数据库操作、EdgeQL 查询和模式查看,并可集成到 Cursor。
主要功能
- 01数据库连接与管理
- 02执行带参数的 EdgeQL 查询
- 03查找记录并支持筛选和分页
- 04查看类型并比较模式
- 05可作为命令行工具或库使用
适用场景
- 01通过 Cursor 操作 EdgeDB
- 02执行 EdgeQL 查询并查找记录
- 03检查数据库类型和模式差异
MCP 相关
该 MCP 服务向客户端提供 EdgeDB 数据库管理、查询和模式管理工具,并定义 MCP 资源。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
12收录的工具列表 · 更新于 3 周前
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| dsn | string | 否 | EdgeDB 连接字符串(例如:edgedb://user:password@hostname:port/database) |
| instanceName | string | 否 | EdgeDB 实例名称 |
详细介绍
@obiwan90/edgedb-mcp-server
EdgeDB MCP 服务是一款基于模型上下文协议(MCP)的工具,可为 EdgeDB 数据库提供查询和管理功能。它既可作为命令行工具使用,也可作为库集成到其他项目中。
功能
-
数据库管理工具
- 连接数据库(支持 DSN 和实例名称)
- 列出可用数据库
- 创建新数据库
- 切换当前数据库
- 获取当前数据库信息
-
查询工具
- 执行 EdgeQL 查询
- 执行带参数的 EdgeQL 查询
- 查找单条记录
- 查找多条记录(支持筛选、排序和分页)
-
架构管理工具
- 列出类型(可选是否包含系统类型)
- 获取类型详情
- 比较架构结构
安装
临时运行(无需安装)
npx -y @obiwan90/edgedb-mcp-server@latest
全局安装
npm install -g @obiwan90/edgedb-mcp-server
作为项目依赖项
npm install @obiwan90/edgedb-mcp-server
使用方法
命令行使用
# If installed globally
edgedb-mcp-server
# Or via npx for temporary execution
npx -y @obiwan90/edgedb-mcp-server
作为库集成
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { registerAllTools } from "@obiwan90/edgedb-mcp-server/build/tools/index.js";
import { registerAllResources } from "@obiwan90/edgedb-mcp-server/build/resources/index.js";
// Initialize MCP server
const server = new McpServer({
transport: new StdioServerTransport(),
name: "EdgeDB MCP Server",
description: "Providing EdgeDB database services through MCP protocol",
version: "1.0.0"
});
// Register resources and tools
registerAllResources(server);
registerAllTools(server);
// Start the server
(async function() {
try {
const transport = new StdioServerTransport();
await server.connect(transport);
console.log("MCP server connected, waiting for client requests...");
} catch (error) {
console.error("Server startup failed:", error);
process.exit(1);
}
})();
环境变量
EDGEDB_DSN- EdgeDB 数据库连接字符串EDGEDB_INSTANCE- EdgeDB 实例名称DEBUG- 启用调试模式(true/false)LOG_LEVEL- 日志级别(默认值:info)
项目开发
目录结构
src/
├── config/ # Configuration management
├── resources/ # MCP resource definitions
├── services/ # Service layer (EdgeDB connection management)
├── tools/ # MCP tool definitions
│ ├── database.ts # Database management tools
│ ├── query.ts # Query tools
│ ├── schema.ts # Schema management tools
│ └── index.ts # Tool exports
├── types/ # Type definitions
├── utils/ # Utility functions
└── index.ts # Application entry point
构建项目
# Clone the project
git clone https://github.com/obiwan90/mcp-server-edgedb.git
cd mcp-server-edgedb
# Install dependencies
npm install
# Build the project
npm run build
# Start the service
npm start
Cursor 集成
要将此 MCP 服务与 Cursor 编辑器集成,请按以下步骤操作:
- 编辑 Cursor 的 MCP 配置文件(
~/.cursor/mcp.json) - 添加以下配置:
"edgedb-server": {
"command": "npx",
"args": [
"-y",
"@obiwan90/edgedb-mcp-server@latest"
]
}
"edgedb-server": {
"command": "npx",
"args": [
"-y",
"@obiwan90/edgedb-mcp-server@latest",
"--instanceName",
"your-instance-name"
]
}
- 重启 Cursor 编辑器
- 现在可以在 Cursor 中使用 EdgeDB 工具了!通过命令面板(Cmd+Shift+P)搜索“EdgeDB”,或通过聊天界面访问这些工具。
Cursor dialog box input:
mcp_edgedb-server_connectEdgeDB(instanceName="your-instance-name")
许可证
本项目采用 MIT 许可证。
评论
支持 Markdown
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。