> ## Documentation Index
> Fetch the complete documentation index at: https://docs.acedata.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# AI Chat MCP integration guide

> aichat MCP server integration

AI Chat MCP lets assistants use multiple models through Ace Data Cloud's chat services, create new conversations, continue conversations, or retrieve saved conversations by ID. You can query the models supported by each chat API separately within the tool.

## Connect to the Hosted Service

In your client, select remote MCP (Streamable HTTP) and enter `https://aichat.mcp.acedata.cloud/mcp` as the server address. Select OAuth, then follow the browser prompts to sign in to Ace Data Cloud and authorize access.

| Client | How to connect |
| - | - |
| Claude / Claude Desktop | Add a custom connector under Customize → Connectors, paste the server address, and sign in. |
| Claude Code | Run `claude mcp add --transport http --scope user aichat https://aichat.mcp.acedata.cloud/mcp`, then open `/mcp` in the session, select the server, and complete authorization. |
| Codex CLI | Run `codex mcp add aichat --url https://aichat.mcp.acedata.cloud/mcp`, then run `codex mcp login aichat`. |
| Cursor | Create a new HTTP server in MCP settings, enter the address, and follow the prompts to sign in when connecting. |
| VS Code | Run `MCP: Add Server` from the command palette, select HTTP and enter the address, then use `MCP: List Servers` to check the status. |

If using an application API key, select the application used for chat on the application management page. Check that the allowed APIs include the AI Chat, AI Chat v2, or Claude Messages API you intend to use, and confirm the balance. Set the request header to `Authorization: Bearer &lt;应用 API Key>` in the client's private credential settings. [Applications and API Keys](https://platform.acedata.cloud/console/applications)

### Using an Application Key with Gemini CLI and OpenCode

First, set the environment variable `ACEDATACLOUD_API_TOKEN` to the application API key in the terminal where you launch the client. The following commands use macOS or Linux shell quoting and save a reference to the variable.

| Client | How to connect |
| - | - |
| Gemini CLI | Run `gemini mcp add --scope user --transport http aichat https://aichat.mcp.acedata.cloud/mcp --header 'Authorization: Bearer ${ACEDATACLOUD_API_TOKEN}'`, then use `gemini mcp list` to check. |
| OpenCode 2.x | Run `opencode mcp add aichat --global --url https://aichat.mcp.acedata.cloud/mcp --header 'Authorization=Bearer {env:ACEDATACLOUD_API_TOKEN}'`, then run `opencode reload` and `opencode mcp list`. |

In OpenCode 1.x, add a service named `aichat` to the `mcp` object in your personal `opencode.json`. Set `type` to `remote`, `url` to the address above, `oauth` to `false`, and `headers.Authorization` to `Bearer {env:ACEDATACLOUD_API_TOKEN}`. [OpenCode 1.x configuration](https://opencode.ai/v1/docs/mcp-servers/)

## Connect locally via stdio

Install uv, open the local MCP configuration in Claude Desktop's developer settings, and merge the following entry into your user configuration. Replace the placeholder with your application's API key, save, and restart the client. Other clients that support stdio can also run the `uvx mcp-aichat` command and pass the key to the process as an environment variable.

```json theme={null}
{
  "mcpServers": {
    "aichat": {
      "command": "uvx",
      "args": [
        "mcp-aichat"
      ],
      "env": {
        "ACEDATACLOUD_API_TOKEN": "YOUR_API_KEY"
      }
    }
  }
}
```

The local process still calls the Ace Data Cloud API. Store your key in your personal client configuration or a credential manager. [mcp-aichat package](https://pypi.org/project/mcp-aichat/)

## Verify the connection and available tools

Open the client's tool list, find AI Chat, and first ask the assistant to call `aichat_list_models` to list the models supported by AI Chat v2. This query checks whether the client has loaded the tools without submitting a business request.

| Purpose | Tool | Usage |
| - | - | - |
| View models | `aichat_list_models` | Select the required model identifier for the API. |
| Start a conversation | `aichat_create_conversation` | Write a question in `question` and optionally specify a model. The response includes the answer and conversation information. |
| Use v2 conversations | `aichat_create_conversation_v2` | Create, continue, or query a conversation. To query by ID, use `action="retrieve"` and `id`. |
| Send a Claude message | `aichat_create_message` | Select `model` from the native Messages model list, and pass in `messages` and a positive integer `max_tokens`. This tool requires access to the Claude Messages API. |
| View integration guidance | `aichat_get_usage_guide` | View multi-turn Q\&A and parameter examples. |

## Example request

Ask the assistant to use `aichat_create_conversation_v2` for a simple text-based question and answer, passing in the following parameters.

```json theme={null}
{
  "action": "chat",
  "question": "将这条反馈改成一个清楚的标题：我希望查到上次导出的文件。",
  "stateful": true,
  "max_turns": 1
}
```

Keep the returned conversation ID. You can then use `action="retrieve"` and `id` to query the conversation. `max_turns=1` is suitable for a single question and answer that does not require external tools. To let the v2 assistant execute tools within a request, you can separately set an iteration limit. Model calls are billed based on actual usage.

Before making a request, check the service page for current pricing and availability. [AI Chat service](https://platform.acedata.cloud/services/aichat) · [AI Chat API](https://platform.acedata.cloud/documents/aichat-conversations) · [AI Chat v2 API](https://platform.acedata.cloud/documents/aichat2-conversations)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.