GLM MCP Integration Guide

GLM MCP connects GLM conversations to assistants that support MCP. You can have the assistant select a model, submit messages with context, and read the complete response.

Connect to the Hosted Service

Select remote MCP (Streamable HTTP) in the client and enter https://glm.mcp.acedata.cloud/mcp as the server address. After selecting OAuth, follow the browser prompts to log in to AI 聚合 and authorize access.

Client How to connect
Claude / Claude Desktop Add a custom connector under “Customize → Connectors,” paste the server address, and log in.
Claude Code Run claude mcp add --transport http --scope user glm https://glm.mcp.acedata.cloud/mcp, open /mcp in the session, select the server, and complete authorization.
Codex CLI Run codex mcp add glm --url https://glm.mcp.acedata.cloud/mcp, then run codex mcp login glm.
Cursor Create an HTTP server in the MCP settings, enter the address, and log in when prompted during connection.
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 a general-purpose application or an application with GLM conversation permissions on the application management page, and check the allowed APIs and balance. Set the request header to Authorization: Bearer <application API Key> in the client’s private credential settings. Applications and API Keys

Use 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 variable reference.

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

For OpenCode 1.x, add a service named glm 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

Connect Locally via stdio

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

{
  "mcpServers": {
    "glm": {
      "command": "uvx",
      "args": [
        "mcp-glm"
      ],
      "env": {
        "ACEDATACLOUD_API_TOKEN": "YOUR_API_KEY"
      }
    }
  }
}

The local process still calls the AI 聚合 API. Keep the key in your personal client configuration or credential manager. mcp-glm package

Verify the Connection and Available Tools

Open the client’s tool list, find GLM, and first have the assistant call glm_list_models to list the GLM model identifiers accepted by the tool. This query can check whether the client has loaded the tools without submitting a business request.

Purpose Tool Usage
View models glm_list_models Get the model identifiers supported by the tool, which can be used as the model parameter.
Send messages glm_chat_completions Each message in messages contains role and content. For multi-turn conversations, append the message history in order.
Learn about parameters glm_get_usage_guide View parameters and conversation call examples.

Call Example

Ask the assistant to call glm_chat_completions with the following set of messages to summarize a sentence of product feedback as a to-do item.

{
  "messages": [
    {"role": "system", "content": "用一句话给出可执行的改进。"},
    {"role": "user", "content": "导出报表后,我很难找到下载文件。"}
  ]
}

Omit model to use the tool’s default value, or pass an identifier from the model list. The MCP conversation tool returns the complete JSON at once, so omit stream or set it to false. For follow-up questions, pass both the question and answer from the previous turn.

Before making an actual call, you can check current pricing and availability on the service page. GLM service · Conversation API · Conversation parameters and response example