Command Palette

Search for a command to run...

UnylyUnyly
Весь каталог

Cls

БесплатноНе проверен

Tencent Cloud Log Service (CLS) MCP Server

GitHubEmbed

Описание

Tencent Cloud Log Service (CLS) MCP Server

README

npm version license

English | 中文

Tencent Cloud Log Service (CLS) MCP Server, built on the Model Context Protocol. It enables large language models to directly access CLS capabilities such as log search, metric queries, and alarm management — no code required.

📖 Tencent Cloud Official Documentation

Features

Log Search

Tool Description
SearchLog Search logs based on query conditions (CQL syntax)
DescribeLogContext Retrieve the context (preceding and following N entries) of a specific log
TextToSearchLogQuery Convert natural language descriptions into CLS query statements (CQL expert)
DescribeLogHistogram Get log distribution histogram data within a specified time range
DescribeIndex Get index configuration of a log topic (fields, full-text index, etc.)

Metric Query

Tool Description
QueryMetric Query real-time values of metric topics (PromQL syntax)
QueryRangeMetric Query metric data trends over a time range

Alarm Management

Tool Description
DescribeAlarms List alarm policies with filtering support
DescribeAlertRecordHistory Query alarm trigger/recovery history records
GetAlarmLog Query alarm execution detail logs
DescribeAlarmNotices List notification channel groups (email, SMS, WeChat, etc.)
DescribeAlarmShields List alarm shield rules for a notification channel group
DescribeNoticeContents List notification content templates
DescribeWebCallbacks List webhook callback configurations
GetAlarmDetail Get alarm details by parsing alarm notification URL (supports short/long links)

Utilities

Tool Description
DescribeTopics Search log or metric topics by name, ID, or logset
DescribeLogsets List logset containers with filtering support
GetRegionCodeByName Get Tencent Cloud region codes by region name
ConvertTimeStringToTimestamp Convert time strings to timestamps
ConvertTimestampToTimeString Convert timestamps to time strings

Use Cases

  • Natural Language Log Query — Search logs using natural language without mastering complex query syntax, significantly reducing the barrier to log analysis.
  • Intelligent O&M Troubleshooting — Integrate into O&M workflows to intelligently analyze system anomalies and quickly locate root causes.
  • Automated Query Generation — Automatically generate CLS query statements from natural language via TextToSearchLogQuery, enabling more precise and efficient log retrieval.
  • Business Metric Monitoring — Query and monitor real-time metric values and historical trends to keep track of system health.
  • Alarm Management & Analysis — View alarm policies, query alarm trigger/recovery history, and analyze alarm execution details to quickly understand alerting status.

Configuration

Parameter Required Default Description
TRANSPORT No stdio MCP transport mode: stdio, http (Streamable HTTP), or sse
TENCENTCLOUD_SECRET_ID Yes - Tencent Cloud API SecretId
TENCENTCLOUD_SECRET_KEY Yes - Tencent Cloud API SecretKey
TENCENTCLOUD_API_BASE_HOST No tencentcloudapi.com Tencent Cloud API base host. Use internal.tencentcloudapi.com in VPC intranet environments
MCP_AUTH_TOKEN No - Bearer token for http / sse mode. When set, every request (except /health) must send Authorization: Bearer <token>. This is a minimum safeguard only — see Security.
MAX_LENGTH No Unlimited Max response length, used to fit model token limits
PORT No 3000 Server port for http / sse mode
TZ No System timezone Timezone setting, e.g. Asia/Shanghai. Used by time conversion tools (ConvertTimeStringToTimestamp, ConvertTimestampToTimeString)

Security

⚠️ Read this before exposing the server over a network.

This server runs with a single set of Tencent Cloud credentials (TENCENTCLOUD_SECRET_ID / TENCENTCLOUD_SECRET_KEY). Anyone who can reach the http / sse endpoint can invoke every tool and read all logs those credentials are allowed to access. Authentication and network isolation are therefore the deployer's responsibility.

Security is expected to be provided by how you deploy the server. You are responsible for ensuring the endpoint is not reachable by untrusted parties — for example by:

  • Deploying inside a VPC / private network and never exposing it to the public internet.
  • Placing it behind an API gateway, reverse proxy, or ingress that enforces authentication (SSO / JWT / mTLS / IP allowlist).
  • Restricting the credentials to a least-privilege CAM sub-account (only the CLS actions and resources actually needed).

Bearer Token (minimum safeguard)

As a basic, built-in layer, the server supports an optional static Bearer token. When MCP_AUTH_TOKEN is set, every request except /health must include:

Authorization: Bearer <MCP_AUTH_TOKEN>

Unauthenticated requests receive 401 Unauthorized. To use it, add the header in your MCP client configuration:

