Skip to main content
Glama

Gel Database MCP Server

by christian561

凝胶数据库 MCP 服务器

一个基于 TypeScript 的模型上下文协议 (MCP) 服务器,旨在通过 EdgeQL 查询简化 Gel 数据库操作。该项目为 LLM 代理(游标代理、Claude 代码等)提供工具,用于自动学习您的架构,以及编写、验证和执行数据库查询。通过自然语言轻松与您的 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

光标 MCP 设置的屏幕截图

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

可用工具

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

描述模式

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

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

验证查询

这有助于您的 LLM 代理在不执行原始 EdgeQL 查询语法的情况下对其进行验证,从而允许在针对数据库运行生成的查询之前对其进行安全验证。

**何时使用:**在查询开发期间检查语法而不冒执行副作用的风险。 图像

执行edgeql

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

例子:

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

图像

搜索凝胶文档

此工具允许您的 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 代理可以灵活地搜索特定术语,同时还可以在需要更广泛的背景时访问完整的文档。

执行 TypeScript

与execute-edgeql类似,但可以使用它来测试和运行使用查询构建器语法制作的Typescript Gel查询。

该工具中包含说明,但最好还是询问代理有哪些说明,以便它根据上下文加载这些说明。这样可以确保代理不会跳过这些说明。

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

告诉法学硕士这些是最佳实践:

  • 使用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 处理查询结果时。

图像

了解更多

有关模型上下文协议的更多信息,请访问modelcontextprotocol.io/quickstart

Install Server
A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

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

  1. 快速入门指南
    1. 在 Cursor 中连接 MCP 服务器
      1. 可用工具
      2. 了解更多

    Related MCP Servers

    • -
      security
      A
      license
      -
      quality
      A Model Context Protocol (MCP) server that enables LLMs to interact directly the documents that they have on-disk through agentic RAG and hybrid search in LanceDB. Ask LLMs questions about the dataset as a whole or about specific documents.
      Last updated -
      7
      66
      TypeScript
      MIT License
      • Apple
    • A
      security
      F
      license
      A
      quality
      A TypeScript MCP server that allows querying documents using LLMs with context from locally stored repositories and text files through a RAG (Retrieval-Augmented Generation) system.
      Last updated -
      4
      8
      JavaScript
      • Apple
      • Linux
    • -
      security
      F
      license
      -
      quality
      A customized MCP server that enables integration between LLM applications and documentation sources, providing AI-assisted access to LangGraph and Model Context Protocol documentation.
      Last updated -
      1
      Python
      • Linux
      • Apple
    • -
      security
      A
      license
      -
      quality
      MCP-Server from your Database optimized for LLMs and AI-Agents. Supports PostgreSQL, MySQL, ClickHouse, Snowflake, MSSQL, BigQuery, Oracle Database, SQLite, ElasticSearch, DuckDB
      Last updated -
      440
      Go
      Apache 2.0
      • Linux

    View all related MCP servers

    MCP directory API

    We provide all the information about MCP servers via our MCP API.

    curl -X GET 'https://glama.ai/api/mcp/v1/servers/christian561/gel-mcp-server'

    If you have feedback or need assistance with the MCP directory API, please join our Discord server