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