PolarHub
  • Agents
  • MCP Servers
  • Skills
  • PolarBear
PolarHub © 2026
MCP ServersdatabasesGel MCP Server - 自然语言数据库交互工具
返回「databases」

Gel MCP Server - 自然语言数据库交互工具

modelscope·@christian561/gel-mcp-server

databases0下载LocalModelScope

简介

一个基于 TypeScript 的 MCP 服务器,它使 LLM 代理能够通过自然语言与 Gel 数据库进行交互,并提供学习数据库模式、验证和执行 EdgeQL 查询的工具。

MCP Server 详情

来自 ModelScope 索引

Gel 数据库 MCP 服务器

这是一个基于 TypeScript 的模型上下文协议(MCP)服务器,旨在通过 EdgeQL 查询简化 Gel 数据库操作。该项目提供了工具,以帮助 LLM 代理(如 Cursor Agent、Claude Code 等)自动化学习您的模式,并编写、验证和执行数据库查询。轻松地通过自然语言与您的 Gel 数据库进行交互。Vibe 编码者们欢呼吧!

注意:由于 LLM 可以编写更灵活的查询,因此不包含查询生成功能。已使用 Claude-3.7-sonnet-thinking 测试了 Cursor 代理,在提供 Gel 文档的相关网页链接后获得了良好的结果。

项目架构图

快速入门指南

# 1. Install dependencies
yarn install

# 2. Copy your dbschema folder into the project if you have one already 
# cp -r /path/to/your/dbschema ./
# or just copy and paste

# 3. Initialize a Gel project
npx gel project init
# Follow prompts to set up a new project 
# Can point to an existing gel instance by providing the name of your instance
#   -Import migrations if it asks

# 4. Generate EdgeQL JavaScript query builder files
npx @gel/generate edgeql-js
# Note: Re-run this command after any schema changes

# 5. Update connection settings
# Edit src/index_gel.ts lines 19-25 with your database, host, port, user, password
# Edit src/index_gel.ts line 37 with your branch name

# 6. Build the project
yarn build

# 7. (optional) Test the server runs without errors
node build/index.js

# 7.1 (if you have errors) Test server with a UI that provides more clear error logs using: 
npx @modelcontextprotocol/inspector node build/index.js

# 8. (Recommended) Include the gel_llm.txt documentation file
# Download the Gel documentation file and place it in your project root
# This allows both the search tool and direct file access for your LLM agent
# curl -o gel_llm.txt https://raw.githubusercontent.com/yourorg/gel-docs/main/gel_llm.txt
# Note: Replace the URL with the actual source of your gel_llm.txt file

在 Cursor 中连接 MCP 服务器

  1. 点击右上角的齿轮图标 > MCP > +添加新服务器
  2. 给它命名
  3. 选择类型:命令
  4. 输入以下内容:node your/full/path/to/build/index.js

Cursor MCP 设置截图

**注意:**虽然此服务器主要使用 Cursor 的代理进行了测试,但它应与其他支持模型上下文协议的代理和 LLM 兼容。如果您使用其他代理进行测试,请随时贡献您的发现!

可用工具

Gel 数据库 MCP 服务器提供以下工具:

describe-schema

这有助于您的 LLM 代理无需手动检查代码即可学习并理解您的数据库结构。代理可以发现可用的实体类型、它们的属性、关系和约束,从而生成更准确的查询。

**何时使用:**当您的代理在查询数据库实体之前需要了解其结构时。 图片

validate-query

这有助于您的 LLM 代理在不执行的情况下验证原始 EdgeQL 查询语法,允许在将生成的查询运行到您的数据库之前安全地验证它们。

**何时使用:**在查询开发期间检查语法,而不会产生执行副作用的风险。 图片

execute-edgeql

这有助于您的 LLM 代理直接与您的数据库交互,通过运行原始 EdgeQL 查询来检索数据并根据您的指示执行操作。您的 LLM 可以生成 EdgeQL 查询并自主执行。

示例:

SELECT Product { name, price } FILTER .price > 100;

图片

search-gel-docs

该工具允许您的 LLM 代理搜索 Gel 文档,找到有关 EdgeQL 语法、特性的相关信息或示例。它返回带有上下文的全面结果,以帮助代理更好地理解 Gel 数据库概念。

**何时使用:**当您的代理需要了解特定的 Gel/EdgeQL 特性、理解语法或寻找实现数据库操作的示例时。

示例:

search_term: "for loop"
context_lines: 10  # Optional: Number of context lines to show (default: 5)
match_all_terms: true  # Optional: Require all terms to match (default: false)

关于文档混合方法的说明: 为了获得最佳效果,我们建议同时执行以下操作:

  1. 将 gel_llm.txt 文件包含在您的项目根目录中(以便直接访问文件)
  2. 使用 search-gel-docs 工具进行有针对性的查询

