alibabacloud.mcp-proxy 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. alibabacloud_mcp_proxy-0.1.4/.gitignore +7 -0
  2. alibabacloud_mcp_proxy-0.1.4/PKG-INFO +237 -0
  3. alibabacloud_mcp_proxy-0.1.4/README-EN.md +213 -0
  4. alibabacloud_mcp_proxy-0.1.4/README-PROXY-EN.md +205 -0
  5. alibabacloud_mcp_proxy-0.1.4/README-PROXY.md +164 -0
  6. alibabacloud_mcp_proxy-0.1.4/README.md +214 -0
  7. alibabacloud_mcp_proxy-0.1.4/publish.sh +107 -0
  8. alibabacloud_mcp_proxy-0.1.4/pyproject.toml +49 -0
  9. alibabacloud_mcp_proxy-0.1.4/src/alibabacloud/mcp_proxy/__init__.py +3 -0
  10. alibabacloud_mcp_proxy-0.1.4/src/alibabacloud/mcp_proxy/__main__.py +5 -0
  11. alibabacloud_mcp_proxy-0.1.4/src/alibabacloud/mcp_proxy/auth/__init__.py +1 -0
  12. alibabacloud_mcp_proxy-0.1.4/src/alibabacloud/mcp_proxy/auth/ims_access_token.py +379 -0
  13. alibabacloud_mcp_proxy-0.1.4/src/alibabacloud/mcp_proxy/auth/token_provider.py +132 -0
  14. alibabacloud_mcp_proxy-0.1.4/src/alibabacloud/mcp_proxy/cli.py +335 -0
  15. alibabacloud_mcp_proxy-0.1.4/src/alibabacloud/mcp_proxy/config.py +204 -0
  16. alibabacloud_mcp_proxy-0.1.4/src/alibabacloud/mcp_proxy/discovery.py +120 -0
  17. alibabacloud_mcp_proxy-0.1.4/src/alibabacloud/mcp_proxy/precheck.py +295 -0
  18. alibabacloud_mcp_proxy-0.1.4/src/alibabacloud/mcp_proxy/proxy/__init__.py +1 -0
  19. alibabacloud_mcp_proxy-0.1.4/src/alibabacloud/mcp_proxy/proxy/server.py +120 -0
  20. alibabacloud_mcp_proxy-0.1.4/src/alibabacloud/mcp_proxy/safety_policy.py +76 -0
  21. alibabacloud_mcp_proxy-0.1.4/src/alibabacloud/mcp_proxy/session/__init__.py +1 -0
  22. alibabacloud_mcp_proxy-0.1.4/src/alibabacloud/mcp_proxy/session/reconnecting_session.py +219 -0
  23. alibabacloud_mcp_proxy-0.1.4/src/alibabacloud/mcp_proxy/transport/__init__.py +1 -0
  24. alibabacloud_mcp_proxy-0.1.4/src/alibabacloud/mcp_proxy/transport/stdio_server.py +13 -0
  25. alibabacloud_mcp_proxy-0.1.4/src/alibabacloud/mcp_proxy/transport/upstream_http.py +237 -0
  26. alibabacloud_mcp_proxy-0.1.4/src/alibabacloud/mcp_proxy/transport/upstream_sse.py +237 -0
  27. alibabacloud_mcp_proxy-0.1.4/tests/test_cli.py +122 -0
  28. alibabacloud_mcp_proxy-0.1.4/tests/test_ims_access_token.py +85 -0
  29. alibabacloud_mcp_proxy-0.1.4/tests/test_reconnecting_session.py +98 -0
  30. alibabacloud_mcp_proxy-0.1.4/tests/test_token_provider.py +91 -0
  31. alibabacloud_mcp_proxy-0.1.4/uv.lock +1259 -0
@@ -0,0 +1,7 @@
1
+ .venv/
2
+ __pycache__/
3
+ .pytest_cache/
4
+ .mypy_cache/
5
+ dist/
6
+ build/
7
+ *.pyc
@@ -0,0 +1,237 @@
1
+ Metadata-Version: 2.4
2
+ Name: alibabacloud.mcp-proxy
3
+ Version: 0.1.4
4
+ Summary: Local stdio MCP proxy for Alibaba Cloud OpenAPI MCP servers.
5
+ Project-URL: Homepage, https://github.com/aliyun/alibabacloud-api-mcp-server
6
+ Project-URL: Repository, https://github.com/aliyun/alibabacloud-api-mcp-server
7
+ Author: Alibaba Cloud
8
+ License-Expression: Apache-2.0
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Topic :: Software Development :: Libraries
15
+ Requires-Python: >=3.13
16
+ Requires-Dist: alibabacloud-credentials>=1.0.8
17
+ Requires-Dist: alibabacloud-openapi-util>=0.2.4
18
+ Requires-Dist: alibabacloud-tea-openapi>=0.4.4
19
+ Requires-Dist: alibabacloud-tea-util>=0.3.14
20
+ Requires-Dist: httpx>=0.28.1
21
+ Requires-Dist: mcp>=1.27.0
22
+ Description-Content-Type: text/markdown
23
+
24
+ # 阿里云 MCP Server 使用指南
25
+
26
+ ## [README of English](README-EN.md)
27
+
28
+ ## 📚 目录
29
+
30
+ - [概述](#概述)
31
+ - [部署模式](#部署模式)
32
+ - [远程模式](#远程模式)
33
+ - [本地模式](#本地模式)
34
+ - [远程模式详解](#远程模式详解)
35
+ - [技术规格](#技术规格)
36
+ - [访问地址](#访问地址)
37
+ - [系统 MCP 服务列表](#系统-mcp-服务列表)
38
+ - [基础设施管理](#基础设施管理)
39
+ - [监控与审计](#监控与审计)
40
+ - [合规与治理](#合规与治理)
41
+ - [核心能力](#核心能力)
42
+ - [OpenAPI 定制化调优](#openapi-定制化调优)
43
+ - [Terraform As Tools](#terraform-as-tools)
44
+ - [多账号支持](#多账号支持)
45
+ - [自定义 OAuth](#自定义-oauth)
46
+ - [本地模式详解](#本地模式详解)
47
+ - [运行机制](#运行机制)
48
+ - [服务列表](#服务列表)
49
+ - [数据库服务](#数据库服务)
50
+ - [数据分析服务](#数据分析服务)
51
+ - [DevOps 服务](#devops-服务)
52
+ - [其他服务](#其他服务)
53
+ - [快速开始](#快速开始)
54
+ - [远程模式接入](#远程模式接入)
55
+ - [通过本地静态凭证接入](#通过本地静态凭证接入)
56
+ - [本地模式部署](#本地模式部署)
57
+ - [参考文档](#参考文档)
58
+
59
+ ## 概述
60
+
61
+ 阿里云 MCP Server 是一个强大的云服务集成平台,通过 Model Context Protocol (MCP) 为 AI 应用提供阿里云服务的无缝集成能力。该平台支持数万个阿里云 OpenAPI,让开发者能够轻松地将阿里云的各种服务能力集成到 AI 工作流中。
62
+
63
+ ## 部署模式
64
+
65
+ ### 远程模式
66
+
67
+ 通过阿里云官方托管的 OpenAPI MCP Server,无需本地部署即可使用全量阿里云服务。适合快速集成、低维护成本的场景。
68
+
69
+ 阿里云现已提供 API MCP Server Core。该模式基于远程 CLI 模式运行,通过个位数的核心 tools 即可编排并触达阿里云全量能力(覆盖数万 OpenAPI)。
70
+
71
+ ### 本地模式
72
+
73
+ 基于 stdio 进程模式,在本地运行 MCP Server。适合对数据安全性要求高、需要自定义配置的场景。
74
+
75
+ ## 远程模式详解
76
+
77
+ ### 技术规格
78
+
79
+ - **核心模式**:API MCP Server Core(远程 CLI 模式)
80
+ - **支持协议**:SSE (Server-Sent Events)、Streamable HTTP
81
+ - **认证方式**:OAuth 2.0
82
+ - **API 数量**:支持阿里云数万个 OpenAPI
83
+ - **部署方式**:云端托管,零运维
84
+
85
+ ### 访问地址
86
+
87
+ | 区域 | 访问地址 | 适用场景 |
88
+ |------|---------|----------|
89
+ | **中国站** | https://api.aliyun.com/mcp | 中国大陆用户 |
90
+ | **国际站** | https://api.alibabacloud.com/mcp | 海外及国际用户 |
91
+
92
+ ### 系统 MCP 服务列表
93
+
94
+ 阿里云官方提供了一系列经过精心调优的系统 MCP 服务,针对特定场景进行了优化:
95
+
96
+ #### 基础设施管理
97
+
98
+ | 服务名称 | 功能描述 |
99
+ |---------|---------|
100
+ | **Terraform Provider** | 提供阿里云 Terraform Provider 元数据,支持在线验证和执行 Terraform 命令的 Runtime 能力 |
101
+ | **配额中心** | 根据云产品名称、配额描述、地域信息等,查询配额中心支持的产品通用配额信息 |
102
+ | **资源搜索** | 支持当前账号下有权限资源的搜索和统计功能 |
103
+
104
+ #### 监控与审计
105
+
106
+ | 服务名称 | 功能描述 |
107
+ |---------|---------|
108
+ | **操作审计 AI** | 使用 AI 根据场景灵活调用操作审计的 LookupEvents 接口 |
109
+ | **权限诊断** | API 请求因无权限被拒绝时,通过 EncodedDiagnosticMessage 进行权限诊断 |
110
+
111
+ #### 合规与治理
112
+
113
+ | 服务名称 | 功能描述 |
114
+ |---------|---------|
115
+ | **治理报告** | 基于 GovernanceReport 的 MCP Server |
116
+ | **配置审计合规包** | 查询合规包模板、启用指定合规包、查询风险项概况及风险资源清单 |
117
+
118
+ ### 核心能力
119
+
120
+ #### OpenAPI 定制化调优
121
+
122
+ - 修改 API 描述,使其更适合 AI 理解
123
+ - 精简非必填参数,降低调用复杂度
124
+ - 优化参数说明,提高 AI 调用准确率
125
+
126
+ #### Terraform As Tools
127
+
128
+ - **HCL 代码集成**:将 Terraform HCL 代码作为完整工具引入
129
+ - **变量自动解析**:Terraform 变量自动转换为工具参数
130
+ - **确定性编排**:实现基础设施的确定性部署和管理
131
+
132
+ #### 多账号支持
133
+
134
+ - **角色扮演**:自动使用角色扮演能力操作特定账号
135
+ - **账号切换**:灵活指定操作账号和扮演角色
136
+ - **集中管理**:轻松实现多账号 AI 集成管理
137
+
138
+ #### 自定义 OAuth
139
+
140
+ - **Callback 白名单**:精确控制回调地址白名单
141
+ - **Token 生命周期**:灵活设置 access token 和 refresh token 过期时间
142
+ - **长期免登录**:最长可实现 1 年免登录
143
+
144
+ ## 本地模式详解
145
+
146
+ ### 运行机制
147
+
148
+ 本地模式基于 stdio 进程通信,MCP Server 作为独立进程在本地运行,通过标准输入输出与 AI 应用进行通信。
149
+
150
+ ### 服务列表
151
+
152
+ #### 数据库服务
153
+
154
+ | 服务 | 仓库地址 | 描述 |
155
+ |------|---------|------|
156
+ | **DMS** | [alibabacloud-dms-mcp-server](https://github.com/aliyun/alibabacloud-dms-mcp-server) | 数据管理服务,提供数据库管理能力 |
157
+ | **RDS** | [alibabacloud-rds-openapi-mcp-server](https://github.com/aliyun/alibabacloud-rds-openapi-mcp-server) | 关系型数据库服务 OpenAPI 集成 |
158
+ | **ADBPG** | [alibabacloud-adbpg-mcp-server](https://github.com/aliyun/alibabacloud-adbpg-mcp-server) | 分析型数据库 PostgreSQL 版 |
159
+
160
+ #### 数据分析服务
161
+
162
+ | 服务 | 仓库地址 | 描述 |
163
+ |------|---------|------|
164
+ | **DataWorks** | [alibabacloud-dataworks-mcp-server](https://github.com/aliyun/alibabacloud-dataworks-mcp-server) | 数据工场,提供大数据开发治理能力 |
165
+
166
+ #### DevOps 服务
167
+
168
+ | 服务 | 仓库地址 | 描述 |
169
+ |------|---------|------|
170
+ | **云效** | [alibabacloud-devops-mcp-server](https://github.com/aliyun/alibabacloud-devops-mcp-server) | 企业级 DevOps 平台集成 |
171
+ | **运维开发** | [alibaba-cloud-ops-mcp-server](https://github.com/aliyun/alibaba-cloud-ops-mcp-server) | 运维开发工具集成 |
172
+
173
+ #### 其他服务
174
+
175
+ | 服务 | 仓库地址 | 描述 |
176
+ |------|---------|------|
177
+ | **ESA** | [mcp-server-esa](https://github.com/aliyun/mcp-server-esa) | 边缘安全加速服务 |
178
+ | **可观测** | [alibabacloud-observability-mcp-server](https://github.com/aliyun/alibabacloud-observability-mcp-server) | 可观测性服务集成 |
179
+
180
+ ## 快速开始
181
+
182
+ ### 远程模式接入
183
+
184
+ 1. **访问控制台**
185
+ - 中国站用户访问:https://api.aliyun.com/mcp
186
+ - 国际站用户访问:https://api.alibabacloud.com/mcp
187
+
188
+ 2. **OAuth 认证**
189
+ - 配置 OAuth 应用
190
+ - 获取 Access Token
191
+ - 配置 Token 刷新策略
192
+
193
+ 3. **选择服务**
194
+ - 浏览系统 MCP 服务
195
+ - 选择需要的 OpenAPI
196
+ - 自定义 API 参数
197
+
198
+ ### 通过本地静态凭证接入
199
+
200
+ 现在阿里云 API MCP Server 可以通过本地静态凭证直接登录。你可以在本地配置阿里云 AccessKey 或已有凭证文件,然后通过 Alibaba Cloud MCP Proxy 自动换取访问 OpenAPI MCP Server 所需的令牌,无需在 MCP 客户端中手动维护 OAuth Token。
201
+
202
+ 代理工具的安装、MCP 客户端配置、安全策略和预检查说明请参考:[Alibaba Cloud MCP Proxy 使用说明](README-PROXY.md)。
203
+
204
+ ### 本地模式部署
205
+
206
+ 1. **克隆仓库**
207
+ ```bash
208
+ git clone https://github.com/aliyun/[具体服务仓库名称]
209
+ cd [仓库目录]
210
+ ```
211
+
212
+ 2. **安装依赖**
213
+ ```bash
214
+ npm install # 或 yarn install
215
+ ```
216
+
217
+ 3. **配置认证**
218
+ ```bash
219
+ export ALIBABA_CLOUD_ACCESS_KEY_ID=your_access_key
220
+ export ALIBABA_CLOUD_ACCESS_KEY_SECRET=your_secret_key
221
+ ```
222
+
223
+ 4. **启动服务**
224
+ ```bash
225
+ npm start # 或按照具体仓库的启动说明
226
+ ```
227
+
228
+ ## 参考文档
229
+
230
+ - 📖 **官方文档**:[OpenAPI MCP Server 使用指南](https://help.aliyun.com/zh/openapi/user-guide/openapi-mcp-server-guide)
231
+ - 🔧 **技术支持**:通过阿里云工单系统或官方论坛获取技术支持
232
+ - 💬 **社区交流**:加入阿里云开发者社区参与讨论,钉钉群:136325002292
233
+ - 通过AgentScope使用示例<https://github.com/agentscope-ai/agentscope/tree/main/examples/alibabacloud_api_mcp>
234
+
235
+ ---
236
+
237
+ *本文档持续更新中,欢迎提交 Issue 或 PR 贡献内容*
@@ -0,0 +1,213 @@
1
+ # Alibaba Cloud MCP Server User Guide
2
+
3
+ ## [README of Chinese](README.md)
4
+
5
+ ## 📚 Table of Contents
6
+
7
+ - [Overview](#overview)
8
+ - [Deployment Modes](#deployment-modes)
9
+ - [Remote Mode](#remote-mode)
10
+ - [Local Mode](#local-mode)
11
+ - [Remote Mode Details](#remote-mode-details)
12
+ - [Technical Specifications](#technical-specifications)
13
+ - [Access Endpoints](#access-endpoints)
14
+ - [System MCP Service List](#system-mcp-service-list)
15
+ - [Infrastructure Management](#infrastructure-management)
16
+ - [Monitoring & Auditing](#monitoring--auditing)
17
+ - [Compliance & Governance](#compliance--governance)
18
+ - [Core Capabilities](#core-capabilities)
19
+ - [OpenAPI Customization & Optimization](#openapi-customization--optimization)
20
+ - [Terraform As Tools](#terraform-as-tools)
21
+ - [Multi-Account Support](#multi-account-support)
22
+ - [Custom OAuth](#custom-oauth)
23
+ - [Local Mode Details](#local-mode-details)
24
+ - [Operating Mechanism](#operating-mechanism)
25
+ - [Service List](#service-list)
26
+ - [Database Services](#database-services)
27
+ - [Data Analytics Services](#data-analytics-services)
28
+ - [DevOps Services](#devops-services)
29
+ - [Other Services](#other-services)
30
+ - [Quick Start](#quick-start)
31
+ - [Remote Mode Access](#remote-mode-access)
32
+ - [Access with Local Static Credentials](#access-with-local-static-credentials)
33
+ - [Local Mode Deployment](#local-mode-deployment)
34
+ - [Reference Documentation](#reference-documentation)
35
+
36
+ ## Overview
37
+
38
+ Alibaba Cloud MCP Server is a powerful cloud service integration platform that provides seamless integration capabilities for Alibaba Cloud services to AI applications through the Model Context Protocol (MCP). The platform supports tens of thousands of Alibaba Cloud OpenAPIs, enabling developers to easily integrate various Alibaba Cloud service capabilities into AI workflows.
39
+
40
+ ## Deployment Modes
41
+
42
+ ### Remote Mode
43
+
44
+ Use the full range of Alibaba Cloud services through the officially hosted Alibaba Cloud OpenAPI MCP Server without local deployment. Suitable for scenarios requiring rapid integration and low maintenance costs.
45
+
46
+ Alibaba Cloud now provides API MCP Server Core. This mode follows a remote CLI pattern, enabling orchestration of the full Alibaba Cloud capability surface with a single-digit number of core tools (covering tens of thousands of OpenAPIs).
47
+
48
+ ### Local Mode
49
+
50
+ Based on stdio process mode, running MCP Server locally. Suitable for scenarios with high data security requirements and need for custom configuration.
51
+
52
+ ## Remote Mode Details
53
+
54
+ ### Technical Specifications
55
+
56
+ - **Core Mode**: API MCP Server Core (remote CLI mode)
57
+ - **Supported Protocols**: SSE (Server-Sent Events), Streamable HTTP
58
+ - **Authentication Method**: OAuth 2.0
59
+ - **API Count**: Supports tens of thousands of Alibaba Cloud OpenAPIs
60
+ - **Deployment Method**: Cloud-hosted, zero maintenance
61
+
62
+ ### Access Endpoints
63
+
64
+ | Region | Access Endpoint | Applicable Scenarios |
65
+ |--------|----------------|---------------------|
66
+ | **China Site** | https://api.aliyun.com/mcp | Users in mainland China |
67
+ | **International Site** | https://api.alibabacloud.com/mcp | Overseas and international users |
68
+
69
+ ### System MCP Service List
70
+
71
+ Alibaba Cloud officially provides a series of carefully optimized system MCP services, optimized for specific scenarios:
72
+
73
+ #### Infrastructure Management
74
+
75
+ | Service Name | Function Description |
76
+ |-------------|---------------------|
77
+ | **Terraform Provider** | Provides Alibaba Cloud Terraform Provider metadata, supports online validation and runtime capabilities for executing Terraform commands |
78
+ | **Quota Center** | Query general quota information for products supported by the Quota Center based on cloud product name, quota description, regional information, etc. |
79
+ | **Resource Search** | Supports search and statistics functions for resources with permissions under the current account |
80
+
81
+ #### Monitoring & Auditing
82
+
83
+ | Service Name | Function Description |
84
+ |-------------|---------------------|
85
+ | **ActionTrail AI** | Uses AI to flexibly call the ActionTrail LookupEvents interface based on scenarios |
86
+ | **Permission Diagnostics** | When API requests are rejected due to lack of permissions, perform permission diagnosis through EncodedDiagnosticMessage |
87
+
88
+ #### Compliance & Governance
89
+
90
+ | Service Name | Function Description |
91
+ |-------------|---------------------|
92
+ | **Governance Report** | MCP Server based on GovernanceReport |
93
+ | **Config Compliance Pack** | Query compliance pack templates, enable specified compliance packs, query risk overview and risk resource inventory |
94
+
95
+ ### Core Capabilities
96
+
97
+ #### OpenAPI Customization & Optimization
98
+
99
+ - Modify API descriptions to make them more suitable for AI understanding
100
+ - Simplify non-required parameters to reduce calling complexity
101
+ - Optimize parameter descriptions to improve AI calling accuracy
102
+
103
+ #### Terraform As Tools
104
+
105
+ - **HCL Code Integration**: Introduce Terraform HCL code as complete tools
106
+ - **Automatic Variable Parsing**: Terraform variables automatically convert to tool parameters
107
+ - **Deterministic Orchestration**: Achieve deterministic deployment and management of infrastructure
108
+
109
+ #### Multi-Account Support
110
+
111
+ - **Role Assumption**: Automatically use role assumption capabilities to operate specific accounts
112
+ - **Account Switching**: Flexibly specify operation accounts and assumed roles
113
+ - **Centralized Management**: Easily achieve multi-account AI integrated management
114
+
115
+ #### Custom OAuth
116
+
117
+ - **Callback Whitelist**: Precisely control callback address whitelist
118
+ - **Token Lifecycle**: Flexibly set access token and refresh token expiration times
119
+ - **Long-term Login-free**: Achieve up to 1 year of login-free operation
120
+
121
+ ## Local Mode Details
122
+
123
+ ### Operating Mechanism
124
+
125
+ Local mode is based on stdio process communication, with MCP Server running as an independent process locally, communicating with AI applications through standard input/output.
126
+
127
+ ### Service List
128
+
129
+ #### Database Services
130
+
131
+ | Service | Repository URL | Description |
132
+ |---------|---------------|-------------|
133
+ | **DMS** | [alibabacloud-dms-mcp-server](https://github.com/aliyun/alibabacloud-dms-mcp-server) | Data Management Service, provides database management capabilities |
134
+ | **RDS** | [alibabacloud-rds-openapi-mcp-server](https://github.com/aliyun/alibabacloud-rds-openapi-mcp-server) | Relational Database Service OpenAPI integration |
135
+ | **ADBPG** | [alibabacloud-adbpg-mcp-server](https://github.com/aliyun/alibabacloud-adbpg-mcp-server) | AnalyticDB for PostgreSQL |
136
+
137
+ #### Data Analytics Services
138
+
139
+ | Service | Repository URL | Description |
140
+ |---------|---------------|-------------|
141
+ | **DataWorks** | [alibabacloud-dataworks-mcp-server](https://github.com/aliyun/alibabacloud-dataworks-mcp-server) | Data Factory, provides big data development and governance capabilities |
142
+
143
+ #### DevOps Services
144
+
145
+ | Service | Repository URL | Description |
146
+ |---------|---------------|-------------|
147
+ | **Apsara DevOps** | [alibabacloud-devops-mcp-server](https://github.com/aliyun/alibabacloud-devops-mcp-server) | Enterprise-level DevOps platform integration |
148
+ | **Operations Development** | [alibaba-cloud-ops-mcp-server](https://github.com/aliyun/alibaba-cloud-ops-mcp-server) | Operations development tools integration |
149
+
150
+ #### Other Services
151
+
152
+ | Service | Repository URL | Description |
153
+ |---------|---------------|-------------|
154
+ | **ESA** | [mcp-server-esa](https://github.com/aliyun/mcp-server-esa) | Edge Security Acceleration service |
155
+ | **Observability** | [alibabacloud-observability-mcp-server](https://github.com/aliyun/alibabacloud-observability-mcp-server) | Observability service integration |
156
+
157
+ ## Quick Start
158
+
159
+ ### Remote Mode Access
160
+
161
+ 1. **Access Console**
162
+ - China Site users visit: https://api.aliyun.com/mcp
163
+ - International Site users visit: https://api.alibabacloud.com/mcp
164
+
165
+ 2. **OAuth Authentication**
166
+ - Configure OAuth application
167
+ - Obtain Access Token
168
+ - Configure Token refresh strategy
169
+
170
+ 3. **Select Services**
171
+ - Browse system MCP services
172
+ - Select required OpenAPI
173
+ - Customize API parameters
174
+
175
+ ### Access with Local Static Credentials
176
+
177
+ Alibaba Cloud API MCP Server now supports direct login through local static credentials. You can configure an Alibaba Cloud AccessKey or an existing local credential profile, then use Alibaba Cloud MCP Proxy to automatically exchange it for the token required by OpenAPI MCP Server. This removes the need to manually maintain OAuth tokens in MCP client configuration.
178
+
179
+ For proxy installation, MCP client configuration, safety policies, and pre-check usage, see: [Alibaba Cloud MCP Proxy User Guide](README-PROXY-EN.md).
180
+
181
+ ### Local Mode Deployment
182
+
183
+ 1. **Clone Repository**
184
+ ```bash
185
+ git clone https://github.com/aliyun/[specific-service-repository-name]
186
+ cd [repository-directory]
187
+ ```
188
+
189
+ 2. **Install Dependencies**
190
+ ```bash
191
+ npm install # or yarn install
192
+ ```
193
+
194
+ 3. **Configure Authentication**
195
+ ```bash
196
+ export ALIBABA_CLOUD_ACCESS_KEY_ID=your_access_key
197
+ export ALIBABA_CLOUD_ACCESS_KEY_SECRET=your_secret_key
198
+ ```
199
+
200
+ 4. **Start Service**
201
+ ```bash
202
+ npm start # or follow the specific repository's startup instructions
203
+ ```
204
+
205
+ ## Reference Documentation
206
+
207
+ - 📖 **Official Documentation**: [OpenAPI MCP Server User Guide](https://www.alibabacloud.com/help/en/openapi/user-guide/openapi-mcp-server-guide)
208
+ - 🔧 **Technical Support**: Get technical support through Alibaba Cloud ticket system or official forums
209
+ - 💬 **Community Exchange**: Join the Alibaba Cloud Developer Community for discussions, DingTalk Group: 136325002292
210
+
211
+ ---
212
+
213
+ *This document is continuously updated. Welcome to submit Issues or PRs to contribute content*
@@ -0,0 +1,205 @@
1
+ ## Alibaba Cloud MCP Proxy
2
+
3
+ A local stdio MCP (Model Context Protocol) proxy for Alibaba Cloud OpenAPI MCP servers. It bridges MCP clients (such as Claude Desktop, Cursor, or other AI-powered IDEs) with Alibaba Cloud's upstream MCP services, handling authentication, connection management, retries, and safety policies transparently.
4
+
5
+ ### Prerequisites
6
+
7
+ The RAM user or role running the proxy **must** have the following permissions. Attach this policy in the [RAM Console](https://ram.console.aliyun.com/):
8
+
9
+ Alibaba Cloud provides a built-in system policy named `AliyunOpenAPIMCPServerStaticCredentialAccess` (full Access policy for static-credential connection).
10
+
11
+ ```json
12
+ {
13
+ "Version": "1",
14
+ "Statement": [
15
+ {
16
+ "Effect": "Allow",
17
+ "Action": "ram:GenerateAccessToken",
18
+ "Resource": "*"
19
+ },
20
+ {
21
+ "Effect": "Allow",
22
+ "Action": "openapiexplorer:*",
23
+ "Resource": "*"
24
+ }
25
+ ]
26
+ }
27
+ ```
28
+
29
+ - **`ram:GenerateAccessToken`** — Required for the proxy to obtain bearer tokens via IMS.
30
+ - **`openapiexplorer:*`** — Required for MCP server discovery and tool invocation.
31
+
32
+ ### Quick Start
33
+
34
+ Run the proxy with `uvx` (always fetches the latest version, no install needed):
35
+
36
+ ```bash
37
+ uvx alibabacloud.mcp-proxy@latest
38
+ ```
39
+
40
+ If you have a custom MCP server URL, you can specify it explicitly:
41
+
42
+ ```bash
43
+ uvx alibabacloud.mcp-proxy@latest --server-url <YOUR_MCP_SERVER_URL>
44
+ ```
45
+
46
+ #### MCP Client Configuration (Claude Desktop / Cursor)
47
+
48
+ Add the following to your MCP client configuration file (e.g. `claude_desktop_config.json`):
49
+
50
+ ```json
51
+ {
52
+ "mcpServers": {
53
+ "alibabacloud": {
54
+ "command": "uvx",
55
+ "args": ["alibabacloud.mcp-proxy@latest"]
56
+ }
57
+ }
58
+ }
59
+ ```
60
+
61
+ The proxy reads local Alibaba Cloud static credentials and automatically exchanges them for the access token required by the upstream OpenAPI MCP Server.
62
+
63
+ ### Local Static Credential Login
64
+
65
+ Alibaba Cloud API MCP Server now supports direct login through local static credentials. You can configure credentials with Alibaba Cloud CLI or environment variables, and MCP Proxy will read them locally and call IMS `GenerateAccessToken` to obtain a Bearer Token. This removes the need to manually manage OAuth tokens in MCP client configuration.
66
+
67
+ Common environment variable configuration:
68
+
69
+ ```bash
70
+ export ALIBABA_CLOUD_ACCESS_KEY_ID=your_access_key_id
71
+ export ALIBABA_CLOUD_ACCESS_KEY_SECRET=your_access_key_secret
72
+ uvx alibabacloud.mcp-proxy@latest
73
+ ```
74
+
75
+ ### Debugging
76
+
77
+ To enable debug logging, use `--debug` together with `--log-file` to write detailed logs to a file:
78
+
79
+ ```bash
80
+ uvx alibabacloud.mcp-proxy@latest --debug --log-file=/tmp/a.log --safety-policy "ecs:describe-*=allow,*=deny"
81
+ ```
82
+
83
+ ### Safety Policy
84
+
85
+ You can constrain which MCP tools the proxy is allowed to invoke by specifying a **safety policy**. This is applied to the bearer token before connecting to the upstream MCP server, ensuring the token is scoped to only the allowed tool calls.
86
+
87
+ #### Example: Allow only ECS describe operations
88
+
89
+ ```bash
90
+ uvx alibabacloud.mcp-proxy@latest --safety-policy "ecs:describe-*=allow,*=deny"
91
+ ```
92
+
93
+ #### MCP Client Configuration with Safety Policy
94
+
95
+ ```json
96
+ {
97
+ "mcpServers": {
98
+ "alibabacloud": {
99
+ "command": "uvx",
100
+ "args": [
101
+ "alibabacloud.mcp-proxy@latest",
102
+ "--safety-policy", "ecs:describe-*=allow,*=deny"
103
+ ]
104
+ }
105
+ }
106
+ }
107
+ ```
108
+
109
+ You can also set the safety policy via environment variable:
110
+
111
+ ```bash
112
+ export ALIBABACLOUD_MCP_SAFETY_POLICY="ecs:describe-*=allow,*=deny"
113
+ uvx alibabacloud.mcp-proxy@latest
114
+ ```
115
+
116
+ ### Pre-check
117
+
118
+ Before connecting to the upstream MCP server, you can verify that your local OAuth application is properly installed and authorized by running the **pre-check** command. This starts a lightweight local HTTP server, opens your browser to the Alibaba Cloud OAuth authorization page, and waits for the callback.
119
+
120
+ ```bash
121
+ uvx alibabacloud.mcp-proxy@latest pre-check
122
+ ```
123
+
124
+ For international sites:
125
+
126
+ ```bash
127
+ uvx alibabacloud.mcp-proxy@latest pre-check --site-type INTL
128
+ ```
129
+
130
+ With a custom OAuth client ID:
131
+
132
+ ```bash
133
+ uvx alibabacloud.mcp-proxy@latest pre-check --client-id YOUR_OAUTH_CLIENT_ID
134
+ ```
135
+
136
+ If the pre-check passes, you will see:
137
+
138
+ ```
139
+ ✓ Pre-check passed! You can connect via local static credentials.
140
+ ```
141
+
142
+ ### Configuration Reference
143
+
144
+ Every CLI flag has a corresponding environment variable. **CLI flags take precedence** over environment variables.
145
+
146
+ #### Connection Settings
147
+
148
+ | CLI Flag | Environment Variable | Default | Description |
149
+ |---|---|---|---|
150
+ | `--server-url` | `ALIBABACLOUD_MCP_SERVER_URL` | *(auto-discover)* | Upstream Alibaba Cloud MCP streamable HTTP URL. If not set, the proxy discovers it via the `ListApiMcpServerCores` OpenAPI. |
151
+ | `--site-type` | `ALIBABACLOUD_MCP_SITE_TYPE` | `CN` | Alibaba Cloud site type: `CN` (China) or `INTL` (International). |
152
+ | `--connect-timeout` | `ALIBABACLOUD_MCP_CONNECT_TIMEOUT` | `10.0` | HTTP connect timeout in seconds. |
153
+ | `--read-timeout` | `ALIBABACLOUD_MCP_READ_TIMEOUT` | `120.0` | HTTP read timeout in seconds. |
154
+
155
+ #### Authentication Settings
156
+
157
+ | CLI Flag | Environment Variable | Default | Description |
158
+ |---|---|---|---|
159
+ | `--bearer-token` | `ALIBABACLOUD_MCP_BEARER_TOKEN` | — | Explicit bearer token for the upstream MCP server. |
160
+ | `--token-command` | `ALIBABACLOUD_MCP_TOKEN_COMMAND` | — | Shell command that prints a bearer token or JSON with `access_token`. |
161
+ | `--client-id` | `ALIBABACLOUD_MCP_CLIENT_ID` | *(per site type)* | IMS `GenerateAccessToken` ClientId. Defaults to `4071151845732613353` (CN) or `4195410055503316452` (INTL). |
162
+ | `--scope` | `ALIBABACLOUD_MCP_SCOPE` | `/internal/acs/openapi` | IMS `GenerateAccessToken` Scope. |
163
+ | `--ims-endpoint` | `ALIBABACLOUD_MCP_IMS_ENDPOINT` | `ramoauth.aliyuncs.com` (CN) / `ramoauth.alibabacloudcs.com` (INTL) | IMS API endpoint hostname. Auto-selected based on `--site-type`. |
164
+
165
+ #### Safety Policy
166
+
167
+ | CLI Flag | Environment Variable | Default | Description |
168
+ |---|---|---|---|
169
+ | `--safety-policy` | `ALIBABACLOUD_MCP_SAFETY_POLICY` | — | Safety policy expression to constrain allowed MCP tool calls (e.g. `ecs:describe-*=allow,*=deny`). Applied to the bearer token before connecting. |
170
+
171
+ #### Retry Settings
172
+
173
+ | CLI Flag | Environment Variable | Default | Description |
174
+ |---|---|---|---|
175
+ | `--retry-max-attempts` | `ALIBABACLOUD_MCP_RETRY_MAX_ATTEMPTS` | `3` | Maximum attempts per upstream request before surfacing an error. |
176
+ | `--retry-base-seconds` | `ALIBABACLOUD_MCP_RETRY_BASE_SECONDS` | `1.0` | Initial retry delay in seconds (exponential backoff). |
177
+ | `--retry-max-seconds` | `ALIBABACLOUD_MCP_RETRY_MAX_SECONDS` | `8.0` | Maximum retry delay in seconds. |
178
+
179
+ #### Token Refresh
180
+
181
+ | CLI Flag | Environment Variable | Default | Description |
182
+ |---|---|---|---|
183
+ | — | `ALIBABACLOUD_MCP_REFRESH_SKEW_SECONDS` | `60` | Seconds before token expiry to trigger a proactive refresh. |
184
+
185
+ #### Debug / Logging
186
+
187
+ | CLI Flag | Environment Variable | Default | Description |
188
+ |---|---|---|---|
189
+ | `--debug` | `ALIBABACLOUD_MCP_DEBUG` | `false` | Enable debug logging. Requires `--log-file` to be set. |
190
+ | `--log-file` | `ALIBABACLOUD_MCP_LOG_FILE` | — | Path to the log file. Required when `--debug` is enabled. |
191
+
192
+ #### Pre-check Sub-command
193
+
194
+ | CLI Flag | Default | Description |
195
+ |---|---|---|
196
+ | `--site-type` | `CN` | Alibaba Cloud site type: `CN` or `INTL`. |
197
+ | `--client-id` | *(per site type)* | Custom OAuth application Client ID for the pre-check flow. |
198
+
199
+ ### Requirements
200
+
201
+ - Python >= 3.13
202
+
203
+ ### License
204
+
205
+ Apache-2.0