
PromptQL
STDIO通过MCP协议连接AI助手与Hasura数据
通过MCP协议连接AI助手与Hasura数据
Connect Hasura PromptQL to AI assistants like Claude using the Model Context Protocol (MCP).
This project provides a bridge between Hasura's PromptQL data agent and AI assistants through the Model Context Protocol. With this integration, AI assistants can directly query your enterprise data using natural language, leveraging PromptQL's powerful capabilities for data access, analysis, and visualization.
git clone https://github.com/hasura/promptql-mcp.git cd promptql-mcp
# Create a virtual environment python -m venv venv # Activate the virtual environment source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e .
python -m promptql_mcp_server setup --api-key YOUR_PROMPTQL_API_KEY --ddn-url YOUR_DDN_URL
python -m promptql_mcp_server
python examples/simple_client.py
{ "mcpServers": { "promptql": { "command": "/full/path/to/python", "args": ["-m", "promptql_mcp_server"] } } }
Replace /full/path/to/python
with the actual path to your Python executable.
If you're using a virtual environment (recommended):
{ "mcpServers": { "promptql": { "command": "/path/to/your/project/venv/bin/python", "args": ["-m", "promptql_mcp_server"] } } }
To find your Python path, run:
which python # On macOS/Linux where python # On Windows
The server exposes the following MCP tools:
This integration follows a client-server architecture:
The server translates between the MCP protocol and PromptQL's API, allowing seamless integration between AI assistants and your enterprise data.
On many systems, especially macOS, you may need to use python3
and pip3
instead of python
and pip
.
Modern Python installations often prevent global package installation. Use a virtual environment as described in the installation section.
Ensure you've:
pip install -e .
If you have multiple Python versions installed, make sure you're using Python 3.10 or higher:
python3.10 -m venv venv # Specify the exact version
promptql-mcp/
├── promptql_mcp_server/ # Main package
│ ├── __init__.py
│ ├── __main__.py # Entry point
│ ├── server.py # MCP server implementation
│ ├── config.py # Configuration management
│ └── api/ # API clients
│ ├── __init__.py
│ └── promptql_client.py # PromptQL API client
├── examples/ # Example clients
│ └── simple_client.py # Simple MCP client
├── setup.py # Package configuration
└── README.md # Documentation
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.