Skip to main content

MCP Server for Tencent Cloud TKE

Project description

腾讯云 TKE MCP Server(中文版)

腾讯云容器服务(TKE) Model Context Protocol (MCP) 服务器,提供标准化的TKE集群管理接口。

功能特性

  • 集群生命周期管理:创建、删除、修改属性、查询列表
  • 动态工具加载:支持通过McpAPI YAML文件自动生成MCP工具
  • 模拟模式支持:在没有腾讯云凭证时使用模拟响应
  • 完整参数验证:严格的输入参数验证和错误处理

工具列表(Tools)

静态工具

工具名称 功能说明
CreateCluster 创建TKE集群

动态工具(通过McpAPI文件自动生成)

API 版本 2018-05-25

工具名称 功能说明
DescribeClusters 查询集群列表
DescribeClusterStatus 查看集群状态列表
DescribeClusterKubeconfig 获取集群kubeconfig
DeleteCluster 删除集群
ModifyClusterAttribute 修改集群属性
CreateClusterEndpoint 创建集群访问端点
DeleteClusterEndpoint 删除集群访问端点
DescribeClusterEndpoints 查询集群访问端点
DescribeClusterEndpointStatus 查询集群端点状态
EnableClusterDeletionProtection 开启集群删除保护
DisableClusterDeletionProtection 关闭集群删除保护

API 版本 2022-05-01

工具名称 功能说明
DescribeNodePools 查询节点池列表

快速开始

1. 准备腾讯云凭证

  • 登录 腾讯云控制台,进入「访问管理」→「访问密钥」获取 SecretIdSecretKey

2. 配置环境变量

export TENCENTCLOUD_SECRET_ID=你的SecretId
export TENCENTCLOUD_SECRET_KEY=你的SecretKey

3. 安装

# 从PyPI安装
pip install tke-mcp-server

# 或从源码安装
pip install .

4. 启动服务器

# 直接运行
uv run tke-mcp-server

# 或通过Python模块
python -m mcp_server_tke

5. Claude Desktop 配置

编辑 claude_desktop_config.json(Mac 默认路径 ~/Library/Application Support/Claude/claude_desktop_config.json),加入:

{
  "mcpServers": {
    "tencent-tke": {
      "command": "uv",
      "args": ["run", "tke-mcp-server"],
      "env": {
        "TENCENTCLOUD_SECRET_ID": "你的SecretId",
        "TENCENTCLOUD_SECRET_KEY": "你的SecretKey"
      }
    }
  }
}

开发贡献

开发工具安装

npm install -g --registry=https://mirrors.tencent.com/npm @tencent/codebuddy-cli

项目结构

tke-mcp/
├── src/mcp_server_tke/          # 主源代码目录
│   ├── __init__.py             # 模块入口点
│   ├── server.py               # MCP服务器主逻辑
│   ├── tool_tke.py             # TKE静态工具实现
│   ├── client.py               # 腾讯云客户端封装
│   ├── mcpapi_loader.py        # McpAPI YAML文件加载器
│   ├── dynamic_tool_handler.py # 动态工具处理器
│   └── mcpapi/                 # 动态工具定义文件
├── openapi/                    # 云API导出的OpenAPI源文件
├── tests/                      # 单元测试
├── docs/                       # 文档
└── pyproject.toml              # Python项目配置

AI 辅助扩展开发

添加新工具

有两种方式添加新工具:

1. 静态工具(在代码中实现)

  1. tool_tke.py 中添加新函数
  2. server.pyhandle_list_tools() 中添加工具定义
  3. handle_call_tool() 中添加调用逻辑

2. 动态工具(通过YAML文件)

  1. 使用CodeBuddy CLI的/yunapiCommand,可以将云API转成MCP。
/yunapi openapi/tke_2018-05-25_DescribeClusterKubeconfig.json

测试

# 运行所有测试
python -m unittest discover tests/

# 运行特定测试
python -m unittest tests/test_tool_tke.py
python -m unittest tests/test_mcp_integration.py

构建包

# 使用hatch构建
hatch build

许可证

MIT License,详见 LICENSE 文件。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tke_mcp_server-0.0.8.tar.gz (87.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tke_mcp_server-0.0.8-py3-none-any.whl (35.1 kB view details)

Uploaded Python 3

File details

Details for the file tke_mcp_server-0.0.8.tar.gz.

File metadata

  • Download URL: tke_mcp_server-0.0.8.tar.gz
  • Upload date:
  • Size: 87.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.3

File hashes

Hashes for tke_mcp_server-0.0.8.tar.gz
Algorithm Hash digest
SHA256 f70f160cdc64e4492ddb1cdfda17d53f741cac291018dc05e4b66ae52603a001
MD5 17a5cf1bd80def37f5a04581e3286c1b
BLAKE2b-256 a9ed5121ffb3c30cb5caa89d4e393cafc74ec10fe05c277580787c509031a24e

See more details on using hashes here.

File details

Details for the file tke_mcp_server-0.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for tke_mcp_server-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 9ebd88636230c3ce94923055d255afc0f8f1d39365e1e0da6b559c2b1cf5c00e
MD5 a3c1bd13a66ddc1c154af785a5a06851
BLAKE2b-256 b3556ade7d6688d70d6b5b19f84f9c066f21d7126ed7ff2adc1d712870f5fdfd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page