| name | graphql-cli | ||||
|---|---|---|---|---|---|
| description | Manages GraphQL endpoints and executes queries/mutations using the graphql-cli tool. Use when asked to query a GraphQL API, explore a GraphQL schema, add/manage endpoints, or authenticate with a GraphQL service. | ||||
| license | MIT | ||||
| compatibility | Requires graphql-cli binary (Go) built and available in PATH | ||||
| metadata |
|
A skill for managing GraphQL endpoints and executing operations using graphql-cli.
- Add and manage multiple GraphQL endpoints (remote URL or local schema file)
- Update existing endpoint URL, headers, or description
- Authenticate with endpoints (Bearer token, Basic auth, custom header)
- Execute GraphQL queries and mutations
- Explore and search GraphQL schemas by keyword
- List configured endpoints
Run with npx (no installation required):
npx @axonhub/graphql-cli <command>Or build from source:
go install github.com/looplj/graphql-cli@latestEndpoint management commands live under graphql-cli endpoint ....
Remote URL:
graphql-cli endpoint add <name> --url <graphql-url> [--description "desc"] [--header "Key=Value"]Local schema file:
graphql-cli endpoint add <name> --schema-file ./schema.graphql [--description "desc"]Example:
graphql-cli endpoint add production --url https://api.example.com/graphql --description "Prod API"
graphql-cli endpoint add local --schema-file ./testdata/schema.graphql --description "Local schema"graphql-cli endpoint update <name> --url <new-url> [--description "desc"] [--header "Key=Value"]Example:
graphql-cli endpoint update production --url https://api.example.com/v2/graphql
graphql-cli endpoint update production --header "Authorization=Bearer new-token" -d "Updated prod API"Headers are merged — existing headers not specified in the update are preserved.
graphql-cli endpoint list # names and URLs
graphql-cli endpoint list --detail # includes headers (masked) and auth statusgraphql-cli endpoint login <endpoint> --type token --token "my-api-key"
graphql-cli endpoint login <endpoint> --type basic --user admin --pass secret
graphql-cli endpoint login <endpoint> --type header --key X-API-Key --value "key123"
graphql-cli endpoint login -e production --type token --token "my-token"
# Remove credentials
graphql-cli endpoint logout <endpoint>Credentials are stored in the OS keyring (macOS Keychain, Windows Credential Manager, GNOME Keyring) with a plaintext file fallback.
graphql-cli query '<graphql-query>' -e <endpoint>
graphql-cli query -f query.graphql -e <endpoint>
graphql-cli query '{ user(id: "1") { name } }' -e <endpoint> -v '{"id": "1"}'
graphql-cli query '{ me { name } }' -e <endpoint> -H "Authorization=Bearer token"graphql-cli mutate '<graphql-mutation>' -e <endpoint>
graphql-cli mutate -f mutation.graphql -e <endpoint> -v '{"name": "test"}'
graphql-cli mutate 'mutation { createUser(name: "test") { id } }' -e <endpoint># Search all definitions (names only by default)
graphql-cli find <keyword> -e <endpoint>
# Keyword supports glob syntax (*, ?, [...])
# Without glob characters, matches as substring
graphql-cli find "get*" -e <endpoint>
graphql-cli find "User?" -e <endpoint>
# Show full definitions with fields and arguments
graphql-cli find <keyword> -e <endpoint> --detail
# Narrow by kind
graphql-cli find user -e <endpoint> --query # Query fields only
graphql-cli find user -e <endpoint> --mutation # Mutation fields only
graphql-cli find user -e <endpoint> --type # Object/Interface/Union/Scalar types
graphql-cli find user -e <endpoint> --input # Input types only
graphql-cli find status -e <endpoint> --enum # Enum types only
# List everything (no keyword)
graphql-cli find -e <endpoint>
# Combine scopes
graphql-cli find user -e <endpoint> --type --inputSchema is loaded via introspection (remote URL) or from a local file (schema_file).
When executing queries/mutations, headers are merged with this priority (highest wins):
- CLI
-Hflags - Stored credentials (
login) - Config file headers
Each executed GraphQL statement is also appended to ~/.config/graphql-cli/audit.log as a JSON line containing timestamp, endpoint, status, and the statement text.
Example:
{"timestamp":"2026-03-29T08:15:30.123456Z","endpoint":"production","url":"https://api.example.com/graphql","status":"success","statement":"query { viewer { id } }"}To inspect the log stream locally:
graphql-cli audit list
graphql-cli audit list --query
graphql-cli audit list --status error
graphql-cli audit list --contains createUser
graphql-cli audit list --mutation --detail
# Or stream the raw log file
tail -f ~/.config/graphql-cli/audit.loggraphql-cli query -f queries/get-user.graphql -e prod -v "$(cat vars.json)"graphql-cli query '{ users { id name } }' -e prod 2>/dev/null | jq '.users[0]'# First, find what queries are available (names only)
graphql-cli find -e prod --query
# Then use --detail to see full definitions with fields and arguments
graphql-cli find user -e prod --query --detail
# Find the input types needed
graphql-cli find CreateUser -e prod --input --detail
# Then execute
graphql-cli mutate 'mutation { createUser(input: {name: "Alice", email: "alice@example.com"}) { id } }' -e prod- Always use
findwithout--detailfirst to get an overview of matching names, then usefind --detailon specific results to see full definitions with fields and arguments. This avoids overwhelming output when schemas are large.