Set up the remote MCMCP Server

更新时间:
复制 MD 格式

This document explains how users and MCP client integrators can connect to the MaxCompute Remote MCP Server, covering the process from client configuration to tool execution.

Important

For security, review and follow the security precautions before you begin.

Supported regions

Choose an endpoint based on your client's network environment.

Use the same endpoint domain for the initial connection, OAuth authorization, and all subsequent calls. Do not mix public and VPC domains during the authorization process.

Public endpoint

Public MCP endpoints are available in specific service regions. The currently available regions are listed below:

Region type

Service region

MCP endpoint

Chinese mainland public cloud

cn-hangzhou

https://mcp.cn-hangzhou.maxcompute.aliyun.com/mcp

Hong Kong and overseas

Not available

-

Financial cloud

Not available

-

Government cloud

Not available

-

To access a project in a non-default region, specify the region in your prompt. For example: "Show me the tables in the cn-shanghai region for project <project>."

If a region is not listed under 'Service region', a public MCP endpoint is not yet available for it. Do not attempt to construct the domain name manually.

VPC endpoint

Region type

Service region

MCP endpoint

Chinese mainland public cloud

cn-hangzhou

https://mcp.cn-hangzhou-vpc.maxcompute.aliyun-inc.com/mcp

If you do not specify a region in a prompt or tool argument, the service defaults to the region of your current endpoint connection. For example, if you connect to the cn-hangzhou endpoint, the default region is cn-hangzhou.

Prerequisites

  • Access to the endpoint domains listed above.

  • An MCP client that supports MCP Streamable HTTP and browser-based OAuth authorization.

  • An Alibaba Cloud account with access permissions for MaxCompute.

Limitations

  • Permission scope: The projects, schemas, tables, and instances you can access are determined by your MaxCompute and RAM permissions.

  • IP whitelist: The Remote MCP Server does not support connections to MaxCompute projects that have an IP whitelist configured. Tool calls to such projects may fail.

  • Write operation confirmation: Users must explicitly confirm write operations in the client. The gateway does not offer a secondary confirmation prompt.

Client configuration

Although configuration fields differ between MCP clients, the principle is the same: set the MCP server URL to your chosen endpoint address. The example below uses a public endpoint. For a VPC environment, replace the URL with the corresponding VPC service address from the Supported regions table.

The general configuration format is as follows.

{
  "mcpServers": {
    "maxcompute-mcp": {
      "type": "streamable-http",
      "url": "https://mcp.cn-hangzhou.maxcompute.aliyun.com/mcp"
    }
  }
}

If your client uses field names like endpoint, server_url, or transport, follow your client's documentation. The URL should still be the service address from the table above, ending in /mcp.

Claude Code

Add the HTTP MCP server from the command line:

claude mcp add --transport http --scope user maxcompute-mcp \
  https://mcp.cn-hangzhou.maxcompute.aliyun.com/mcp

After adding the server, you can check the connection status:

claude mcp list
claude mcp login maxcompute-mcp

You can also type /mcp in a Claude Code session to view the status and trigger the login. If you want to use this configuration only for the current project, change --scope user to --scope local or use a project scope as required by your team.

Codex

Add the Streamable HTTP MCP server from the command line:

codex mcp add maxcompute-mcp \
  --url https://mcp.cn-hangzhou.maxcompute.aliyun.com/mcp

After adding the server, list the services and initiate the login:

codex mcp list
codex mcp login maxcompute-mcp

If you need to configure it manually, add the following to ~/.codex/config.toml:

[mcp_servers."maxcompute-mcp"]
url = "https://mcp.cn-hangzhou.maxcompute.aliyun.com/mcp"

Qwen Code

Add the HTTP MCP server from the command line:

qwen mcp add --transport http --scope user maxcompute-mcp \
  https://mcp.cn-hangzhou.maxcompute.aliyun.com/mcp

If your client distribution uses a different command name, replace qwen in the command above with the actual command name. After adding the server, start Qwen Code and type /mcp in a session to check the connection status and available tools. You can also add the configuration manually to ~/.qwen/settings.json:

{
  "mcpServers": {
    "maxcompute-mcp": {
      "httpUrl": "https://mcp.cn-hangzhou.maxcompute.aliyun.com/mcp"
    }
  }
}

If the file already contains other configurations, merge the mcpServers section without overwriting existing settings.
Unless required by your client or enterprise environment, you do not need to manually configure the Authorization header. The initial connection initiates the OAuth authorization process to handle login.

Initial connection and OAuth authorization

When you first connect, the MCP client automatically starts the OAuth authorization process and opens the Alibaba Cloud authorization page in your browser.

Authorization process

1. In the MCP Client, add a MaxCompute MCP Server and initiate a connection. This action is required when you connect to /mcp for the first time or call tools/list / tool for the first time.

2. When a login is required, the client automatically opens your browser to the Alibaba Cloud OAuth page.

3. Verify that the account and authorization details on the page are correct, then click Agree or Authorize.

4. Once the browser completes the callback, the client saves the token and automatically reconnects to the MCP service. You typically will not need to authorize again during the session.

Precautions

  • Verify the page origin: The OAuth page must be from an official Alibaba Cloud domain. If the domain, account, or authorization information looks suspicious, do not proceed.

  • Use the correct account: Use the Alibaba Cloud account with the required permissions for the target MaxCompute data, as your accessible projects and tables are tied to this account. Switching accounts will change the results.

  • Protect sensitive information: Do not share your access token, refresh token, authorization code, or any parameters from the callback URL with anyone.

