From 0a4c90adf00bf900b625568e0cb63aea9bdbc7f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=B3=BD=E6=96=87?= Date: Mon, 4 Aug 2025 15:33:15 +0800 Subject: [PATCH] fix: tablestore-openmemory-mcp --- .DS_Store | Bin 0 -> 12292 bytes start-mcp-markitdown/src/.DS_Store | Bin 0 -> 6148 bytes start-mcp-tablestore-openmemory/hook/index.js | 12 + start-mcp-tablestore-openmemory/publish.yaml | 36 ++ start-mcp-tablestore-openmemory/readme.md | 375 ++++++++++++++++++ .../src/build.yaml | 12 + .../src/code/requirements.txt | 1 + .../src/mcp-schema.json | 367 +++++++++++++++++ start-mcp-tablestore-openmemory/src/readme.md | 258 ++++++++++++ start-mcp-tablestore-openmemory/src/s.yaml | 19 + .../src/variable.yaml | 181 +++++++++ start-mcp-tablestore-openmemory/version.md | 2 + 12 files changed, 1263 insertions(+) create mode 100644 .DS_Store create mode 100644 start-mcp-markitdown/src/.DS_Store create mode 100644 start-mcp-tablestore-openmemory/hook/index.js create mode 100644 start-mcp-tablestore-openmemory/publish.yaml create mode 100644 start-mcp-tablestore-openmemory/readme.md create mode 100644 start-mcp-tablestore-openmemory/src/build.yaml create mode 100644 start-mcp-tablestore-openmemory/src/code/requirements.txt create mode 100644 start-mcp-tablestore-openmemory/src/mcp-schema.json create mode 100644 start-mcp-tablestore-openmemory/src/readme.md create mode 100644 start-mcp-tablestore-openmemory/src/s.yaml create mode 100644 start-mcp-tablestore-openmemory/src/variable.yaml create mode 100644 start-mcp-tablestore-openmemory/version.md diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..bae0bd5979b7906c7c2fd3b029271e5a6f96042b GIT binary patch literal 12292 zcmeHNO>f*(6unMTGErz7poIdZjOeC|Oh|zup-L!ClSL(9(I8mx5j>g6#Kf_uo|z0$ z6qFqj{0DvlZ21)|`5E1_f^(idJ&(f=BK1YI*2e#HAKPYeCBl9eJAN;T#8OCK8gd{zV|R~Vn878=&tbnTJxJQ} zUEu6WA|0T`57K<6ndVL0iN{2LVt@RX*>L3}c_8;?Q$CR`+0=K+ulWDUKX-~O$V1$D zPd0EpY(WD-13?2p13?4Nq6X-DvDF-ZUtSHzpn;%)XIcYXAL`iIu2t=6*_x#T2Zr$c zKSOx4;Wq+wbFE&rYgKz%wnh{(Migx+8dWJqREpzzowuW1tJ>4DEyX1&#U-kq990=g zWS$PWy18AVwXzMzpn;%)aShzSrRx)O?+h7vhFm^Dn<5`?p=FldlQ!C(&b4PcFuSv? zT;!#RxCP{QP%DUKD5*w4ZZ0!lTN(SL%0MbPDg(JAjeK88FM0dW!HD{@Cj)6}`RENt z{@TCELn|@H(g$J=T{$|5esb{6>rV>Xl8wMGIAy zHuzxWh77kglHufci<2u}B+3@DZ*<#2e}-<4SdE!^BAn*1*RAS5zcssQ((A9T{t?a0 z&RuwJzBXT5tbMh$mk+o4aevTTkBcvO_GzA{&C&0;`B~B)ZZBQApJ)9z$=ZbxNLp>& z^5y4A*2;(L`5_QVSDM?@$q}_zQ0_*bNkN8a{c&&cUG6{xNvf^P`i5b z?Yj@R_tS$c|FJZ#sB%zp(J?m61escIhg(IK<{21-2NZeDtM3dtZh<$l-;gG>pWu8@ zvDnodnwf3u-f#69a}Ve#{&HXraV+q=<=}FL+qiE{(N`}np1~SmikzzSQ&kCS*uyXY^4%t;Wes;US;JU|^s)2SYb``Fl-6?R-XIDMLuY*UJ*$GzK zee8SC1}e>32V_~{_;ol9dB zvgV+XaU1RBDbOa2*syM6z3IiG$8MUrNc*A{x536}wjbaOeiT=op3--zp89=EV>l%z_6vFG?c&3aSnago+V6@D>28fc% zh|Q@l7&d;k#^}!!OVlIaFzz2!amtKt->q4gZzgO^f4u8rwh{YMgH8__?}&}&kHK8D zgE1VkY2)~-OBx3pdw8@_UOk6}k-nHOk%f+loSpF*UTwr1Qy}JGcN8^}>BLxE-)C#l zC5zo@u)C(WjA&axrkxz&S!45&EGz7rQ}o-#<~ehUN;Bh6A^Ykn)3DE;J6dKgqHxZ$ zo)K@Jyk~qiDAY-Fij^&{HD&AcjWa-@=oO3KLQ$41GgD!egY|`id93aatvUMM;#;p+ zXGpA^GSfT{i~QPH{yHjGQ)Vkp_GNgprTyz&nV0sx2xQDg@UJ4H+9N9x91k;Q)*>Ap zn=ig>H2-KI2Q7Epx}#ypmiFh8T)~*bGkYJaE*NeeTip0(@(81>v-qkB`J!s_2e@=Rr_n-0qe*^KgX9Zfi5pl^D5$vr{zMAM!3dOs&OKM)4qT0v3f}B2QEXfz z1T)g^+ufPBpBH7<13+f$`W%=7n6M~{HbzW`M_oHHc#kMyjv5)BP+)~-WTM|VqclZAm}Hkr(3IN3d{=1QlAwFZywKr8nD(JEj&D?s0}k;t~t?3#xR> zev7+4TTTb;13ZvXaGez~V_gpz&jZFj=iU4UgV^^$EW2*5fGgk%xB~xB0lwL4lOsc~ zT>)3X71$`C_e08}m`Cgk!_~nmqyWT(!@=0rTtYc%#5`hWNDobnN;Im(6hn;8@ifNe z5j#VpLt^qFapkY%MZ)TwKMmoK+|X-Rz!m5#uxs6^zW*2e%Zw)ZeTw&70axIUDIm%G zYChwk;@kS|c>30+EY~b*8rNxq#&+)`fE~R@PJ+|?skRxHN9+uB799_CqJIbkLA-JW Hen5dwj#f}+ literal 0 HcmV?d00001 diff --git a/start-mcp-tablestore-openmemory/hook/index.js b/start-mcp-tablestore-openmemory/hook/index.js new file mode 100644 index 0000000..099f7a5 --- /dev/null +++ b/start-mcp-tablestore-openmemory/hook/index.js @@ -0,0 +1,12 @@ +async function preInit(inputObj) { + +} + +async function postInit(inputObj) { + +} + +module.exports = { + postInit, + preInit +} diff --git a/start-mcp-tablestore-openmemory/publish.yaml b/start-mcp-tablestore-openmemory/publish.yaml new file mode 100644 index 0000000..ac016bd --- /dev/null +++ b/start-mcp-tablestore-openmemory/publish.yaml @@ -0,0 +1,36 @@ +Edition: 3.0.0 +Type: Project +Name: mcp-tablestore-openmemory +Version: dev +Provider: + - 阿里云 # 取值内容参考:https://api.devsapp.cn/v3/common/args.html +Description: 阿里云可观测 MCP Server 模版 +HomePage: https://github.com/devsapp/fcai-mcp-servers/tree/main/start-mcp-aliyun-observability +Tags: #标签详情 + - MCP + - Python + - Develop +Category: MCP服务 # 取值内容参考:https://api.devsapp.cn/v3/common/args.html +Service: # 使用的服务 + 函数计算: # 取值内容参考:https://api.devsapp.cn/v3/common/args.html + Authorities: #权限描述 + - AliyunFCFullAccess # 所需要的权限,例如AliyunFCFullAccess +Organization: 阿里云函数计算(FC) # 所属组织 +Effective: Public # 是否公开,取值:Public,Private,Organization +Parameters: + type: object + additionalProperties: false # 不允许增加其他属性 + required: # 必填项 + - region + properties: + region: + title: 地域 + type: string + default: cn-hangzhou + description: 创建应用所在的地区 + enum: + - cn-beijing + - cn-hangzhou + - cn-shanghai + - cn-shenzhen + - ap-southeast-1 diff --git a/start-mcp-tablestore-openmemory/readme.md b/start-mcp-tablestore-openmemory/readme.md new file mode 100644 index 0000000..08a2c85 --- /dev/null +++ b/start-mcp-tablestore-openmemory/readme.md @@ -0,0 +1,375 @@ + +> 注:当前项目为 Serverless Devs 应用,由于应用中会存在需要初始化才可运行的变量(例如应用部署地区、函数名等等),所以**不推荐**直接 Clone 本仓库到本地进行部署或直接复制 s.yaml 使用,**强烈推荐**通过 `s init ${模版名称}` 的方法或应用中心进行初始化,详情可参考[部署 & 体验](#部署--体验) 。 + +# aliyun-observability-mcp-server 帮助文档 + + + +阿里云可观测服务 Observable MCP Server + + + + +## 资源准备 + +使用该项目,您需要有开通以下服务并拥有对应权限: + + + + + +| 服务/业务 | 权限 | 相关文档 | +| --- | --- | --- | +| 函数计算 | AliyunFCFullAccess | [帮助文档](https://help.aliyun.com/product/2508973.html) [计费文档](https://help.aliyun.com/document_detail/2512928.html) | + + + + + + + + + + + + + + + +## 部署 & 体验 + + + +- :fire: 通过 [云原生应用开发平台 CAP](https://cap.console.aliyun.com/template-detail?template=aliyun-observability-mcp-server) ,[![Deploy with Severless Devs](https://img.alicdn.com/imgextra/i1/O1CN01w5RFbX1v45s8TIXPz_!!6000000006118-55-tps-95-28.svg)](https://cap.console.aliyun.com/template-detail?template=aliyun-observability-mcp-server) 该应用。 + + + + + + + +## 案例介绍 + + + +### 简介 + +阿里云可观测 MCP服务,提供了一系列访问阿里云可观测各产品的工具能力,覆盖产品包含阿里云日志服务SLS、阿里云应用实时监控服务ARMS、阿里云云监控等,任意支持 MCP 协议的智能体助手都可快速接入。支持的产品如下: + +- [阿里云日志服务SLS](https://help.aliyun.com/zh/sls/product-overview/what-is-log-service) +- [阿里云应用实时监控服务ARMS](https://help.aliyun.com/zh/arms/?scm=20140722.S_help@@%E6%96%87%E6%A1%A3@@34364._.RL_arms-LOC_2024NSHelpLink-OR_ser-PAR1_215042f917434789732438827e4665-V_4-P0_0-P1_0) + +### 权限要求 + +为了确保 MCP Server 能够成功访问和操作您的阿里云可观测性资源,您需要配置以下权限: + +1. **阿里云访问密钥 (AccessKey)**: + * 服务运行需要有效的阿里云 AccessKey ID 和 AccessKey Secret。 + * 获取和管理 AccessKey,请参考 [阿里云 AccessKey 管理官方文档](https://help.aliyun.com/document_detail/53045.html)。 + +2. **RAM 授权 (重要)**: + * 与 AccessKey 关联的 RAM 用户或角色**必须**被授予访问相关云服务所需的权限。 + * **强烈建议遵循"最小权限原则"**:仅授予运行您计划使用的 MCP 工具所必需的最小权限集,以降低安全风险。 + * 根据您需要使用的工具,参考以下文档进行权限配置: + * **日志服务 (SLS)**:如果您需要使用 `sls_*` 相关工具,请参考 [日志服务权限说明](https://help.aliyun.com/zh/sls/overview-8),并授予必要的读取、查询等权限。 + * **应用实时监控服务 (ARMS)**:如果您需要使用 `arms_*` 相关工具,请参考 [ARMS 权限说明](https://help.aliyun.com/zh/arms/security-and-compliance/overview-8?scm=20140722.H_74783._.OR_help-T_cn~zh-V_1),并授予必要的查询权限。 + * 请根据您的实际应用场景,精细化配置所需权限。 + +### 安全与部署建议 + +请务必关注以下安全事项和部署最佳实践: + +1. **密钥安全**: + * 本 MCP Server 在运行时会使用您提供的 AccessKey 调用阿里云 OpenAPI,但**不会以任何形式存储您的 AccessKey**,也不会将其用于设计功能之外的任何其他用途。 + +2. **访问控制 (关键)**: + * 当您选择通过 **SSE (Server-Sent Events) 协议** 访问 MCP Server 时,**您必须自行负责该服务接入点的访问控制和安全防护**。 + * **强烈建议**将 MCP Server 部署在**内部网络或受信环境**中,例如您的私有 VPC (Virtual Private Cloud) 内,避免直接暴露于公共互联网。 + * 推荐的部署方式是使用**阿里云函数计算 (FC)**,并配置其网络设置为**仅 VPC 内访问**,以实现网络层面的隔离和安全。 + * **注意**:**切勿**在没有任何身份验证或访问控制机制的情况下,将配置了您 AccessKey 的 MCP Server SSE 端点暴露在公共互联网上,这会带来极高的安全风险。 + +##### 工具列表 +目前提供的 MCP 工具以阿里云日志服务为主,其他产品会陆续支持,工具详细如下(具体以实际版本支持为主): +- 增加 SLS 日志服务相关工具 + - `sls_describe_logstore` + - 获取 SLS Logstore 的索引信息 + - `sls_list_projects` + - 获取 SLS 项目列表 + - `sls_list_logstores` + - 获取 SLS Logstore 列表 + - `sls_describe_logstore` + - 获取 SLS Logstore 的索引信息 + - `sls_execute_query` + - 执行SLS 日志查询 + - `sls_translate_natural_language_to_query` + - 翻译自然语言为SLS 查询语句 + +- 增加 ARMS 应用实时监控服务相关工具 + - `arms_search_apps` + - 搜索 ARMS 应用 + - `arms_generate_trace_query` + - 根据自然语言生成 trace 查询语句 + +##### 场景举例 + +- 场景一: 快速查询某个 logstore 相关结构 + - 使用工具: + - `sls_list_logstores` + - `sls_describe_logstore` + ![image](https://img.alicdn.com/imgextra/i1/O1CN01dOcgvN1NUwSLA0QVW_!!6000000001574-0-tps-2002-1466.jpg) + + +- 场景二: 模糊查询最近一天某个 logstore下面访问量最高的应用是什么 + - 分析: + - 需要判断 logstore 是否存在 + - 获取 logstore 相关结构 + - 根据要求生成查询语句(对于语句用户可确认修改) + - 执行查询语句 + - 根据查询结果生成响应 + - 使用工具: + - `sls_list_logstores` + - `sls_describe_logstore` + - `sls_translate_natural_language_to_query` + - `sls_execute_query` + ![image](https://img.alicdn.com/imgextra/i2/O1CN01wqG56Y1Gt1yd6mPTp_!!6000000000679-0-tps-2074-1664.jpg) + + +- 场景三: 查询 ARMS 某个应用下面响应最慢的几条 Trace + - 分析: + - 需要判断应用是否存在 + - 获取应用相关结构 + - 根据要求生成查询语句(对于语句用户可确认修改) + - 执行查询语句 + - 根据查询结果生成响应 + - 使用工具: + - `arms_search_apps` + - `arms_generate_trace_query` + - `sls_translate_natural_language_to_query` + - `sls_execute_query` + ![image](https://img.alicdn.com/imgextra/i3/O1CN01QkYifh1TcAOlogtbp_!!6000000002402-0-tps-2254-1652.jpg) + + +## Installation + +### Using uv (recommended) + +When using [`uv`](https://docs.astral.sh/uv/) no specific installation is needed. We will +use [`uvx`](https://docs.astral.sh/uv/guides/tools/) to directly run *mcp-server-time*. + +### Using PIP + +Alternatively you can install `mcp-server-time` via pip: + +```bash +pip install mcp-server-time +``` + +After installation, you can run it as a script using: + +```bash +python -m mcp_server_time +``` + +## Configuration + +### Configure for Claude.app + +Add to your Claude settings: + +
+Using uvx + +```json +"mcpServers": { + "time": { + "command": "uvx", + "args": ["mcp-server-time"] + } +} +``` +
+ +
+Using docker + +```json +"mcpServers": { + "time": { + "command": "docker", + "args": ["run", "-i", "--rm", "mcp/time"] + } +} +``` +
+ +
+Using pip installation + +```json +"mcpServers": { + "time": { + "command": "python", + "args": ["-m", "mcp_server_time"] + } +} +``` +
+ +### Configure for Zed + +Add to your Zed settings.json: + +
+Using uvx + +```json +"context_servers": [ + "mcp-server-time": { + "command": "uvx", + "args": ["mcp-server-time"] + } +], +``` +
+ +
+Using pip installation + +```json +"context_servers": { + "mcp-server-time": { + "command": "python", + "args": ["-m", "mcp_server_time"] + } +}, +``` +
+ +### Customization - System Timezone + +By default, the server automatically detects your system's timezone. You can override this by adding the argument `--local-timezone` to the `args` list in the configuration. + +Example: +```json +{ + "command": "python", + "args": ["-m", "mcp_server_time", "--local-timezone=America/New_York"] +} +``` + +## Example Interactions + +1. Get current time: +```json +{ + "name": "get_current_time", + "arguments": { + "timezone": "Europe/Warsaw" + } +} +``` +Response: +```json +{ + "timezone": "Europe/Warsaw", + "datetime": "2024-01-01T13:00:00+01:00", + "is_dst": false +} +``` + +2. Convert time between timezones: +```json +{ + "name": "convert_time", + "arguments": { + "source_timezone": "America/New_York", + "time": "16:30", + "target_timezone": "Asia/Tokyo" + } +} +``` +Response: +```json +{ + "source": { + "timezone": "America/New_York", + "datetime": "2024-01-01T12:30:00-05:00", + "is_dst": false + }, + "target": { + "timezone": "Asia/Tokyo", + "datetime": "2024-01-01T12:30:00+09:00", + "is_dst": false + }, + "time_difference": "+13.0h", +} +``` + +## Debugging + +You can use the MCP inspector to debug the server. For uvx installations: + +```bash +npx @modelcontextprotocol/inspector uvx mcp-server-time +``` + +Or if you've installed the package in a specific directory or are developing on it: + +```bash +cd path/to/servers/src/time +npx @modelcontextprotocol/inspector uv run mcp-server-time +``` + +## Examples of Questions for Claude + +1. "What time is it now?" (will use system timezone) +2. "What time is it in Tokyo?" +3. "When it's 4 PM in New York, what time is it in London?" +4. "Convert 9:30 AM Tokyo time to New York time" + +## Build + +Docker build: + +```bash +cd src/time +docker build -t mcp/time . +``` + +## Contributing + +We encourage contributions to help expand and improve mcp-server-time. Whether you want to add new time-related tools, enhance existing functionality, or improve documentation, your input is valuable. + +For examples of other MCP servers and implementation patterns, see: +https://github.com/modelcontextprotocol/servers + +Pull requests are welcome! Feel free to contribute new ideas, bug fixes, or enhancements to make mcp-server-time even more powerful and useful. + +## License + +mcp-server-time is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository. + +
+ + + + + + + +## 使用流程 + + + +部署完成拿到 URL 后,准备好支持 SSE 的 MCP Client,通过 SSETransport 进行连接。 + + + + + + + + + + + diff --git a/start-mcp-tablestore-openmemory/src/build.yaml b/start-mcp-tablestore-openmemory/src/build.yaml new file mode 100644 index 0000000..27c382c --- /dev/null +++ b/start-mcp-tablestore-openmemory/src/build.yaml @@ -0,0 +1,12 @@ +mcp-tablestore-openmemory: + default: + rootPath: ./code + languages: + - python3.10 + cache: + paths: + - "~/.cache" + steps: + - run: mkdir -p python + - run: pip install -r requirements.txt -t ./python + - run: find ./python/bin -type f -perm -u+x -exec sed -i '1{/^#!.*/ s|.*|#!/usr/bin/env python3|}' {} \; \ No newline at end of file diff --git a/start-mcp-tablestore-openmemory/src/code/requirements.txt b/start-mcp-tablestore-openmemory/src/code/requirements.txt new file mode 100644 index 0000000..158ec7e --- /dev/null +++ b/start-mcp-tablestore-openmemory/src/code/requirements.txt @@ -0,0 +1 @@ +tablestore-openmemory-mcp==1.0.0 \ No newline at end of file diff --git a/start-mcp-tablestore-openmemory/src/mcp-schema.json b/start-mcp-tablestore-openmemory/src/mcp-schema.json new file mode 100644 index 0000000..e1c77bd --- /dev/null +++ b/start-mcp-tablestore-openmemory/src/mcp-schema.json @@ -0,0 +1,367 @@ +{ + "tools": [ + { + "inputSchema": { + "type": "object", + "title": "sls_list_projectsArguments", + "properties": { + "regionId": { + "description": "aliyun region id", + "title": "Regionid", + "type": "string" + }, + "limit": { + "default": 50, + "description": "limit,max is 100", + "maximum": 100, + "title": "Limit", + "type": "integer", + "minimum": 1 + }, + "projectName": { + "description": "project name,fuzzy search", + "title": "Projectname", + "type": "string" + } + }, + "required": [ + "regionId" + ] + }, + "name": "sls_list_projects", + "description": "列出阿里云日志服务中的所有项目。\n\n ## 功能概述\n\n 该工具可以列出指定区域中的所有SLS项目,支持通过项目名进行模糊搜索。如果不提供项目名称,则返回该区域的所有项目。\n\n ## 使用场景\n\n - 当需要查找特定项目是否存在时\n - 当需要获取某个区域下所有可用的SLS项目列表时\n - 当需要根据项目名称的部分内容查找相关项目时\n\n ## 返回数据结构\n\n 返回的项目信息包含:\n - project_name: 项目名称\n - description: 项目描述\n - region_id: 项目所在区域\n\n ## 查询示例\n\n - \"有没有叫 XXX 的 project\"\n - \"列出所有SLS项目\"\n\n Args:\n ctx: MCP上下文,用于访问SLS客户端\n projectName: 项目名称查询字符串,支持模糊搜索\n limit: 返回结果的最大数量,范围1-100,默认10\n regionId: 阿里云区域ID,region id format like \"xx-xxx\",like \"cn-hangzhou\"\n\n Returns:\n 包含项目信息的字典列表,每个字典包含project_name、description和region_id\n " + }, + { + "inputSchema": { + "type": "object", + "title": "sls_list_logstoresArguments", + "properties": { + "logStore": { + "description": "log store name,fuzzy search", + "title": "Logstore", + "type": "string" + }, + "logStoreType": { + "description": "log store type,default is logs,should be logs,metrics", + "title": "Logstoretype", + "type": "string" + }, + "regionId": { + "description": "aliyun region id,region id format like 'xx-xxx',like 'cn-hangzhou'", + "title": "Regionid", + "type": "string" + }, + "limit": { + "default": 10, + "description": "limit,max is 100", + "maximum": 100, + "title": "Limit", + "type": "integer", + "minimum": 1 + }, + "project": { + "description": "sls project name,must exact match,should not contain chinese characters", + "title": "Project", + "type": "string" + }, + "isMetricStore": { + "default": false, + "description": "is metric store,default is False,only use want to find metric store", + "title": "Ismetricstore", + "type": "boolean" + } + }, + "required": [ + "project", + "regionId" + ] + }, + "name": "sls_list_logstores", + "description": "列出SLS项目中的日志库。\n\n ## 功能概述\n\n 该工具可以列出指定SLS项目中的所有日志库,如果不选,则默认为日志库类型\n 支持通过日志库名称进行模糊搜索。如果不提供日志库名称,则返回项目中的所有日志库。\n\n ## 使用场景\n\n - 当需要查找特定项目下是否存在某个日志库时\n - 当需要获取项目中所有可用的日志库列表时\n - 当需要根据日志库名称的部分内容查找相关日志库时\n - 如果从上下文未指定 project参数,除非用户说了遍历,则可使用 sls_list_projects 工具获取项目列表\n\n ## 是否指标库\n\n 如果需要查找指标或者时序相关的库,请将is_metric_store参数设置为True\n\n ## 查询示例\n\n - \"我想查询有没有 XXX 的日志库\"\n - \"某个 project 有哪些 log store\"\n\n Args:\n ctx: MCP上下文,用于访问SLS客户端\n project: SLS项目名称,必须精确匹配\n log_store: 日志库名称,支持模糊搜索\n limit: 返回结果的最大数量,范围1-100,默认10\n is_metric_store: 是否指标库,可选值为True或False,默认为False\n region_id: 阿里云区域ID\n\n Returns:\n 日志库名称的字符串列表\n " + }, + { + "inputSchema": { + "type": "object", + "title": "sls_describe_logstoreArguments", + "properties": { + "logStore": { + "description": "sls log store name,must exact match,not fuzzy search", + "title": "Logstore", + "type": "string" + }, + "regionId": { + "description": "aliyun region id,region id format like 'xx-xxx',like 'cn-hangzhou'", + "title": "Regionid", + "type": "string" + }, + "project": { + "description": "sls project name,must exact match,not fuzzy search", + "title": "Project", + "type": "string" + } + }, + "required": [ + "project", + "logStore", + "regionId" + ] + }, + "name": "sls_describe_logstore", + "description": "获取SLS日志库的结构信息。\n\n ## 功能概述\n\n 该工具用于获取指定SLS项目中日志库的索引信息和结构定义,包括字段类型、别名、是否大小写敏感等信息。\n\n ## 使用场景\n\n - 当需要了解日志库的字段结构时\n - 当需要获取日志库的索引配置信息时\n - 当构建查询语句前需要了解可用字段时\n - 当需要分析日志数据结构时\n\n ## 返回数据结构\n\n 返回一个字典,键为字段名,值包含以下信息:\n - alias: 字段别名\n - sensitive: 是否大小写敏感\n - type: 字段类型\n - json_keys: JSON字段的子字段信息\n\n ## 查询示例\n\n - \"我想查询 XXX 的日志库的 schema\"\n - \"我想查询 XXX 的日志库的 index\"\n - \"我想查询 XXX 的日志库的结构信息\"\n\n Args:\n ctx: MCP上下文,用于访问SLS客户端\n project: SLS项目名称,必须精确匹配\n log_store: SLS日志库名称,必须精确匹配\n region_id: 阿里云区域ID\n\n Returns:\n 包含日志库结构信息的字典\n " + }, + { + "inputSchema": { + "type": "object", + "title": "sls_execute_queryArguments", + "properties": { + "logStore": { + "description": "sls log store name", + "title": "Logstore", + "type": "string" + }, + "regionId": { + "description": "aliyun region id,region id format like 'xx-xxx',like 'cn-hangzhou'", + "title": "Regionid", + "type": "string" + }, + "fromTimestamp": { + "description": "from timestamp,unit is second,should be unix timestamp", + "title": "Fromtimestamp", + "type": "integer" + }, + "query": { + "description": "query", + "title": "Query", + "type": "string" + }, + "limit": { + "default": 10, + "description": "limit,max is 100", + "maximum": 100, + "title": "Limit", + "type": "integer", + "minimum": 1 + }, + "project": { + "description": "sls project name", + "title": "Project", + "type": "string" + }, + "toTimestamp": { + "description": "to timestamp,unit is second,should be unix timestamp", + "title": "Totimestamp", + "type": "integer" + } + }, + "required": [ + "project", + "logStore", + "query", + "fromTimestamp", + "toTimestamp", + "regionId" + ] + }, + "name": "sls_execute_query", + "description": "执行SLS日志查询。\n\n ## 功能概述\n\n 该工具用于在指定的SLS项目和日志库上执行查询语句,并返回查询结果。查询将在指定的时间范围内执行。\n\n ## 使用场景\n\n - 当需要根据特定条件查询日志数据时\n - 当需要分析特定时间范围内的日志信息时\n - 当需要检索日志中的特定事件或错误时\n - 当需要统计日志数据的聚合信息时\n\n\n\n ## 查询语法\n\n 查询必须使用SLS有效的查询语法,而非自然语言。如果不了解日志库的结构,可以先使用sls_describe_logstore工具获取索引信息。\n\n ## 时间范围\n\n 查询必须指定时间范围:\n - fromTimestamp: 开始时间戳(秒)\n - toTimestamp: 结束时间戳(秒)\n\n ## 查询示例\n\n - \"帮我查询下 XXX 的日志信息\"\n - \"查找最近一小时内的错误日志\"\n\n ## 错误处理\n - Column xxx can not be resolved 如果是 sls_translate_natural_language_to_query 工具生成的查询语句 可能存在查询列未开启统计,可以提示用户增加相对应的信息,或者调用 sls_describe_logstore 工具获取索引信息之后,要用户选择正确的字段或者提示用户对列开启统计。当确定列开启统计之后,可以再次调用sls_translate_natural_language_to_query 工具生成查询语句\n\n Args:\n ctx: MCP上下文,用于访问SLS客户端\n project: SLS项目名称\n logStore: SLS日志库名称\n query: SLS查询语句\n fromTimestamp: 查询开始时间戳(秒)\n toTimestamp: 查询结束时间戳(秒)\n limit: 返回结果的最大数量,范围1-100,默认10\n regionId: 阿里云区域ID\n\n Returns:\n 查询结果列表,每个元素为一条日志记录\n " + }, + { + "inputSchema": { + "type": "object", + "title": "sls_translate_natural_language_to_log_queryArguments", + "properties": { + "logStore": { + "description": "sls log store name", + "title": "Logstore", + "type": "string" + }, + "regionId": { + "description": "aliyun region id,region id format like 'xx-xxx',like 'cn-hangzhou'", + "title": "Regionid", + "type": "string" + }, + "project": { + "description": "sls project name", + "title": "Project", + "type": "string" + }, + "text": { + "description": "the natural language text to generate sls log store query", + "title": "Text", + "type": "string" + } + }, + "required": [ + "text", + "project", + "logStore", + "regionId" + ] + }, + "name": "sls_translate_natural_language_to_log_query", + "description": "将自然语言转换为SLS查询语句。\n\n ## 功能概述\n\n 该工具可以将自然语言描述转换为有效的SLS查询语句,便于用户使用自然语言表达查询需求。用户有任何 SLS 日志查询需求时,都需要优先使用该工具。\n\n ## 使用场景\n\n - 当用户不熟悉SLS查询语法时\n - 当需要快速构建复杂查询时\n - 当需要从自然语言描述中提取查询意图时\n\n ## 使用限制\n\n - 仅支持生成SLS查询,不支持其他数据库的SQL如MySQL、PostgreSQL等\n - 生成的是查询语句,而非查询结果,需要配合sls_execute_query工具使用\n - 如果查询涉及ARMS应用,应优先使用arms_generate_trace_query工具\n - 需要对应的 log_sotre 已经设定了索引信息,如果生成的结果里面有字段没有索引或者开启统计,可能会导致查询失败,需要友好的提示用户增加相对应的索引信息\n\n ## 最佳实践\n\n - 提供清晰简洁的自然语言描述\n - 不要在描述中包含项目或日志库名称\n - 如有需要,指定查询的时间范围\n - 首次生成的查询可能不完全符合要求,可能需要多次尝试\n\n ## 查询示例\n\n - \"帮我生成下 XXX 的日志查询语句\"\n - \"查找最近一小时内的错误日志\"\n\n Args:\n ctx: MCP上下文,用于访问SLS客户端\n text: 用于生成查询的自然语言文本\n project: SLS项目名称\n log_store: SLS日志库名称\n region_id: 阿里云区域ID\n\n Returns:\n 生成的SLS查询语句\n " + }, + { + "inputSchema": { + "type": "object", + "title": "sls_diagnose_queryArguments", + "properties": { + "logStore": { + "description": "sls log store name", + "title": "Logstore", + "type": "string" + }, + "regionId": { + "description": "aliyun region id,region id format like 'xx-xxx',like 'cn-hangzhou'", + "title": "Regionid", + "type": "string" + }, + "query": { + "description": "sls query", + "title": "Query", + "type": "string" + }, + "errorMessage": { + "description": "error message", + "title": "Errormessage", + "type": "string" + }, + "project": { + "description": "sls project name", + "title": "Project", + "type": "string" + } + }, + "required": [ + "query", + "errorMessage", + "project", + "logStore", + "regionId" + ] + }, + "name": "sls_diagnose_query", + "description": "诊断SLS查询语句。\n\n ## 功能概述\n\n 当 SLS 查询语句执行失败时,可以调用该工具,根据错误信息,生成诊断结果。诊断结果会包含查询语句的正确性、性能分析、优化建议等信息。\n\n ## 使用场景\n\n - 当需要诊断SLS查询语句的正确性时\n - 当 SQL 执行错误需要查找原因时\n\n ## 查询示例\n\n - \"帮我诊断下 XXX 的日志查询语句\"\n - \"帮我分析下 XXX 的日志查询语句\"\n\n Args:\n ctx: MCP上下文,用于访问SLS客户端\n query: SLS查询语句\n error_message: 错误信息\n project: SLS项目名称\n log_store: SLS日志库名称\n region_id: 阿里云区域ID\n " + }, + { + "inputSchema": { + "type": "object", + "title": "sls_get_regionsArguments", + "properties": {} + }, + "name": "sls_get_regions", + "description": "获取阿里云的部分区域列表。\n\n ## 功能概述\n\n 该工具用于获取阿里云的部分区域列表,便于在执行SLS查询时指定区域。\n\n ## 使用场景\n\n - 当需要获取阿里云的部分区域列表时\n - 当需要根据区域进行SLS查询时\n - 当用户没有明确指定区域ID 时,可以调用该工具获取区域列表,并要求用户进行选择\n\n ## 返回数据格式\n\n 返回包含区域列表的字典,每个字典包含region_id和region_name。\n\n ## 查询示例\n\n - \"获取阿里云的部分区域列表\"\n " + }, + { + "inputSchema": { + "type": "object", + "title": "arms_search_appsArguments", + "properties": { + "pageNumber": { + "default": 1, + "description": "page number,default is 1", + "title": "Pagenumber", + "type": "integer", + "minimum": 1 + }, + "appNameQuery": { + "description": "app name query", + "title": "Appnamequery", + "type": "string" + }, + "regionId": { + "description": "region id,region id format like 'xx-xxx',like 'cn-hangzhou'", + "title": "Regionid", + "type": "string" + }, + "pageSize": { + "default": 20, + "description": "page size,max is 100", + "maximum": 100, + "title": "Pagesize", + "type": "integer", + "minimum": 1 + } + }, + "required": [ + "appNameQuery", + "regionId" + ] + }, + "name": "arms_search_apps", + "description": "搜索ARMS应用。\n\n ## 功能概述\n\n 该工具用于根据应用名称搜索ARMS应用,返回应用的基本信息,包括应用名称、PID、用户ID和类型。\n\n ## 使用场景\n\n - 当需要查找特定名称的应用时\n - 当需要获取应用的PID以便进行其他ARMS操作时\n - 当需要检查用户拥有的应用列表时\n\n ## 搜索条件\n\n - app_name_query必须是应用名称的一部分,而非自然语言\n - 搜索结果将分页返回,可以指定页码和每页大小\n\n ## 返回数据结构\n\n 返回一个字典,包含以下信息:\n - total: 符合条件的应用总数\n - page_size: 每页大小\n - page_number: 当前页码\n - trace_apps: 应用列表,每个应用包含app_name、pid、user_id和type\n\n ## 查询示例\n\n - \"帮我查询下 XXX 的应用\"\n - \"找出名称包含'service'的应用\"\n\n Args:\n ctx: MCP上下文,用于访问ARMS客户端\n app_name_query: 应用名称查询字符串\n region_id: 阿里云区域ID\n page_size: 每页大小,范围1-100,默认20\n page_number: 页码,默认1\n\n Returns:\n 包含应用信息的字典\n " + }, + { + "inputSchema": { + "type": "object", + "title": "arms_generate_trace_queryArguments", + "properties": { + "question": { + "description": "question,the question to query the trace", + "title": "Question", + "type": "string" + }, + "regionId": { + "description": "region id,region id format like 'xx-xxx',like 'cn-hangzhou'", + "title": "Regionid", + "type": "string" + }, + "pid": { + "description": "pid,the pid of the app", + "title": "Pid", + "type": "string" + }, + "userId": { + "description": "user aliyun account id", + "title": "Userid", + "type": "integer" + } + }, + "required": [ + "userId", + "pid", + "regionId", + "question" + ] + }, + "name": "arms_generate_trace_query", + "description": "生成ARMS应用的调用链查询语句。\n\n ## 功能概述\n\n 该工具用于将自然语言描述转换为ARMS调用链查询语句,便于分析应用性能和问题。\n\n ## 使用场景\n\n - 当需要查询应用的调用链信息时\n - 当需要分析应用性能问题时\n - 当需要跟踪特定请求的执行路径时\n - 当需要分析服务间调用关系时\n\n ## 查询处理\n\n 工具会将自然语言问题转换为SLS查询,并返回:\n - 生成的SLS查询语句\n - 存储调用链数据的项目名\n - 存储调用链数据的日志库名\n\n ## 查询上下文\n\n 查询会考虑以下信息:\n - 应用的PID\n - 响应时间以纳秒存储,需转换为毫秒\n - 数据以span记录存储,查询耗时需要对符合条件的span进行求和\n - 服务相关信息使用serviceName字段\n - 如果用户明确提出要查询 trace信息,则需要在查询问题上question 上添加说明返回trace信息\n\n ## 查询示例\n\n - \"帮我查询下 XXX 的 trace 信息\"\n - \"分析最近一小时内响应时间超过1秒的调用链\"\n\n Args:\n ctx: MCP上下文,用于访问ARMS和SLS客户端\n user_id: 用户阿里云账号ID\n pid: 应用的PID\n region_id: 阿里云区域ID\n question: 查询调用链的自然语言问题\n\n Returns:\n 包含查询信息的字典,包括sls_query、project和log_store\n " + }, + { + "inputSchema": { + "type": "object", + "title": "cms_translate_natural_language_to_promqlArguments", + "properties": { + "regionId": { + "description": "aliyun region id,region id format like 'xx-xxx',like 'cn-hangzhou'", + "title": "Regionid", + "type": "string" + }, + "project": { + "description": "sls project name", + "title": "Project", + "type": "string" + }, + "metricStore": { + "description": "sls metric store name", + "title": "Metricstore", + "type": "string" + }, + "text": { + "description": "the natural language text to generate promql", + "title": "Text", + "type": "string" + } + }, + "required": [ + "text", + "project", + "metricStore", + "regionId" + ] + }, + "name": "cms_translate_natural_language_to_promql", + "description": "将自然语言转换为Prometheus PromQL查询语句。\n\n ## 功能概述\n\n 该工具可以将自然语言描述转换为有效的PromQL查询语句,便于用户使用自然语言表达查询需求。\n\n ## 使用场景\n\n - 当用户不熟悉PromQL查询语法时\n - 当需要快速构建复杂查询时\n - 当需要从自然语言描述中提取查询意图时\n\n ## 使用限制\n\n - 仅支持生成PromQL查询\n - 生成的是查询语句,而非查询结果\n - 禁止使用sls_execute_query工具执行,两者接口不兼容\n\n ## 最佳实践\n\n - 提供清晰简洁的自然语言描述\n - 不要在描述中包含项目或时序库名称\n - 首次生成的查询可能不完全符合要求,可能需要多次尝试\n\n ## 查询示例\n\n - \"帮我生成 XXX 的PromQL查询语句\"\n - \"查询每个namespace下的Pod数量\"\n\n Args:\n ctx: MCP上下文,用于访问SLS客户端\n text: 用于生成查询的自然语言文本\n project: SLS项目名称\n metricStore: SLS时序库名称\n regionId: 阿里云区域ID\n\n Returns:\n 生成的PromQL查询语句\n " + } + ] +} \ No newline at end of file diff --git a/start-mcp-tablestore-openmemory/src/readme.md b/start-mcp-tablestore-openmemory/src/readme.md new file mode 100644 index 0000000..74eafcb --- /dev/null +++ b/start-mcp-tablestore-openmemory/src/readme.md @@ -0,0 +1,258 @@ + +> 注:当前项目为 Serverless Devs 应用,由于应用中会存在需要初始化才可运行的变量(例如应用部署地区、函数名等等),所以**不推荐**直接 Clone 本仓库到本地进行部署或直接复制 s.yaml 使用,**强烈推荐**通过 `s init ${模版名称}` 的方法或应用中心进行初始化,详情可参考[部署 & 体验](#部署--体验) 。 + +# aliyun-observability-mcp-server 帮助文档 + + + +阿里云可观测服务 Observable MCP Server + + + + +## 资源准备 + +使用该项目,您需要有开通以下服务并拥有对应权限: + + + + + +| 服务/业务 | 权限 | 相关文档 | +| --- | --- | --- | +| 函数计算 | AliyunFCFullAccess | [帮助文档](https://help.aliyun.com/product/2508973.html) [计费文档](https://help.aliyun.com/document_detail/2512928.html) | + + + + + + + + + + + + + + + +## 部署 & 体验 + + + +- :fire: 通过 [云原生应用开发平台 CAP](https://cap.console.aliyun.com/template-detail?template=aliyun-observability-mcp-server) ,[![Deploy with Severless Devs](https://img.alicdn.com/imgextra/i1/O1CN01w5RFbX1v45s8TIXPz_!!6000000006118-55-tps-95-28.svg)](https://cap.console.aliyun.com/template-detail?template=aliyun-observability-mcp-server) 该应用。 + + + + + + + +## 案例介绍 + + + +### 简介 + +阿里云可观测 MCP服务,提供了一系列访问阿里云可观测各产品的工具能力,覆盖产品包含阿里云日志服务SLS、阿里云应用实时监控服务ARMS、阿里云云监控等,任意支持 MCP 协议的智能体助手都可快速接入。支持的产品如下: + +- [阿里云日志服务SLS](https://help.aliyun.com/zh/sls/product-overview/what-is-log-service) +- [阿里云应用实时监控服务ARMS](https://help.aliyun.com/zh/arms/?scm=20140722.S_help@@%E6%96%87%E6%A1%A3@@34364._.RL_arms-LOC_2024NSHelpLink-OR_ser-PAR1_215042f917434789732438827e4665-V_4-P0_0-P1_0) + +### 权限要求 + +为了确保 MCP Server 能够成功访问和操作您的阿里云可观测性资源,您需要配置以下权限: + +1. **阿里云访问密钥 (AccessKey)**: + * 服务运行需要有效的阿里云 AccessKey ID 和 AccessKey Secret。 + * 获取和管理 AccessKey,请参考 [阿里云 AccessKey 管理官方文档](https://help.aliyun.com/document_detail/53045.html)。 + +2. 当你初始化时候不传入 AccessKey 和 AccessKey Secret 时,会使用[默认凭据链进行登录](https://www.alibabacloud.com/help/zh/sdk/developer-reference/v2-manage-python-access-credentials#62bf90d04dztq) + 1. 如果环境变量 中的ALIBABA_CLOUD_ACCESS_KEY_ID 和 ALIBABA_CLOUD_ACCESS_KEY_SECRET均存在且非空,则使用它们作为默认凭据。 + 2. 如果同时设置了ALIBABA_CLOUD_ACCESS_KEY_ID、ALIBABA_CLOUD_ACCESS_KEY_SECRET和ALIBABA_CLOUD_SECURITY_TOKEN,则使用STS Token作为默认凭据。 + +3. **RAM 授权 (重要)**: + * 与 AccessKey 关联的 RAM 用户或角色**必须**被授予访问相关云服务所需的权限。 + * **强烈建议遵循"最小权限原则"**:仅授予运行您计划使用的 MCP 工具所必需的最小权限集,以降低安全风险。 + * 根据您需要使用的工具,参考以下文档进行权限配置: + * **日志服务 (SLS)**:如果您需要使用 `sls_*` 相关工具,请参考 [日志服务权限说明](https://help.aliyun.com/zh/sls/overview-8),并授予必要的读取、查询等权限。 + * **应用实时监控服务 (ARMS)**:如果您需要使用 `arms_*` 相关工具,请参考 [ARMS 权限说明](https://help.aliyun.com/zh/arms/security-and-compliance/overview-8?scm=20140722.H_74783._.OR_help-T_cn~zh-V_1),并授予必要的查询权限。 + * 请根据您的实际应用场景,精细化配置所需权限。 + +### 安全与部署建议 + +请务必关注以下安全事项和部署最佳实践: + +1. **密钥安全**: + * 本 MCP Server 在运行时会使用您提供的 AccessKey 调用阿里云 OpenAPI,但**不会以任何形式存储您的 AccessKey**,也不会将其用于设计功能之外的任何其他用途。 + +2. **访问控制 (关键)**: + * 当您选择通过 **SSE (Server-Sent Events) 协议** 访问 MCP Server 时,**您必须自行负责该服务接入点的访问控制和安全防护**。 + * **强烈建议**将 MCP Server 部署在**内部网络或受信环境**中,例如您的私有 VPC (Virtual Private Cloud) 内,避免直接暴露于公共互联网。 + * 推荐的部署方式是使用**阿里云函数计算 (FC)**,并配置其网络设置为**仅 VPC 内访问**,以实现网络层面的隔离和安全。 + * **注意**:**切勿**在没有任何身份验证或访问控制机制的情况下,将配置了您 AccessKey 的 MCP Server SSE 端点暴露在公共互联网上,这会带来极高的安全风险。 + +##### 工具列表 +目前提供的 MCP 工具以阿里云日志服务为主,其他产品会陆续支持,工具详细如下(具体以实际版本支持为主): +- 增加 SLS 日志服务相关工具 + - `sls_describe_logstore` + - 获取 SLS Logstore 的索引信息 + - `sls_list_projects` + - 获取 SLS 项目列表 + - `sls_list_logstores` + - 获取 SLS Logstore 列表 + - `sls_describe_logstore` + - 获取 SLS Logstore 的索引信息 + - `sls_execute_query` + - 执行SLS 日志查询 + - `sls_translate_natural_language_to_query` + - 翻译自然语言为SLS 查询语句 + +- 增加 ARMS 应用实时监控服务相关工具 + - `arms_search_apps` + - 搜索 ARMS 应用 + - `arms_generate_trace_query` + - 根据自然语言生成 trace 查询语句 + +##### 场景举例 + +- 场景一: 快速查询某个 logstore 相关结构 + - 使用工具: + - `sls_list_logstores` + - `sls_describe_logstore` + ![image](https://img.alicdn.com/imgextra/i1/O1CN01dOcgvN1NUwSLA0QVW_!!6000000001574-0-tps-2002-1466.jpg) + + +- 场景二: 模糊查询最近一天某个 logstore下面访问量最高的应用是什么 + - 分析: + - 需要判断 logstore 是否存在 + - 获取 logstore 相关结构 + - 根据要求生成查询语句(对于语句用户可确认修改) + - 执行查询语句 + - 根据查询结果生成响应 + - 使用工具: + - `sls_list_logstores` + - `sls_describe_logstore` + - `sls_translate_natural_language_to_query` + - `sls_execute_query` + ![image](https://img.alicdn.com/imgextra/i2/O1CN01wqG56Y1Gt1yd6mPTp_!!6000000000679-0-tps-2074-1664.jpg) + + +- 场景三: 查询 ARMS 某个应用下面响应最慢的几条 Trace + - 分析: + - 需要判断应用是否存在 + - 获取应用相关结构 + - 根据要求生成查询语句(对于语句用户可确认修改) + - 执行查询语句 + - 根据查询结果生成响应 + - 使用工具: + - `arms_search_apps` + - `arms_generate_trace_query` + - `sls_translate_natural_language_to_query` + - `sls_execute_query` + ![image](https://img.alicdn.com/imgextra/i3/O1CN01QkYifh1TcAOlogtbp_!!6000000002402-0-tps-2254-1652.jpg) + + + + +#### 使用 pip 安装 +> ⚠️ 需要 Python 3.10 及以上版本。 + +直接使用 pip 安装即可,安装命令如下: + +```bash +pip install mcp-server-aliyun-observability +``` +1. 安装之后,直接运行即可,运行命令如下: + +```bash +python -m mcp_server_aliyun_observability --transport sse --access-key-id --access-key-secret +``` +可通过命令行传递指定参数: +- `--transport` 指定传输方式,可选值为 `sse` 或 `stdio`,默认值为 `stdio` +- `--access-key-id` 指定阿里云 AccessKeyId,不指定时会使用环境变量中的ALIBABA_CLOUD_ACCESS_KEY_ID +- `--access-key-secret` 指定阿里云 AccessKeySecret,不指定时会使用环境变量中的ALIBABA_CLOUD_ACCESS_KEY_SECRET +- `--log-level` 指定日志级别,可选值为 `DEBUG`、`INFO`、`WARNING`、`ERROR`,默认值为 `INFO` +- `--transport-port` 指定传输端口,默认值为 `8000`,仅当 `--transport` 为 `sse` 时有效 + +2. 使用uv 命令启动 + +```bash +uv run mcp-server-aliyun-observability +``` +### 从源码安装 + +```bash + +# clone 源码 +git clone git@github.com:aliyun/alibabacloud-observability-mcp-server.git +# 进入源码目录 +cd alibabacloud-observability-mcp-server +# 安装 +pip install -e . +# 运行 +python -m mcp_server_aliyun_observability --transport sse --access-key-id --access-key-secret +``` + + +### AI 工具集成 + +> 以 SSE 启动方式为例,transport 端口为 8888,实际使用时需要根据实际情况修改 + +#### Cursor,Cline 等集成 +1. 使用 SSE 启动方式 +```json +{ + "mcpServers": { + "alibaba_cloud_observability": { + "url": "http://localhost:7897/sse" + } + } +} +``` +2. 使用 stdio 启动方式 + 直接从源码目录启动,注意 + 1. 需要指定 `--directory` 参数,指定源码目录,最好是绝对路径 + 2. uv命令 最好也使用绝对路径,如果使用了虚拟环境,则需要使用虚拟环境的绝对路径 +```json +{ + "mcpServers": { + "alibaba_cloud_observability": { + "command": "uv", + "args": [ + "--directory", + "/path/to/your/alibabacloud-observability-mcp-server", + "run", + "mcp-server-aliyun-observability" + ], + "env": { + "ALIBABA_CLOUD_ACCESS_KEY_ID": "", + "ALIBABA_CLOUD_ACCESS_KEY_SECRET": "" + } + } + } +} +``` +1. 使用 stdio 启动方式-从 module 启动 +```json +{ + "mcpServers": { + "alibaba_cloud_observability": { + "command": "uv", + "args": [ + "run", + "mcp-server-aliyun-observability" + ], + "env": { + "ALIBABA_CLOUD_ACCESS_KEY_ID": "", + "ALIBABA_CLOUD_ACCESS_KEY_SECRET": "" + } + } + } +} +``` + + + + + diff --git a/start-mcp-tablestore-openmemory/src/s.yaml b/start-mcp-tablestore-openmemory/src/s.yaml new file mode 100644 index 0000000..42943d0 --- /dev/null +++ b/start-mcp-tablestore-openmemory/src/s.yaml @@ -0,0 +1,19 @@ +edition: 3.0.0 +name: mcp-server-app +access: "{{ access }}" + +vars: # + region: "{{ region }}" + +resources: + mcp-tablestore-openmemory: + component: fcai-mcp-server + props: + region: ${vars.region} + description: mcp server deployed by devs + transport: stdio + runtime: python3.10 + startCommand: 'tablestore-openmemory-mcp --local-timezone=$TZ' + cpu: 0.5 + memorySize: 512 + instanceQuota: 1 \ No newline at end of file diff --git a/start-mcp-tablestore-openmemory/src/variable.yaml b/start-mcp-tablestore-openmemory/src/variable.yaml new file mode 100644 index 0000000..e0f7a37 --- /dev/null +++ b/start-mcp-tablestore-openmemory/src/variable.yaml @@ -0,0 +1,181 @@ +services: + mcp-tablestore-openmemory: + SERVER_HOST: + title: SERVER_HOST + type: string + default: 0.0.0.0 + description: MCP server 的 host + + SERVER_PORT: + title: SERVER_PORT + type: string + default: 8765 + description: MCP server 的 port + + TABLESTORE_INSTANCE_NAME: + title: TABLESTORE_INSTANCE_NAME + type: string + default: "" + required: true + description: 实例名 + + TABLESTORE_ENDPOINT: + title: TABLESTORE_ENDPOINT + type: string + default: "" + required: true + description: 实例访问地址 + + TABLESTORE_ACCESS_KEY_ID: + title: TABLESTORE_ACCESS_KEY_ID + type: string + default: "" + required: true + sensitive: true + description: 秘钥 ID + + TABLESTORE_ACCESS_KEY_SECRET: + title: TABLESTORE_ACCESS_KEY_SECRET + type: string + default: "" + required: true + sensitive: true + description: 秘钥 SECRET + + TABLESTORE_STS_TOKEN: + title: TABLESTORE_STS_TOKEN + type: string + default: "" + description: STS Token + + TABLESTORE_VECTOR_DIMENSION: + title: TABLESTORE_VECTOR_DIMENSION + type: string + default: 1536 + description: 向量维度 + + OPENAI_API_KEY: + title: OPENAI_API_KEY + type: string + default: "" + required: true + sensitive: true + description: 百炼API KEY + + OPENAI_BASE_URL: + title: OPENAI_BASE_URL + type: string + default: "" + required: true + description: 兼容 OpenAI 的大模型的 URL + + LLM_MODEL: + title: LLM_MODEL + type: string + default: qwen-plus + description: 大语言模型的名字 + + EMBEDDER_MODEL: + title: EMBEDDER_MODEL + type: string + default: text-embedding-v4 + description: 编码模型的名字 + + TOOL_ADD_MEMORIES_DESCRIPTION: + title: TOOL_ADD_MEMORIES_DESCRIPTION + type: string + default: "" + description: 添加记忆的MCP TOOL描述文字 + + TOOL_SEARCH_MEMORIES_DESCRIPTION: + title: TOOL_SEARCH_MEMORIES_DESCRIPTION + type: string + default: "" + description: 检索记忆的MCP TOOL描述文字 + + TOOL_LIST_MEMORIES_DESCRIPTION: + title: TOOL_LIST_MEMORIES_DESCRIPTION + type: string + default: "" + description: 显示所有记忆的MCP TOOL描述文字 + + TOOL_DELETE_ALL_MEMORIES_DESCRIPTION: + title: TOOL_DELETE_ALL_MEMORIES_DESCRIPTION + type: string + default: "" + description: 删除所有记忆的MCP TOOL描述文字 + + MCP_STDIO_USER_ID: + title: MCP_STDIO_USER_ID + type: string + default: stdio_default_user + description: stdio模式下使用的用户id + + MCP_STDIO_CLIENT_NAME: + title: MCP_STDIO_CLIENT_NAME + type: string + default: stdio_default_client + description: stdio模式下使用的客户端名 + + + + + # TABLESTORE_TABLE_NAME: + # title: TABLESTORE_TABLE_NAME + # type: string + # default: ts_mcp_server_py_v1 + # description: 表名 + + # TABLESTORE_INDEX_NAME: + # title: TABLESTORE_INDEX_NAME + # type: string + # default: ts_mcp_server_py_index_v1 + # description: 索引名 + + # TABLESTORE_VECTOR_DIMENSION: + # title: TABLESTORE_VECTOR_DIMENSION + # type: string + # default: 768 + # description: 向量维度 + + # TABLESTORE_TEXT_FIELD: + # title: TABLESTORE_TEXT_FIELD + # type: string + # default: _content + # description: 文本字段名 + + # TABLESTORE_VECTOR_FIELD: + # title: TABLESTORE_VECTOR_FIELD + # type: string + # default: _embedding + # description: 向量字段名 + + # EMBEDDING_PROVIDER_TYPE: + # title: EMBEDDING_PROVIDER_TYPE + # type: string + # default: hugging_face + # description: "Embedding 模型提供者: 目前包括:hugging_face、dashscope" + + # EMBEDDING_MODEL_NAME: + # title: EMBEDDING_MODEL_NAME + # type: string + # default: BAAI/bge-base-zh-v1.5 + # description: Embedding 模型名字 + + # DASHSCOPE_API_KEY: + # title: DASHSCOPE_API_KEY + # type: string + # default: "" + # description: 百炼的API_KEY(当EMBEDDING_PROVIDER_TYPE为 dashscope 时候,需要提供该参数) + + # TOOL_STORE_DESCRIPTION: + # title: TOOL_STORE_DESCRIPTION + # type: string + # default: "" + # description: 写入的 MCP tool 的描述文字 + + # TOOL_SEARCH_DESCRIPTION: + # title: TOOL_SEARCH_DESCRIPTION + # type: string + # default: "" + # description: 查询的 MCP tool 的描述文字 \ No newline at end of file diff --git a/start-mcp-tablestore-openmemory/version.md b/start-mcp-tablestore-openmemory/version.md new file mode 100644 index 0000000..4ee89d2 --- /dev/null +++ b/start-mcp-tablestore-openmemory/version.md @@ -0,0 +1,2 @@ +- 初始化项目 +- 测试项目模板 \ No newline at end of file