what is greptimedb-mcp-server?
The greptimedb-mcp-server is a Model Context Protocol (MCP) server implementation for GreptimeDB, designed to provide AI assistants with a secure and structured way to explore and analyze databases.
how to use greptimedb-mcp-server?
To use the greptimedb-mcp-server, install it via pip and configure the necessary environment variables or command-line arguments to connect to your GreptimeDB instance. Then, integrate it with Claude Desktop for seamless operation.
key features of greptimedb-mcp-server?
- Secure access to database tables and data.
- Ability to execute SQL queries through a controlled interface.
- Integration with AI assistants for enhanced database interaction.
use cases of greptimedb-mcp-server?
- Enabling AI assistants to perform data analysis on GreptimeDB.
- Allowing users to list and query database tables securely.
- Facilitating the development of applications that require structured database access.
FAQ from greptimedb-mcp-server?
- What is the primary purpose of the greptimedb-mcp-server?
It provides a secure and structured way for AI assistants to interact with GreptimeDB databases.
- How do I install the greptimedb-mcp-server?
You can install it using the command
pip install greptimedb-mcp-server
.
- Is there any specific configuration required?
Yes, you need to set environment variables for database connection details or use command-line arguments.
greptimedb-mcp-server
A Model Context Protocol (MCP) server implementation for GreptimeDB.
This server provides AI assistants with a secure and structured way to explore and analyze databases. It enables them to list tables, read data, and execute SQL queries through a controlled interface, ensuring responsible database access.
Installation
pip install greptimedb-mcp-server
Configuration
Set the following environment variables:
GREPTIMEDB_HOST=localhost # Database host
GREPTIMEDB_PORT=4002 # Optional: Database port (defaults to 4002 if not specified)
GREPTIMEDB_USER=root
GREPTIMEDB_PASSWORD=
GREPTIMEDB_DATABASE=public
Or via command-line args:
--host
the database host--port
the database port--user
the database username--password
the database password--database
the database name
Usage
Claude Desktop Integration
Configure the MCP server in Claude Desktop's configuration file:
MacOS
Location: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows
Location: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"greptimedb": {
"command": "uv",
"args": [
"--directory",
"/path/to/greptimedb-mcp-server",
"run",
"-m",
"greptimedb_mcp_server.server"
],
"env": {
"GREPTIMEDB_HOST": "localhost",
"GREPTIMEDB_PORT": "4002",
"GREPTIMEDB_USER": "root",
"GREPTIMEDB_PASSWORD": "",
"GREPTIMEDB_DATABASE": "public"
}
}
}
}
License
MIT License - see LICENSE.md file for details.
Contribute
Prerequisites
- Python with
uv
package manager - GreptimeDB installation
- MCP server dependencies
Development
# Clone the repository
git clone https://github.com/GreptimeTeam/greptimedb-mcp-server.git
cd greptimedb-mcp-server
# Create virtual environment
python -m venv venv
source venv/bin/activate # or `venv\Scripts\activate` on Windows
# Install development dependencies
pip install -r requirements-dev.txt
# Run tests
pytest
Use MCP Inspector for debugging:
npx @modelcontextprotocol/inspector uv \
--directory \
/path/to/greptimedb-mcp-server \
run \
-m \
greptimedb_mcp_server.server
Acknowledgement
This library's implementation was inspired by the following two repositories and incorporates their code, for which we express our gratitude:
Thanks!