{
  "mcpServers": {
    "cls-mcp-server": {
      "name": "cls-mcp-server",
      "type": "http",
      "isActive": true,
      "url": "http://localhost:3000/mcp",
      "headers": {
        "Authorization": "Bearer <MCP_AUTH_TOKEN>"
      }
    }
  }
}

This Bearer token only satisfies the most basic security need. It is a single shared secret with no per-user isolation, no rotation, and no scoping. It reduces the risk of casual/unauthorized access but does not make the service safe to expose publicly. Do not run this server as a public internet endpoint on the strength of the Bearer token alone — keep it behind network and gateway controls as described above.

When running in stdio mode, no HTTP endpoint is exposed and no token is needed; credentials are taken from the environment of the local host.

Getting Started

Option 1: NPX (Recommended for Local Deployment)

Add the following to your MCP client's mcpServers configuration:

Prerequisites: Install Node.js (LTS version recommended) and obtain Tencent Cloud SecretId and SecretKey.

{
  "mcpServers": {
    "cls-mcp-server": {
      "isActive": true,
      "name": "cls-mcp-server",
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "cls-mcp-server@latest"
      ],
      "env": {
        "TRANSPORT": "stdio",
        "TENCENTCLOUD_SECRET_ID": "<YOUR_SECRET_ID>",
        "TENCENTCLOUD_SECRET_KEY": "<YOUR_SECRET_KEY>",
        "TZ": "Asia/Shanghai"
      }
    }
  }
}

To deploy within a Tencent Cloud VPC, add "TENCENTCLOUD_API_BASE_HOST": "internal.tencentcloudapi.com" to env.

Option 2: Self-hosted Streamable HTTP Mode

Prerequisites: Install Node.js (LTS version recommended) and obtain Tencent Cloud SecretId and SecretKey.

This server runs Streamable HTTP in stateless mode — each request is independent, which makes it suitable for containerized deployments and horizontal scaling.

  1. Create a .env file in the current directory:
TRANSPORT=http
TENCENTCLOUD_SECRET_ID=<YOUR_SECRET_ID>
TENCENTCLOUD_SECRET_KEY=<YOUR_SECRET_KEY>
# Uncomment the following line if deploying within a Tencent Cloud VPC
# TENCENTCLOUD_API_BASE_HOST=internal.tencentcloudapi.com
# Optional: enable the built-in Bearer token (recommended, see Security section)
# MCP_AUTH_TOKEN=<A_LONG_RANDOM_STRING>
PORT=3000
TZ=Asia/Shanghai
  1. Start the server:
npx -y cls-mcp-server@latest
  1. Configure your MCP client:
{
  "mcpServers": {
    "cls-mcp-server": {
      "name": "cls-mcp-server",
      "type": "http",
      "isActive": true,
      "url": "http://localhost:3000/mcp"
    }
  }
}

If you enabled MCP_AUTH_TOKEN, add "headers": { "Authorization": "Bearer <MCP_AUTH_TOKEN>" } to the client configuration above.

Option 3: Self-hosted SSE Mode

Prerequisites: Install Node.js (LTS version recommended) and obtain Tencent Cloud SecretId and SecretKey.

  1. Create a .env file in the current directory:
TRANSPORT=sse
TENCENTCLOUD_SECRET_ID=<YOUR_SECRET_ID>
TENCENTCLOUD_SECRET_KEY=<YOUR_SECRET_KEY>
# Uncomment the following line if deploying within a Tencent Cloud VPC
# TENCENTCLOUD_API_BASE_HOST=internal.tencentcloudapi.com
# Optional: enable the built-in Bearer token (recommended, see Security section)
# MCP_AUTH_TOKEN=<A_LONG_RANDOM_STRING>
PORT=3000
TZ=Asia/Shanghai
  1. Start the server:
npx -y cls-mcp-server@latest
  1. Configure your MCP client:
{
  "mcpServers": {
    "cls-mcp-server": {
      "name": "cls-mcp-server",
      "type": "sse",
      "isActive": true,
      "baseUrl": "http://localhost:3000/sse"
    }
  }
}

If you enabled MCP_AUTH_TOKEN, add "headers": { "Authorization": "Bearer <MCP_AUTH_TOKEN>" } to the SSE client configuration above — the SDK sends it on both the GET /sse connection and every POST /messages.

Option 4: Install from Source

Prerequisites: Install Node.js (LTS version recommended) and obtain Tencent Cloud SecretId and SecretKey.

  1. Clone the repository and build:
git clone <repository-url>
cd cls-mcp-server
npm install
npm run build
  1. Stdio Mode — Add the following to your MCP client's mcpServers configuration:
{
  "mcpServers": {
    "cls-mcp-server": {
      "isActive": true,
      "name": "cls-mcp-server",
      "type": "stdio",
      "command": "node",
      "args": [
        "/ABSOLUTE/PATH/TO/cls-mcp-server/dist/index.js"
      ],
      "env": {
        "TRANSPORT": "stdio",
        "TENCENTCLOUD_SECRET_ID": "<YOUR_SECRET_ID>",
        "TENCENTCLOUD_SECRET_KEY": "<YOUR_SECRET_KEY>",
        "TZ": "Asia/Shanghai"
      }
    }
  }
}

