Sensors MCP Server

Sensors MCP Server

Enables AI assistants to query and analyze user behavior data from the Sensors Analytics platform using natural language.

Category
Visit Server

README

Sensors MCP Server

基于 MCP(Model Context Protocol) 的神策分析数据服务,让 AI 助手通过自然语言直接查询和分析神策平台中的用户行为数据。

功能概览

工具 说明
get_sensors_config 获取当前神策配置信息(调试用)
verify_sensors_config 验证 API 连通性和认证有效性
list_events_all 获取项目中的全部事件列表
list_event_tags 获取事件标签分类信息
get_event_properties 获取指定事件的属性定义
list_event_properties_all 获取所有事件的属性列表
query_segmentation_report 事件分析查询(次数、人数、维度拆分、筛选过滤)

快速开始

1. 安装依赖

npm install

2. 配置环境变量

复制 .env.example.env,填写你的神策分析配置:

cp .env.example .env
SA_URL=https://your-sensors-analytics-url
SA_PROJECT=your_project_name
SA_API_KEY=your_api_key
SA_API_SECRET=your_api_secret  # 可选

API Key 在神策后台「项目管理 → 数据接口」中获取。

3. 编译与启动

# 编译
npm run build

# 生产模式
npm start

# 开发模式(直接运行 TypeScript,改完代码重启即可)
npm run dev

接入 MCP 客户端

QoderWork / Claude Desktop

在 MCP 设置中添加 Server,配置启动命令:

{
  "mcpServers": {
    "sensors": {
      "command": "node",
      "args": ["/path/to/SensorsMCPServer/dist/index.js"],
      "env": {
        "SA_URL": "https://your-sensors-analytics-url",
        "SA_PROJECT": "your_project_name",
        "SA_API_KEY": "your_api_key"
      }
    }
  }
}

MCP Server 使用 stdio 协议通信,由客户端启动和管理进程,无需手动运行。

调试

推荐使用 MCP Inspector 进行调试:

npx @modelcontextprotocol/inspector node dist/index.js

启动后访问 http://localhost:6274,可以手动调用工具、查看请求和响应。

使用示例

接入 MCP 客户端后,直接用自然语言提问即可:

查询上月左侧菜单点击事件的次数和人数
web_workgroup_nav_menu_cli 事件有哪些属性?
查询上月左侧菜单点击情况,按用户和菜单名拆分

AI 会自动探索事件元数据、构建查询参数、调用 API 并解读结果。

项目结构

src/
├── index.ts                 # MCP Server 入口,工具注册与请求路由
├── config.ts                # 环境变量配置管理
└── tools/
    ├── event-meta.ts        # 事件列表与标签查询
    ├── property-meta.ts     # 事件属性查询
    └── segmentation.ts      # 事件分析报告查询

技术栈

  • 运行环境:Node.js(ES2022+)
  • 开发语言:TypeScript 5.x
  • MCP SDK:@modelcontextprotocol/sdk ^0.6.0
  • 通信协议:stdio
  • API 规范:神策分析 OpenAPI v3
  • 认证方式:Header 认证(api-key + sensorsdata-project)

License

ISC

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured