> Source: https://ashareapi.com/en/docs/guides/alibaba-bailian-mcp/  ·  Markdown version for LLMs / AI agents

Guides

# Using ashareapi MCP in Alibaba Cloud Bailian
 Connect the A-share data MCP inside Alibaba Cloud Bailian with a single endpoint registration: no code, no deployment, and no Function Compute charges.

## Step 1: create a custom MCP service
 Alibaba Cloud Bailian console -> Managed Agent -> MCP -> Custom -> Create MCP Service, then choose Script deployment.
 Set the install method to `http`: this only registers an existing endpoint. Nothing is deployed in Alibaba Cloud and no Function Compute charges apply.

 MCP service config (JSON)
```
{
 "mcpServers": {
 "ashareapi": {
 "type": "streamableHttp",
 "url": "https://api.ashareapi.com/mcp",
 "headers": {
 "Authorization": "Bearer ct-your-key"
 }
 }
 }
}
```

-
 Use `streamableHttp` (sse is also accepted; streamableHttp is recommended)

-
 Auth is `Authorization: Bearer ct-...`, not `X-API-KEY`

-
 Without headers you can still connect, but only the 6 free tools work

## Step 2: verify
 Open the service page -> Tools. You should see 94 tools. Test one free tool:

 Tool test (free, no key)
```
Tool: ashare_quote
Arguments: {"code": "sh600519"}
```

-
 A response with `last` (price), `amount` (CNY) and `turnover` (percent) means it works

-
 `date` is the data date; it does not change on market holidays

## Step 3: use it in an agent or workflow
 Open the agent or workflow -> add MCP service -> pick the one you created -> enable the tools you need.

-
 Quotes only: enable `ashare_quote` / `ashare_kline`

-
 Financials, money flow, Dragon-Tiger, screening: add your key in headers (from CNY 9.9)

-
 Ask directly: what is 600519 trading at, or which stocks saw the largest main-fund inflow today

## What you can query
 94 tools cover quotes and K-lines, financial statements, money flow, Dragon-Tiger lists, L2 order flow, technical indicators, shareholders and chip distribution, sectors and indices, factor screening, backtests, limit-up review, call auction, ETFs and convertible bonds, futures and forex, filings and research.
 Six tools need no key: quote, kline, hot, market overview, breadth, documentation search.

## FAQ
 Can I use it without a key?
 Yes, 6 free tools work; the other 88 need a key in the Authorization header.

 Will I be charged for Function Compute?
 No. The http install method only registers an endpoint; nothing is deployed.

 What about 401 or 429?
 401 means a missing or invalid key; 429 means rate limited (anonymous limits are tight). Add a valid key or slow down.

 Can I publish it to the Bailian MCP marketplace?
 That is a separate route: Alibaba Cloud Marketplace OneKey MCP, which requires a partner account, SPI and metering integration, and is invite-only.

 streamableHttp or sse?
 Use streamableHttp; sse is supported for compatibility only.

 Last updated: 2026-11-29
 Checked against the official Alibaba Cloud Bailian docs (2026-11-29). Tool count (94) and free tools (6) match the live server.

 Next

-
[MCP setup](/en/mcp)

-
[Endpoint list (102)](/en/endpoints)

-
[Claude Code / Codex MCP setup](/en/docs/guides/mcp-claude-code)

 [← All tutorials](/en/docs/guides)