To deploy within a Tencent Cloud VPC, add "TENCENTCLOUD_API_BASE_HOST": "internal.tencentcloudapi.com" to env.

  1. Streamable HTTP Mode — Create a .env file in the project root:
TRANSPORT=http
TENCENTCLOUD_SECRET_ID=<YOUR_SECRET_ID>
TENCENTCLOUD_SECRET_KEY=<YOUR_SECRET_KEY>
# Uncomment the following line if deploying within a Tencent Cloud VPC
# TENCENTCLOUD_API_BASE_HOST=internal.tencentcloudapi.com
# Optional: enable the built-in Bearer token (recommended, see Security section)
# MCP_AUTH_TOKEN=<A_LONG_RANDOM_STRING>
PORT=3000
TZ=Asia/Shanghai

Start the server:

npm run start

Then configure your MCP client:

{
  "mcpServers": {
    "cls-mcp-server": {
      "name": "cls-mcp-server",
      "type": "http",
      "isActive": true,
      "url": "http://localhost:3000/mcp"
    }
  }
}

If you enabled MCP_AUTH_TOKEN, add "headers": { "Authorization": "Bearer <MCP_AUTH_TOKEN>" } to the client configuration.

  1. SSE Mode — Create a .env file in the project root:
TRANSPORT=sse
TENCENTCLOUD_SECRET_ID=<YOUR_SECRET_ID>
TENCENTCLOUD_SECRET_KEY=<YOUR_SECRET_KEY>
# Uncomment the following line if deploying within a Tencent Cloud VPC
# TENCENTCLOUD_API_BASE_HOST=internal.tencentcloudapi.com
# Optional: enable the built-in Bearer token (recommended, see Security section)
# MCP_AUTH_TOKEN=<A_LONG_RANDOM_STRING>
PORT=3000
TZ=Asia/Shanghai

Start the server:

npm run start

Then configure your MCP client:

{
  "mcpServers": {
    "cls-mcp-server": {
      "name": "cls-mcp-server",
      "type": "sse",
      "isActive": true,
      "baseUrl": "http://localhost:3000/sse"
    }
  }
}

If you enabled MCP_AUTH_TOKEN, add "headers": { "Authorization": "Bearer <MCP_AUTH_TOKEN>" } to the SSE client configuration — the SDK sends it on both GET /sse and every POST /messages.

Option 5: Docker Deployment

Prerequisites: Install Docker and obtain Tencent Cloud SecretId and SecretKey.

  1. Build the Docker image:
docker build -t cls-mcp-server .
  1. Run the container (Streamable HTTP mode, default):

To deploy within a Tencent Cloud VPC, add -e TENCENTCLOUD_API_BASE_HOST=internal.tencentcloudapi.com.

docker run -d -p 3000:3000 \
  -e TENCENTCLOUD_SECRET_ID=<YOUR_SECRET_ID> \
  -e TENCENTCLOUD_SECRET_KEY=<YOUR_SECRET_KEY> \
  -e TZ=Asia/Shanghai \
  --name cls-mcp-server \
  cls-mcp-server

To run the SSE transport instead, add -e TRANSPORT=sse and point the client at /sse with "type": "sse".

To enable the built-in Bearer token, add -e MCP_AUTH_TOKEN=<A_LONG_RANDOM_STRING>. This is a minimum safeguard — do not expose the container port publicly. See Security.

  1. Configure your MCP client:
{
  "mcpServers": {
    "cls-mcp-server": {
      "name": "cls-mcp-server",
      "type": "http",
      "isActive": true,
      "url": "http://localhost:3000/mcp"
    }
  }
}

License

Apache License 2.0

from github.com/Tencent/cls-mcp-server

Установка Cls

У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.

▸ github.com/Tencent/cls-mcp-server

FAQ

Cls MCP бесплатный?

Да, Cls MCP бесплатный — установка в пару кликов через Unyly без оплаты.

Нужен ли API-ключ для Cls?

Да, требуются переменные окружения: TENCENTCLOUD_SECRET_ID, TENCENTCLOUD_SECRET_KEY, TRANSPORT. Unyly подставит их в конфиг при установке.

Cls — hosted или self-hosted?

Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.

Как установить Cls в Claude Desktop, Claude Code или Cursor?

Открой Cls на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.

Изменения

Версии и запрашиваемые доступы со временем.

  • Новая версия опубликована
  • Новая версия опубликована
  • Новая версия опубликована
  • Новая версия опубликована

Похожие MCP

Compare Cls with

Не уверен что выбрать?

Найди свой стек за 60 секунд

Автор?

Embed-бейдж для README

Похожее

Все в категории development