AskTable
Free Trial

MCP Quick Start: Connect Claude Desktop to Your Database in Minutes

AskTable Team
AskTable Team 2026-03-08

Want to query your database directly from Claude Desktop? In just 5 minutes, following the steps in this article, you can experience AI-driven data analysis.

This article will walk you through configuring the AskTable MCP Server to give Claude data querying capabilities.


1. Prerequisites

1.1 What Do You Need?

Required:

Optional:

  • •📊 Your own database (MySQL, PostgreSQL, etc.)
  • •🔑 If you don't have one, you can use our demo data

Time: 5-10 minutes


2. Method 1: Using Demo Data (Fastest)

This is the fastest way to get started. No installation required, just use our provided demo data.

Step 1: Open Claude Desktop Config File

macOS:

open ~/Library/Application\ Support/Claude/claude_desktop_config.json

Windows:

notepad %APPDATA%\Claude\claude_desktop_config.json

If the file doesn't exist, create a new one.

Step 2: Add MCP Configuration

Copy the following content into the config file:

{
  "mcpServers": {
    "asktable": {
      "type": "sse",
      "url": "https://mcp.asktable.com/sse/?api_key=ASKER_8H8DRJCH6LT8HCJPXOH4&datasource_id=ds_6iewvP4cpSyhO76P2Tv8MW",
      "headers": {},
      "timeout": 300,
      "sse_read_timeout": 300
    }
  }
}

Configuration说明:

  • •type: "sse":Use SSE protocol (recommended)
  • •url:MCP Server address, includes demo account API Key and datasource ID
  • •timeout:Request timeout in seconds
  • •sse_read_timeout:SSE connection timeout in seconds

Step 3: Restart Claude Desktop

After saving the config file, completely quit and reopen Claude Desktop.

Step 4: Test Connection

In Claude Desktop, input:

Hello, please help me query how many students there are in total?

If configured successfully, Claude will:

  1. •Recognize that AskTable tools are available
  2. •Call the query tool to query data
  3. •Return the query result

Expected Output:

Based on the query results, there are 200 students in total.

Step 5: Try More Queries

Now you can try various queries:

Basic Queries:

  • •"How many classes are there?"
  • •"List all course names"
  • •"Query the average age of students"

Complex Queries:

  • •"How many students are in each class?"
  • •"Which course has the most students?"
  • •"Query the number of students older than 20"

Generate SQL:

  • •"Generate SQL to query all students"
  • •"Write SQL to count the number of students in each class"

3. Method 2: Connect Your Own Database

If you want to connect your own database, you need to add a datasource in AskTable first.

Step 1: Log in to AskTable

Visit asktable.com and log in.

Step 2: Add a Datasource

  1. •Click the "Datasources" menu
  2. •Click "Add Datasource"
  3. •Select database type (MySQL, PostgreSQL, etc.)
  4. •Fill in connection information:
    • •Host address
    • •Port
    • •Database name
    • •Username
    • •Password
  5. •Test connection
  6. •Save

Step 3: Get API Key and Datasource ID

Get API Key:

  1. •Click the avatar in the top right
  2. •Select "Settings"
  3. •Create or copy API Key in the "API Keys" tab

Get Datasource ID:

  1. •In the "Datasources" list
  2. •Click the datasource you just created
  3. •The datasource ID can be found in the URL (format: ds_xxxxx)

Step 4: Update Claude Desktop Configuration

Replace api_key and datasource_id in the config file with your own:

{
  "mcpServers": {
    "asktable": {
      "type": "sse",
      "url": "https://mcp.asktable.com/sse/?api_key=YOUR_API_KEY&datasource_id=YOUR_DATASOURCE_ID",
      "headers": {},
      "timeout": 300,
      "sse_read_timeout": 300
    }
  }
}

Step 5: Restart and Test

Restart Claude Desktop, then try querying your data.


4. Method 3: Using Stdio Mode (Requires Installation)

If you prefer running the MCP Server locally, you can use Stdio mode.

Step 1: Install MCP Server

Using uv (recommended):

# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install AskTable MCP Server
uvx asktable-mcp-server@latest

Or using pip:

pip install asktable-mcp-server

Step 2: Configure Claude Desktop

{
  "mcpServers": {
    "asktable": {
      "command": "uvx",
      "args": ["asktable-mcp-server@latest"],
      "env": {
        "API_KEY": "YOUR_API_KEY",
        "DATASOURCE_ID": "YOUR_DATASOURCE_ID"
      }
    }
  }
}

Configuration说明:

  • •command: Startup command
  • •args: Command arguments
  • •env: Environment variables (API Key and datasource ID)

Step 3: Restart and Test

Restart Claude Desktop and test the querying functionality.


5. Verifying Successful Configuration

5.1 Check MCP Connection Status

In Claude Desktop, you should be able to see:

  • •A "Tools" icon in the bottom left corner
  • •After clicking, you'll see two tools: "Query Data with AskTable" and "Generate SQL with AskTable"

5.2 Test Basic Query

Input a simple query:

How many tables are in the database?

If results are returned, the configuration is successful!

5.3 Test SQL Generation

Input:

Generate SQL to query all users

If SQL statement is returned, both tools are working properly.


6. Common Issues

6.1 Claude Desktop Can't Find Config File

Problem: Config file path doesn't exist

Solution:

  • •Manually create the directory and file
  • •macOS: mkdir -p ~/Library/Application\ Support/Claude && touch ~/Library/Application\ Support/Claude/claude_desktop_config.json
  • •Windows: Create claude_desktop_config.json in the %APPDATA%\Claude\ directory

6.2 Tools Not Visible After Configuration

Problem: Still can't see AskTable tools after restart

Solution:

  1. •Check if config file format is correct (JSON format)
  2. •Make sure you completely quit Claude Desktop (not minimized)
  3. •Check Claude Desktop log files:
    • •macOS: ~/Library/Logs/Claude/mcp*.log
    • •Windows: %APPDATA%\Claude\logs\mcp*.log

6.3 Invalid API Key

Problem: Shows "api_key must be set" or "Invalid API key"

Solution:

  1. •Check if API Key was copied correctly (no extra spaces)
  2. •Confirm API Key hasn't expired
  3. •Regenerate API Key on AskTable website

6.4 Query Timeout

Problem: Query keeps returning no result

Solution:

  1. •Increase timeout and sse_read_timeout values (e.g., 600 seconds)
  2. •Check network connection
  3. •Try simpler queries

6.5 Stdio Mode Fails to Start

Problem: Tools can't start when using Stdio mode

Solution:

  1. •Confirm asktable-mcp-server is installed correctly
  2. •Try running manually: uvx asktable-mcp-server@latest
  3. •Check if environment variables are set correctly

7. Next Steps

Congratulations! You've successfully configured AskTable MCP Server.

Continue Learning:

Practical Suggestions:

  1. •Try various query types to get familiar with tool capabilities
  2. •Explore permission control features (role_id and role_variables)
  3. •Integrate MCP into your daily workflow

Get Help:


Related Reading:

Technical Exchange:

cta.readyToSimplify

No coding required. Ask questions in natural language and AI generates SQL queries and visualizations automatically.Start your free trial now and experience AI-powered data analysis with AskTable.

cta.noCreditCard
cta.quickStart
cta.dbSupport