Skip to main content
Glama
OneSQL MCP Server

OneSQL MCP Server

by yicui2004

OneSQL MCP Server

Model Context Protocol (MCP) server for OneSQL - AI-powered SQL query generation and table extraction.

Features

  • SQL Generation (Paid): Convert natural language to SQL queries using Qwen2.5-Coder-7B + OneSQL PEFT

  • Schema Management (Paid): Upload, list, and delete database schemas

  • Table Extraction (FREE): Extract tables from text documents - no API key required!

Related MCP server: TalkDB

Installation

Quick Install

pip install onesql-mcp-server

Manual Install

# Download the script
curl -O https://us-central1-onekq-public.cloudfunctions.net/onesql-main/mcp-server.py

# Make it executable
chmod +x onesql_mcp_server.py

Setup

1. Get API Key

For paid SQL features, get your API key from:

2. Configure Claude Desktop

Add to your claude_desktop_config.json:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "onesql": {
      "command": "python",
      "args": ["/path/to/onesql_mcp_server.py"],
      "env": {
        "ONESQL_API_KEY": "your-api-key-here"
      }
    }
  }
}

3. Restart Claude Desktop

The OneSQL tools will appear in Claude Desktop's tool list.

Usage

Free Table Extraction (No API Key Required!)

Extract tables from this text:

| Name | Age | City |
|------|-----|------|
| John | 25  | NYC  |
| Jane | 30  | LA   |

SQL Generation (Requires API Key)

Generate SQL to find all users who signed up in the last 30 days

First, upload your schema:

Upload my database schema:
CREATE TABLE users (
  id SERIAL PRIMARY KEY,
  email VARCHAR(255),
  created_at TIMESTAMP
);

Available Tools

Tool

Cost

Description

sql_generate_query

πŸ’° Paid

Generate SQL from natural language

sql_upload_schema

πŸ’° Paid

Upload database schema for better accuracy

sql_list_schemas

πŸ’° Paid

List your saved schemas

sql_delete_schema

πŸ’° Paid

Delete a schema

extract_tables

πŸ†“ FREE

Extract tables from text (no API key!)

Architecture

Claude Desktop
    ↓
OneSQL MCP Server (local bridge)
    ↓
OneSQL GCP API
    ↓
β”œβ”€ Schema Service (Firestore)
└─ SQL Generation (GPU - Qwen2.5-Coder-7B)

Pricing

  • Table Extraction: FREE - unlimited usage, no API key required

  • SQL Generation: Pay-per-query via AWS/GCP Marketplace

  • Schema Management: Included with SQL subscription

API Endpoint

The MCP server connects to:

https://us-central1-onekq-public.cloudfunctions.net/onesql-main/mcp

Development

Run Locally

export ONESQL_API_KEY="your-key"
python onesql_mcp_server.py

The server reads JSON-RPC requests from stdin and writes responses to stdout.

Test with MCP Inspector

npx @modelcontextprotocol/inspector python onesql_mcp_server.py

Troubleshooting

"ONESQL_API_KEY environment variable is required"

  • Set the environment variable in Claude Desktop config (see Setup above)

  • For free table extraction, you can use a dummy key or leave it blank

"Network error" / "Timeout"

  • Check your internet connection

  • Verify the API endpoint is accessible: curl https://us-central1-onekq-public.cloudfunctions.net/onesql-main/mcp

Tools not appearing in Claude Desktop

  • Restart Claude Desktop after config changes

  • Check Claude Desktop logs for errors

Support

License

MIT License - see LICENSE file for details

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables querying PostgreSQL and MySQL databases using natural language, with RESTful endpoints for listing tables, describing schemas, and executing read-only queries.
      1
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables natural language querying of databases with multi-turn conversations, auto-generated charts, and proactive monitoring via scheduled queries and alerts.
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables natural language querying of any SQL database by converting plain English questions into SQL queries, with auto-schema detection and safety features.
      3
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables executing SQL queries, schema introspection, and data management for PostgreSQL and MySQL databases via natural language, supporting local, SSH, and AWS RDS connections.
      8
      MIT