Integrations

  • Exposes GraphQL operations from any GraphQL backend as MCP tools, allowing AI agents to execute queries and mutations against GraphQL APIs using the operations defined in .graphql files.

  • Allows ChatGPT to utilize GraphQL operations as tools through OpenAI's function calling capability, enabling interaction with any GraphQL API.

格奇

graphql → ai

gqai是一个轻量级代理,它将 GraphQL 操作公开为 Claude、Cursor 和 ChatGPT 等 AI 的模型上下文协议 (MCP)工具。
使用针对 GraphQL 后端的常规 GraphQL 查询/变异定义工具,gqai 会自动为您生成 MCP 服务器。

🔌 由您的 GraphQL 后端提供支持
⚙️ 由.graphqlrc.yml + 普通.graphql文件驱动


✨ 特点

  • 🧰 使用 GraphQL 操作定义工具
  • 🗂 自动从.graphqlrc.yml中发现操作
  • 🧾 与 OpenAI 函数调用 / MCP 兼容的工具元数据

🛠️ 安装

go install github.com/fotoetienne/gqai@latest

🚀 快速入门

  1. 创建一个.graphqlrc.yml:
schema: https://graphql.org/graphql/ documents: .

该文件告诉 gqai 在哪里找到您的 GraphQL 模式和操作。

注意: schema参数指示 GQAI 在哪里执行操作。这必须是实时服务器,而不是静态模式文件。

  1. 添加 GraphQL 操作

get_all_films.graphql

# Get all Star Wars films query get_all_films { allFilms { films { title episodeID } } }
  1. 将 gqai 添加到您的mcp.json文件中:
"gqai": { "command": "gqai", "args": [ "run", "--config" ".graphqlrc.yml" ] }

就这样!你的 AI 模型现在可以调用get_all_films工具了。

用法

配置

GraphQL 配置

graphql 配置文件是一个 YAML 文件,它定义了 GraphQL 端点以及你想要作为工具公开的操作。它应该被命名为.graphqlrc.yml并放置在项目的根目录中。

schema: https://graphql.org/graphql/ documents: operations

schema字段指定 GraphQL 端点, documents字段指定 GraphQL 操作所在的目录。

在此示例中, operations目录包含您想要作为工具公开的所有 GraphQL 操作。这些操作在.graphql文件中定义,gqai 会自动发现它们。

标题

您还可以指定每次向 GraphQL 端点发送请求时使用的标头。这对于身份验证或其他自定义标头非常有用。

schema: - https://graphql.org/graphql/: headers: Authorization: Bearer YOUR_TOKEN X-Custom-Header: CustomValue documents: .
MCP 配置
克劳德桌面

要将 gqai 与 Claude Desktop 一起使用,您需要将以下配置添加到mcp.json文件中:

{ "gqai": { "command": "gqai", "args": [ "run", "--config", ".graphqlrc.yml" ] } }

🧪 CLI 测试

通过 CLI 调用工具进行测试:
gqai tools/call get_all_films

这将执行get_all_films工具并打印结果。

{ "data": { "allFilms": { "films": [ { "id": 4, "title": "A New Hope" }, { "id": 5, "title": "The Empire Strikes Back" }, { "id": 6, "title": "Return of the Jedi" }, ... ] } } }
调用带参数的工具:

创建一个接受参数的 GraphQL 操作,这些将是工具输入:

get_film_by_id.graphql

query get_film_by_id($id: ID!) { film(filmID: $id) { episodeID title director releaseDate } }

使用参数调用该工具:

gqai tools/call get_film_by_id '{"id": "1"}'

这将使用提供的参数执行get_film_by_id工具。

{ "data": { "film": { "episodeID": 1, "title": "A New Hope", "director": "George Lucas", "releaseDate": "1977-05-25" } } }

发展

先决条件

  • Go 1.20+

建造

go build -o gqai main.go

测试

go test ./...

格式

go fmt ./...

运行 MCP 服务器

./gqai run --config .graphqlrc.yml

运行 CLI

./gqai tools/call get_all_films

关于GQAI

🤖 为什么是 gqai?

gqai 可轻松将您的 GraphQL 后端转变为模型就绪的工具层——无需代码,无需额外基础设施。只需定义您的操作,然后让 AI 调用即可。

📜 许可证

MIT — 对其进行分叉,在此基础上进行构建,所有一切。

👋 作者

由 Stephen Spalding && <your-name-here>用 ❤️ 和 🤖 氛围制作

-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

格奇

  1. ✨ 特点
    1. 🛠️ 安装
      1. 🚀 快速入门
        1. 用法
          1. 配置
          2. 🧪 CLI 测试
        2. 发展
          1. 先决条件
          2. 建造
          3. 测试
          4. 格式
          5. 运行 MCP 服务器
          6. 运行 CLI
        3. 关于GQAI
          1. 🤖 为什么是 gqai?
          2. 📜 许可证
          3. 👋 作者

        Related MCP Servers

        • -
          security
          A
          license
          -
          quality
          Enables AI assistants to interact with and manage Google Cloud Platform resources including Compute Engine, Cloud Run, Storage, BigQuery, and other GCP services through a standardized MCP interface.
          Last updated -
          1
          Python
          MIT License
          • Linux
          • Apple
        • -
          security
          A
          license
          -
          quality
          Algolia
          Last updated -
          18
          Go
          MIT License
          • Apple

        View all related MCP servers

        ID: 0ej7lu3yvt