gqai
graphql โ ai
gqai is a lightweight proxy that exposes GraphQL operations as Model Context Protocol (MCP) tools for AI models like ChatGPT. It lets you define tools using regular GraphQL queries/mutations and run them locally or expose them over HTTP.
๐ Powered by your GraphQL backend โ๏ธ Driven by .graphqlrc.yml + plain .graphql files ๐ง Model-ready inputs/outputs๐ Built in Go
โจ Features
- ๐งฐ Run GraphQL operations as tools via CLI
- ๐ Serve tools via HTTP for AI agents
- ๐ Automatically discover operations from
.graphqlrc.yml - ๐งพ Tool metadata compatible with OpenAI function calling / MCP
๐ ๏ธ Installation
go install github.com/fotoetienne/gqai@latest
๐ Quick Start
- Create a .graphqlrc.yml:
schema: "https://graphql.org/graphql/"
documents: "operations"
This file tells gqai where to find your GraphQL schema and operations.
Note: The schema also tells gqai where to execute the operations. This must be a live server rather than a static schema file
- Write a GraphQL operation (operations/getAllFilms.graphql):
query getAllFilms {
allFilms {
films {
title
episodeID
}
}
}
- Run it via CLI:
gqai run getAllFilms
๐ HTTP Server
Run a local server that exposes your tools via HTTP:
gqai serve
Call the tools via HTTP POST requests:
curl -X POST http://localhost:8080/tools/call -d '{"toolName": "getAllFilms"}'
๐ฆ Tool Metadata
Auto-generated tool specs for each operation, so you can plug into any LLM that supports tool use.
๐ค Why gqai?
gqai makes it easy to turn your GraphQL backend into a model-ready tool layer โ no wrappers, no extra infra. Just define your operations and let AI call them.
๐งช Roadmap
CLI tool runner
HTTP server mode (gqai serve)
Tool metadata generation
JSON Schema validation
Plug-and-play with OpenAI, Fireworks, etc.
๐ License
MIT โ fork it, build on it, model all the things.
๐ Author
Made with โค๏ธ and ๐คvibes by Stephen Spalding