这种混合方法使您的 LLM 代理能够灵活地搜索特定术语,同时在需要更广泛上下文时也能访问完整的文档。

execute-typescript

类似于 execute-edgeql,但可以使用此工具来测试和运行使用查询构建器语法编写的 Typescript Gel 查询。

工具中包含了说明,但仍然建议询问代理它有哪些说明,以确保它们被加载到上下文中。这样可以确保它不会跳过这些说明。

注意:一般的 JavaScript 语法错误可能会导致服务器崩溃,因此如果连接显示为关闭状态,您需要在 Cursor MCP 设置中刷新崩溃的服务器或重新启动服务器。

告诉 LLM 这些是最佳实践:

  • 使用 await gelClient.query() 并结合 console.log 来显示结果
  • 使用 ORDER BY 与 THEN 结合,而不是逗号(例如,ORDER BY .field1 THEN .field2)
  • 保持代码简单并专注于单一操作

示例:

console.log(await gelClient.query(`
  SELECT Product { 
    name, 
    price 
  } 
  FILTER .price > 100 
  ORDER BY .price DESC 
  LIMIT 5;
`));

何时使用: 对于需要编程逻辑的复杂查询,或者当您需要用 JavaScript 处理查询结果时。

image

了解更多

有关 Model Context Protocol 的更多信息,请访问 modelcontextprotocol.io/quickstart。

相关 MCP Servers(来自「databases」)

千牛安全审计

审计 npm 包依赖项以查找安全漏洞,提供详细的报告和修复建议,并集成 MCP。

@qianniuspace/mcp-security-audit

Claude 数据库连接器

通过API层将克劳德桌面版直接连接到数据库,使其能够探索数据库结构、编写SQL查询、分析数据集和创建报告。该API层还包含用于表探索和查询执行的工具。

@runekaagaard/mcp-alchemy

DBCode数据库管理工具

DBCode 是一个 Visual Studio Code 扩展,允许你管理许多数据库,包括 PostgreSQL、MySQL、SQL Server、DuckDB、Redis、MongoDB 等更多数据库。 DBCode 提供了运行 MCP 服务器的选项,可以访问这些数据库、它们的模式以及执行查询的能力。

@dbcodeio/public

DMS-数据库安全访问

AI 首选的统一数据访问通道,支持30多种数据源(阿里云全系/主流数据库/数仓)的安全访问。

@aliyun/alibabacloud-dms-mcp-server

Doris模型控制面板服务

后端服务,实现了模型控制面板协议,可连接到 Apache Doris 数据库,允许用户执行 SQL 查询、管理元数据,并且有可能利用大语言模型(LLMs)完成自然语言到 SQL 的转换等任务。

@apache/doris-mcp-server

Excel服务器

提供对Excel文件的操纵功能。此服务器启用工作簿创建、数据操纵、格式设置和高级Excel功能。

@haris-musa/excel-mcp-server

自动安装

点击按钮会唤起 PolarBear 客户端,并把当前 MCP Server 的 Markdown 详情文档地址传给客户端。

/api/mcps/christian561-gel-mcp-server/markdown
打开 PolarBear 安装查看 Markdown 文档

手动安装

在 PolarBear 或其他支持 MCP 的客户端中,新建 MCP Server,并参考下方来源或安装提示配置。

# 1. Install dependencies yarn install # 2. Copy your dbschema folder into the project if you have one already # cp -r /path/to/your/dbschema ./ # or just copy and paste # 3. Initialize a Gel project npx gel project init # Follow prompts to set up a new project # Can point to an existing gel instance by providing the name of your instance # -Import migrations if it asks # 4. Generate EdgeQL JavaScript query builder files npx @gel/generate edgeql-js # Note: Re-run this command after any schema changes # 5. Update connection settings # Edit src/index_gel.ts lines 19-25 with your database, host, port, user, password # Edit src/index_gel.ts line 37 with your branch name # 6. Build the project yarn build # 7. (optional) Test the server runs without errors node build/index.js # 7.1 (if you have errors) Test server with a UI that provides more clear error logs using: npx @modelcontextprotocol/inspector node build/index.js # 8. (Recommended) Include the gel_llm.txt documentation file # Download the Gel documentation file and place it in your project root # This allows both the search tool and direct file access for your LLM agent # curl -o gel_llm.txt https://raw.githubusercontent.com/yourorg/gel-docs/main/gel_llm.txt # Note: Replace the URL with the actual source of your gel_llm.txt file

基本信息

分类
databases / developer-tools / search
运行方式
No
许可证
Unknown
详情文件
christian561-gel-mcp-server.md