Verify connectivity

After authorization, verify the connection by following these steps.

  1. First, list the available tools in your client:

    tools/list
  2. Call the health check tool:

    {
      "name": "maxcompute_health_ping",
      "arguments": {}
    }
  3. On success, the returned structuredContent should contain:

    {
      "ok": true,
      "data": {
        "pong": true
      }
    }
  4. Next, list the MaxCompute projects visible to the current account:

    {
      "name": "maxcompute_schema_list_projects",
      "arguments": {
        "limit": 10
      }
    }

    If this step returns an empty list or a permission error, verify that your Alibaba Cloud account has the necessary permissions for the target MaxCompute project.

Tool capability list

You typically do not need to fill in tool parameters manually. Instead, you can describe your goal in natural language.

The following table lists the MaxCompute tools to illustrate the scope of capabilities. However, the definitive list of tools available to your client is returned by tools/list.

Capability

Tool

Connection check

maxcompute_health_ping

View projects and schemas

maxcompute_schema_list_projects, maxcompute_schema_get_project, maxcompute_schema_list_schemas, maxcompute_schema_get_schema

Table and partition metadata

maxcompute_schema_search_metadata, maxcompute_schema_list_tables, maxcompute_schema_describe_table, maxcompute_schema_list_partitions, maxcompute_schema_get_latest_partition, maxcompute_schema_get_table_ddl

SQL execution and job management

maxcompute_sql_validate, maxcompute_sql_estimate_cost, maxcompute_sql_execute, maxcompute_sql_get_status, maxcompute_sql_fetch_result, maxcompute_sql_cancel, maxcompute_sql_get_logview, maxcompute_sql_list_instances, maxcompute_sql_list_queueing

Account and permission check

maxcompute_access_check

Write and metadata change

maxcompute_schema_create_table, maxcompute_schema_update_table, maxcompute_table_insert_values

For 2-tier MaxCompute projects, you can typically omit the schema. For 3-tier models, you must pass the appropriate schema based on the target object or SQL execution context.

Common prompt examples

You can start with prompts like the ones below. The agent selects the appropriate MCP tool based on your intent.

  • "Check if the MaxCompute MCP login was successful."

  • "List the MaxCompute projects my current account can access."

  • "Show the tables in the cn-shanghai region's project <project>, prioritizing tables with orders in their names."

  • "Describe the columns, partitions, and comments for the table <project>.<table>."

  • "Get the table creation DDL for <project>.<table>."

  • "Help me validate if this SQL is a read-only query and estimate its execution cost: SELECT ...."

  • "Execute this read-only SQL in the <project> project and return only the first 100 rows: SELECT ... LIMIT 100."

  • "Check the running status of the SQL instance <instance_id>."

  • "Read the results of the SQL instance <instance_id>, paginated by 100 rows."

  • "Get the Logview for the SQL instance <instance_id>."

  • "Cancel the SQL instance <instance_id>."

  • "Check my identity and permissions for the <project> project, without expanding all authorization details."

Have the agent validate your SQL or explain the plan before you run queries that may consume significant resources.

Response format

Tool call results are returned in the structuredContent field. A successful result typically looks like this:

{
  "ok": true,
  "data": {},
  "error": null,
  "request_id": "...",
  "warnings": [],
  "citations": [],
  "metadata": {},
  "next_cursor": null
}

Troubleshooting

A failed operation typically returns ok: false with an error object. Common issues and solutions are listed below.

Symptom

Solution

Login required on initial connection

Complete the authorization on the Alibaba Cloud OAuth page in your browser.

OAuth page does not appear

  • Check if your client supports MCP OAuth.

  • Check if your browser or callback port is being blocked.

401 / Unauthorized

  • Authorize again.

  • Check if the token saved by the client has expired or been cleared.

403 / Permission denied

Switch to an Alibaba Cloud account with the required permissions, or grant the necessary permissions in MaxCompute or RAM.

Authorization succeeds but project or table access fails

Check whether the target project has an IP whitelist configured. The Remote MCP Server does not currently support this access scenario.

A specific tool is missing from the tools/list response

  • Confirm that your client is connected to the correct endpoint.

  • The definitive list of available tools is what tools/list returns.

SQL query is rejected as a write operation

Use mode: "write" and ensure the user provides confirmation on the client side first.

Query result is too large

Use LIMIT, pagination parameters like limit or cursor, or narrow the scope of your query.

Region does not match expectations

Explicitly pass a supported region in the tool parameters. See the list of supported regions above.

When troubleshooting, record the request_id, tool name, timestamp, and a sanitized error code. Do not record or share tokens, authorization codes, sensitive business data in SQL queries, sensitive account information, or any Logview content.

Security precautions

  • Use a trusted client

    Configure and access production endpoints only through a trusted MCP client. Do not initiate MCP requests from untrusted pages.

  • Complete OAuth authorization yourself

    You must complete the OAuth confirmation yourself.

  • Use an account with the minimum required permissions

    Use an account that has only the permissions you need, as MCP access to MaxCompute resources is determined by account permissions.

  • Do not disclose sensitive credentials

    Do not disclose access tokens, refresh tokens, authorization codes, secret keys, or callback URLs in chats, support tickets, documents, or screenshots.

  • Explicitly confirm write operations

    Before execution, verify the target project, table, SQL, or a summary of the changes displayed in the client. Proceed only after confirming the details are correct.