# Let AI clients call AskTable through MCP

Expose AskTable's query and management capabilities to AI clients through MCP.

使用指南 · 模块: integrations · 应用开发者 · 部署形态：资料未说明 · 已确认产品版本：资料未说明 · 来源：现有文档

AskTable's MCP Server exposes data questions and management capabilities as tools through Model Context Protocol, allowing Claude, MCP Inspector, and other MCP-capable AI clients to call them directly. It is a single server named `asktable`, with 43 tools. MCP does not bypass AskTable permissions: the API-Key type and project permissions still determine what the client can call.

## Before you begin

- An AskTable project and project API-Key. Use `asker` for questions only; use `admin` for management tools.
- Creation location: left main navigation → “Settings” → “API-Key” → “Create API-KEY”; select the type in the dialog.
- The client supports Streamable HTTP or stdio. Use HTTP in production.
- Confirm the URL first; the three deployment types differ, as shown below.
- UI entry: bottom avatar → “Documentation” → “MCP service,” which opens the URL for the current deployment.

## Steps

**Confirm your MCP URL**

| Deployment                                                                | URL                                 |
| ------------------------------------------------------------------------- | ----------------------------------- |
| SaaS (cloud.asktable.com)                                                 | `https://mcp.asktable.com/`         |
| Private deployment, all-in-one image (in-container nginx proxies `/mcp/`) | `https://<your-AskTable-site>/mcp/` |
| Private deployment, standalone `asktable-mcp` container                   | `http://<mcp-host>:8690/`           |

The standalone container's HTTP transport accepts any path without requiring the `/mcp/` prefix. The all-in-one image exposes only `/mcp/` externally; nginx strips the prefix before forwarding to 8690.

**Enter the URL and Key in the client**

Streamable HTTP configuration (field names depend on your client):

```json
{
  "mcpServers": {
    "asktable": {
      "type": "http",
      "url": "https://mcp.asktable.com/",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}
```

The `Authorization` header is required. The server creates an independent client instance for each request and does not retain state across tenants.

**Confirm that the client can list tools**

After connecting, ask the client to list tools; you should see 43. They are grouped by domain below:

| Domain       | Tools                                                                                                                                                      | Count |
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
| datasource   | `datasource_list`, `datasource_get`, `datasource_create`, `datasource_update`, `datasource_delete`, `datasource_upload_file`, `datasource_test_connection` | 7     |
| meta         | `datasource_meta_get`, `datasource_meta_export`, `meta_sync`, `meta_import`                                                                                | 4     |
| training     | `training_pair_list`, `training_pair_create`, `training_pair_update`, `training_pair_delete`                                                               | 4     |
| field        | `field_set_visibility`, `field_set_description`, `field_set_ai_value_index`                                                                                | 3     |
| table        | `table_set_description`                                                                                                                                    | 1     |
| role         | `role_list`, `role_get`, `role_create`, `role_update`, `role_delete`                                                                                       | 5     |
| policy       | `policy_list`, `policy_get`, `policy_create`, `policy_update`, `policy_delete`                                                                             | 5     |
| chat         | `chat_ask`, `chat_followup`                                                                                                                                | 2     |
| conversation | `conversation_list`, `conversation_get`, `conversation_delete`                                                                                             | 3     |
| data\_agent  | `data_agent_list`, `data_agent_get`, `data_agent_create`, `data_agent_update`, `data_agent_delete`                                                         | 5     |
| project      | `project_get`, `project_preference_get`, `project_update`, `project_preference_update`                                                                     | 4     |

List tools accept `page` and `size` (`size` is capped at 200); omitted values use backend defaults.

**Ask with chat\_ask, then follow up with chat\_followup**

Have the client call `chat_ask` to ask a question. For multiple turns, use `chat_followup` to continue the previous conversation. If the client provides `progressToken`, these tools send progress notifications between each poll.

Delete tools (`*_delete`) require `confirm` to be `true`; omitting it is treated as a parameter error.

**Use stdio for local debugging**

For standalone debugging or MCP Inspector, start stdio in the `mcp/` directory:

```bash
bun src/main.ts --stdio
```

In stdio mode, the Key comes from environment variables:

```bash
export ASKTABLE_API_URL='https://<your-AskTable-site>'
export ASKTABLE_API_KEY='YOUR_API_KEY'
```

The server uses `ASKTABLE_API_URL` to target AskTable's API, defaulting to `https://api.asktable.com`. In the all-in-one image it is set to `http://127.0.0.1:8688`, using localhost within the same container.

**Secure credentials before production**

Client configuration files are often synchronized or backed up. Use the client's secret management to inject `Authorization` in production rather than leaving the Key in plaintext in a configuration repository. If a Key leaks, immediately delete and recreate it in “Settings” → “API-Key.”

## Key constraints

| Item                                      | Value or default                                                                            | Where to change it                                                            |
| ----------------------------------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| Server name and tool count                | Single `asktable` server, 43 tools                                                          | No UI switch                                                                  |
| Cloud URL                                 | `https://mcp.asktable.com/`                                                                 | Bottom avatar → “Documentation” → “MCP service”                               |
| Private deployment (all-in-one image)     | `<your-site>/mcp/`                                                                          | See [Private deployment (Docker)](https://docs.asktable.com/en/deploy/docker) |
| Private deployment (standalone container) | `http://<mcp-host>:8690/`                                                                   | Container `ports` and `ASKTABLE_API_URL`                                      |
| Authentication                            | `Authorization: Bearer <API-Key>`, required                                                 | Client configuration                                                          |
| `ASKTABLE_API_URL`                        | Default `https://api.asktable.com`                                                          | MCP container environment variables                                           |
| List pagination `size`                    | Maximum 200; omission uses backend defaults                                                 | Tool arguments                                                                |
| Delete tools                              | Must explicitly pass `confirm: true`                                                        | Tool arguments                                                                |
| Audit logs                                | One JSON line per call to stderr; only the first 16 characters of the Key's sha256 are kept | Container logs                                                                |
| Production transport                      | Streamable HTTP; stdio is for local debugging only                                          | Startup options                                                               |

## Troubleshooting

| Symptom                                                  | Identifying condition                                | Resolution                                                                                        |
| -------------------------------------------------------- | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| Client reports `InvalidRequest`                          | Server maps HTTP 401 or 404 to this error            | Check that `Authorization` has the `Bearer ` prefix, the Key is valid, and the URL is correct     |
| Client reports `InvalidParams`                           | Server maps HTTP 422 to this error                   | Correct parameter types or required fields according to the tool schema                           |
| Client reports `InternalError`                           | Upstream returned another status code                | Check `httpStatus` preserved in the error object, then correlate by time in AskTable service logs |
| Calling `*_delete` reports a parameter error             | Arguments lack `confirm: true`                       | Explicitly pass `confirm: true`                                                                   |
| Standalone container is unreachable                      | `http://<mcp-host>:8690/` cannot be reached          | Confirm the container port is published and `ASKTABLE_API_URL` points to an accessible backend    |
| `/mcp/` returns 404 in the all-in-one image              | Port 8690 is not running in the container            | Check the in-container `mcp-server` process and nginx proxy configuration                         |
| `meta_sync` immediately returns `{"status":"triggered"}` | `wait` was omitted                                   | Expected behavior; to wait for results, pass `wait`, `poll_interval_ms`, and `max_attempts`       |
| List tools return fewer entries than expected            | `size` was omitted, using backend default pagination | Explicitly pass `size` (up to 200) and `page`                                                     |
| Client never receives progress                           | Client did not provide `progressToken`               | Progress notifications are sent only when the client provides `progressToken`                     |

## Next steps

- Operate AskTable directly in a terminal: [Command-line tool](https://docs.asktable.com/en/integrations/cli)
- Handle requests and responses yourself without an AI client: [OpenAPI](https://docs.asktable.com/en/integrations/openapi)
- Run a separate MCP container in a private deployment: [Private deployment (Docker)](https://docs.asktable.com/en/deploy/docker)
