Tencent Cloud Log Service MCP Server
raw JSON → 1.0.3 verified Sat Apr 25 auth: no javascript
CLS MCP Server (v1.0.3) connects LLMs (e.g., Claude, GPT) to Tencent Cloud Log Service via the Model Context Protocol. Provides 17+ tools for log search (CQL), metric queries (PromQL), alarm management, time conversion, and region lookup. Requires Tencent Cloud API credentials. Active development on GitHub (Tencent), supports stdio and SSE transports, Node.js 18–22. Distinct from generic MCP servers by deep CLS integration, natural language query translation, and built-in alarm workflow tools.
Common errors
error Error: Missing required environment variable: TENCENTCLOUD_SECRET_ID ↓
cause Tencent Cloud API credentials not provided.
fix
Set TENCENTCLOUD_SECRET_ID and TENCENTCLOUD_SECRET_KEY in the environment.
error TypeError: (0 , ...) is not a function ↓
cause Default import used as named import in CommonJS context.
fix
Use 'const runServer = require('cls-mcp-server').default' for CommonJS.
error Error: Invalid transport: http. Must be 'stdio' or 'sse' ↓
cause TRANSPORT environment variable set to an unsupported value.
fix
Set TRANSPORT to 'stdio' or 'sse'.
error Error: connect ETIMEDOUT ↓
cause Network issue or incorrect TENCENTCLOUD_API_BASE_HOST (e.g., using internal host outside VPC).
fix
Use the default 'tencentcloudapi.com' when not in Tencent Cloud VPC.
Warnings
gotcha The transport mode is determined by the TRANSPORT environment variable (default 'stdio'), not by a parameter. Setting it incorrectly will cause the server to not start. ↓
fix Ensure TRANSPORT is set to 'stdio' or 'sse' in environment, or pass in options if supported.
breaking Node.js versions below 18 are not supported. The engine requirement is '>=18 <=22'. ↓
fix Use Node.js 18, 20, or 22.
deprecated The 'maxTokenLength' option (if any) is deprecated; use 'maxLength' instead. ↓
fix Rename parameter to 'maxLength'.
gotcha The 'secretId' and 'secretKey' are required but commonly mistaken as optional. If missing, the server will fail to authenticate with Tencent Cloud API. ↓
fix Set TENCENTCLOUD_SECRET_ID and TENCENTCLOUD_SECRET_KEY environment variables.
breaking Environment variable names changed from old naming (e.g., SECRET_ID) to TENCENTCLOUD_SECRET_ID in v1.0.0. ↓
fix Use the new prefixed variable names.
Install
npm install cls-mcp-server yarn add cls-mcp-server pnpm add cls-mcp-server Imports
- default export wrong
import { server } from 'cls-mcp-server'correctimport server from 'cls-mcp-server' - CLSMCPServer wrong
const { CLSMCPServer } = require('cls-mcp-server')correctimport CLSMCPServer from 'cls-mcp-server' - runServer
import runServer from 'cls-mcp-server'
Quickstart
import runServer from 'cls-mcp-server';
await runServer({
transport: 'stdio',
secretId: process.env.TENCENTCLOUD_SECRET_ID ?? '',
secretKey: process.env.TENCENTCLOUD_SECRET_KEY ?? '',
region: 'ap-guangzhou',
maxLength: 10000,
timezone: 'Asia/Shanghai'
});