MCP Server
FraiseQL can serve as a Model Context Protocol (MCP) server, exposing your GraphQL queries and mutations as MCP tools. This lets AI agents — including Claude Desktop — query your database directly using natural language, with no custom integration code.
How It Works
Section titled “How It Works”When MCP is enabled, FraiseQL introspects its compiled schema and generates an MCP tool for every query and mutation. The agent describes what data it needs; FraiseQL executes the corresponding GraphQL operation and returns the result.
Configuration
Section titled “Configuration”Enable MCP in fraiseql.toml:
[fraiseql.mcp]enabled = truetransport = "http" # "http" | "stdio" | "both"path = "/mcp" # HTTP endpoint path (default: /mcp)require_auth = true # Require JWT/API key for MCP requests (default: true)
# Optional: restrict which operations are exposedinclude = ["users", "products"] # Whitelist (empty = all)exclude = ["adminUsers"] # BlacklistFor Claude Desktop or local CLI agents, use transport = "stdio":
fraiseql run --mcp-stdioClaude Desktop Setup
Section titled “Claude Desktop Setup”Add FraiseQL to your Claude Desktop claude_desktop_config.json:
{ "mcpServers": { "my-api": { "command": "fraiseql", "args": ["run", "--mcp-stdio"], "env": { "DATABASE_URL": "postgresql://localhost:5432/mydb" } } }}Claude can now query your database: “Show me the top 10 users by signup date” → FraiseQL executes the users query and returns structured data.
HTTP Transport
Section titled “HTTP Transport”For remote agents or multi-tenant setups, use the HTTP transport:
# MCP endpoint available at /mcpfraiseql runThe MCP endpoint is available alongside the GraphQL endpoint on the same port. Authenticate using the same JWT or API key as the GraphQL API.