AA

arize-ai/text-to-graphql-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

26 stars 12 forks 质量 74 趋势 19NOASSERTION

利用MCP(模型上下文协议)服务器将自然语言查询转换为GraphQL查询,该服务器可与Claude Desktop和Cursor等AI助手无缝集成。

概览

利用MCP(模型上下文协议)服务器将自然语言查询转换为GraphQL查询,该服务器可与Claude Desktop和Cursor等AI助手无缝集成。 文本转GraphQL MCP服务器利用由LangGraph构建的AI代理,将自然语言描述转换为有效的GraphQL查询。它为人类语言与GraphQL API之间搭建桥梁,使数据库和API交互对开发者和非技术用户都更加直观。 - : 将普通英语查询转换为有效的 GraphQL - : 自动加载并内省 GraphQL 模式 - : 验证生成查询与已加载模式的验证 - : 通过认证对 GraphQL 端点执行查询 - : 跟踪和管理会话间的查询历史 - : 完全兼容 Claude Desktop、Cursor 及其他 MCP 客户端 - : 优雅的错误处理和详细的调试信息 - : 模式和常用查询内置缓存 UV 是一个快速的 Python 安装包,而且......

概述(AI 翻译)

利用MCP(模型上下文协议)服务器将自然语言查询转换为GraphQL查询,该服务器可与Claude Desktop和Cursor等AI助手无缝集成。

🚀 概述

文本转GraphQL MCP服务器利用由LangGraph构建的AI代理,将自然语言描述转换为有效的GraphQL查询。它为人类语言与GraphQL API之间搭建桥梁,使数据库和API交互对开发者和非技术用户都更加直观。

✨ 特色

  • 自然语言转GraphQL:将通俗英语查询转换为有效的GraphQL
  • 模式管理:自动加载并内省GraphQL模式
  • 查询验证:验证生成的查询与已加载的模式
  • 查询执行:对带有认证的GraphQL端点执行查询
  • 查询历史:跟踪和管理跨会话的查询历史
  • MCP 协议:与 Claude 桌面、光标及其他 MCP 客户端完全兼容
  • 错误处理:优雅的错误处理,附有详细的调试信息
  • 缓存:内置模式缓存和常用查询

🛠 安装

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Text-to-GraphQL MCP Server

Transform natural language queries into GraphQL queries using an MCP (Model Context Protocol) server that integrates seamlessly with AI assistants like Claude Desktop and Cursor.

🚀 Overview

The Text-to-GraphQL MCP Server converts natural language descriptions into valid GraphQL queries using an AI agent built with LangGraph. It provides a bridge between human language and GraphQL APIs, making database and API interactions more intuitive for developers and non-technical users alike.

✨ Features

  • Natural Language to GraphQL: Convert plain English queries to valid GraphQL
  • Schema Management: Load and introspect GraphQL schemas automatically
  • Query Validation: Validate generated queries against loaded schemas
  • Query Execution: Execute queries against GraphQL endpoints with authentication
  • Query History: Track and manage query history across sessions
  • MCP Protocol: Full compatibility with Claude Desktop, Cursor, and other MCP clients
  • Error Handling: Graceful error handling with detailed debugging information
  • Caching: Built-in caching for schemas and frequently used queries

🛠 Installation

UV is a fast Python package installer and resolver. Install it first:

macOS/Linux:

curl -LsSf https://astral.sh/uv/install.sh | sh

Windows:

powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

Find your UV installation path:

# Find where uv is installed
which uv

# Common locations:
# macOS/Linux: ~/.local/bin/uv
# Windows: %APPDATA%\uv\bin\uv.exe

Important: You’ll need the UV path for MCP configuration. The typical path is ~/.local/bin on macOS/Linux, which translates to /Users/yourusername/.local/bin (replace yourusername with your actual username).

Setup for MCP Usage

# Clone the repository
git clone https://github.com/Arize-ai/text-to-graphql-mcp.git
cd text-to-graphql-mcp

# Install dependencies (UV automatically creates virtual environment)
uv sync

# Test the installation
uv run text-to-graphql-mcp --help

Note: The uv run pattern automatically handles virtual environments, making MCP configuration cleaner and more reliable than traditional pip installations.

Alternative Installation Methods

From PyPI (when published):

在 GitHub 查看完整 README

安装

docker exec -i text-to-graphql-mcp uv run python -m src.text_to_graphql_mcp.mcp_server
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "text-to-graphql": { "command": "uv", "args": [ "--directory", "/path/to/text-to-graphql-mcp", "run", "text-to-graphql-mcp" ], "env": { "PATH": "/path/to/uv/bin:/usr/bin:/bin", "OPENAI_API_KEY": "your_openai_api_key_here", "GRAPHQL_ENDPOINT": "https://your-graphql-api.com/graphql", "GRAPHQL_API_KEY": "your_api_key_here", "GRAPHQL_AUTH_TYPE": "bearer" } } } }