Labsco
gigapi logo

GigAPI Timeseries Lake

โ˜… 6

from gigapi

An MCP server for GigAPI Timeseries Lake, enabling seamless integration with MCP-compatible clients.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedAccount requiredAdvanced setup

GigAPI MCP Server

An MCP server for GigAPI Timeseries Lake that provides seamless integration with Claude Desktop and other MCP-compatible clients.

Features

GigAPI Tools

  • run_select_query
    • Execute SQL queries on your GigAPI cluster.
    • Input: sql (string): The SQL query to execute, database (string): The database to execute against.
    • All queries are executed safely through GigAPI's HTTP API with NDJSON format.
  • list_databases
    • List all databases on your GigAPI cluster.
    • Input: database (string): The database to use for the SHOW DATABASES query (defaults to "mydb").
  • list_tables
    • List all tables in a database.
    • Input: database (string): The name of the database.
  • get_table_schema
    • Get schema information for a specific table.
    • Input: database (string): The name of the database, table (string): The name of the table.
  • write_data
    • Write data using InfluxDB Line Protocol format.
    • Input: database (string): The database to write to, data (string): Data in InfluxDB Line Protocol format.
  • health_check
    • Check the health status of the GigAPI server.
  • ping
    • Ping the GigAPI server to check connectivity.

API Compatibility

This MCP server is designed to work with GigAPI's HTTP API endpoints:

Query Endpoints

  • POST /query?db={database}&format=ndjson - Execute SQL queries with NDJSON response format
  • All queries return NDJSON (Newline Delimited JSON) format for efficient streaming

Write Endpoints

  • POST /write?db={database} - Write data using InfluxDB Line Protocol

Administrative Endpoints

  • GET /health - Health check
  • GET /ping - Simple ping

Environment Variables

Required Variables

  • GIGAPI_HOST: The hostname of your GigAPI server
  • GIGAPI_PORT: The port number of your GigAPI server (default: 7971)

Optional Variables

  • GIGAPI_USERNAME or GIGAPI_USER: The username for authentication (if required)
  • GIGAPI_PASSWORD or GIGAPI_PASS: The password for authentication (if required)
  • GIGAPI_TIMEOUT: Request timeout in seconds (default: 30)
  • GIGAPI_VERIFY_SSL: Enable/disable SSL certificate verification (default: true)
  • GIGAPI_DEFAULT_DATABASE: Default database to use for queries (default: mydb)
  • GIGAPI_MCP_SERVER_TRANSPORT: Sets the transport method for the MCP server (default: stdio)
  • GIGAPI_ENABLED: Enable/disable GigAPI functionality (default: true)

Example Configurations

For Local Development

# Required variables
GIGAPI_HOST=localhost
GIGAPI_PORT=7971

# Optional: Override defaults for local development
GIGAPI_VERIFY_SSL=false
GIGAPI_TIMEOUT=60
GIGAPI_DEFAULT_DATABASE=mydb

For Production with Authentication

# Required variables
GIGAPI_HOST=your-gigapi-server
GIGAPI_PORT=7971
GIGAPI_USERNAME=your_username
GIGAPI_PASSWORD=your_password

# Optional: Production settings
GIGAPI_VERIFY_SSL=true
GIGAPI_TIMEOUT=30
GIGAPI_DEFAULT_DATABASE=your_database

For Public Demo

GIGAPI_HOST=gigapi.fly.dev
GIGAPI_PORT=443
GIGAPI_VERIFY_SSL=true
GIGAPI_DEFAULT_DATABASE=mydb

Data Format

GigAPI uses Hive partitioning with the structure:

/data
  /mydb
    /weather
      /date=2025-04-10
        /hour=14
          *.parquet
          metadata.json

Development

Setup Development Environment

  1. Install dependencies:

    uv sync --all-extras --dev
    source .venv/bin/activate
  2. Create a .env file in the root of the repository:

    GIGAPI_HOST=localhost
    GIGAPI_PORT=7971
    GIGAPI_USERNAME=your_username
    GIGAPI_PASSWORD=your_password
    GIGAPI_TIMEOUT=30
    GIGAPI_VERIFY_SSL=false
    GIGAPI_DEFAULT_DATABASE=mydb
  3. For testing with the MCP Inspector:

    fastmcp dev mcp_gigapi/mcp_server.py

Running Tests

# Run all tests
uv run pytest -v

# Run only unit tests
uv run pytest -v -m "not integration"

# Run only integration tests
uv run pytest -v -m "integration"

# Run linting
uv run ruff check .

# Test with public demo
python test_demo.py

Testing with Public Demo

The repository includes a test script that validates the MCP server against the public GigAPI demo:

python test_demo.py

This will test:

  • โœ… Health check and connectivity
  • โœ… Database listing (SHOW DATABASES)
  • โœ… Table listing (SHOW TABLES)
  • โœ… Data queries (SELECT count(*) FROM table)
  • โœ… Sample data retrieval

PyPI Publishing

This package is automatically published to PyPI on each GitHub release. The publishing process is handled by GitHub Actions workflows:

  • CI Workflow (.github/workflows/ci.yml): Runs tests on pull requests and pushes to main
  • Publish Workflow (.github/workflows/publish.yml): Publishes to PyPI when a release is created

For Users

Once published, users can install the package directly from PyPI:

# Install and run the MCP server
uv run --with mcp-gigapi --python 3.11 mcp-gigapi

For Maintainers

To publish a new version:

  1. Update the version in pyproject.toml
  2. Create a GitHub release
  3. The workflow will automatically publish to PyPI

See RELEASING.md for detailed release instructions.

Support