内容
<!-- markdownlint-disable MD033 -->
# Sentor MCP 服务器
<img src="https://raw.githubusercontent.com/NIKX-Tech/sentor-mcp/prod/logo.png" width="70" alt="Sentor Logo">
**基于实体的情感分析,适用于 Claude、Cursor、Windsurf 及任何与 MCP 兼容的 AI 助手。**
[](https://pypi.org/project/sentor-mcp/)
[](https://pypi.org/project/sentor-mcp/)
[](https://opensource.org/licenses/MIT)
[](https://github.com/NIKX-Tech/sentor-mcp/stargazers)
<br>
[](https://sentor.app)
[](https://dashboard.sentor.app/settings?tab=api-access)
[](https://sentor.app/docs/integrations/mcp)
Sentor 是一个基于实体的情感分析平台,由精细调整的 BERT 模型提供支持。该 MCP 服务器将 Sentor 的机器学习 API 公开为您的 AI 助手可以直接调用的工具 - 在文本中评估对特定实体的情感,按主题聚类文档,并从单个自然语言提示中生成主题标签。
---
## 目录
- [功能介绍](#-功能介绍)
- [要求](#-要求)
- [快速入门](#-快速入门)
- [Claude 桌面版](#claude-桌面版)
- [Cursor / Windsurf](#cursor--windsurf)
- [Claude.ai 网页(远程 MCP)](#claudeai-网页远程-mcp)
- [工具参考](#-工具参考)
- [使用示例](#-使用示例)
- [速率限制](#-速率限制)
- [远程部署](#-远程部署)
- [链接](#-链接)
---
## 🎯 功能介绍
连接后,您的 AI 助手将获得四个工具:
| 工具 | 功能 |
|------|-------------|
| `analyze_sentiment` | 评估一个或多个文档中对命名实体的情感(品牌、产品、功能、人)。返回每个文档和每个句子的明细。 |
| `cluster_documents` | 使用 BERTopic + HDBSCAN 将 5+ 个文档分组为主题集群。自动发现集群数量。 |
| `name_topic` | 为每个集群生成一个 3-5 个字的描述性标签(例如“Shipping Delay Complaints”)。 |
| `health_check` | 验证 Sentor API 是否可达且 ML 模型是否已加载。 |
**设置后的示例提示:**
> *"分析这 50 篇客户评论中对我们的结账流程和配送速度的情感。然后按主题聚类并为每个集群命名。"*
---
## 📋 要求
- Python 3.10+
- Sentor API 密钥 - [在 dashboard.sentor.app 上免费获取](https://dashboard.sentor.app/settings?tab=api-access)
---
## 🚀 快速入门
### Claude 桌面版
**macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
**Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
```json
{
"mcpServers": {
"sentor": {
"command": "uvx",
"args": ["sentor-mcp"],
"env": {
"SENTOR_API_KEY": "your_api_key_here"
}
}
}
}
```
重启 Claude 桌面版。工具选择器中出现一个锤子图标 - Sentor 已就绪。
> **没有 `uvx`?** 使用 `pip install uv` 安装它,或在 `pip install sentor-mcp` 后直接使用 `sentor-mcp`。
---
### Cursor / Windsurf
添加到 `.cursor/mcp.json`(项目级)或 `~/.cursor/mcp.json`(全局):
```json
{
"mcpServers": {
"sentor": {
"command": "uvx",
"args": ["sentor-mcp"],
"env": {
"SENTOR_API_KEY": "your_api_key_here"
}
}
}
}
```
---
### Claude.ai 网页(远程 MCP)
运行 HTTP 服务器并通过 URL 连接:
```bash
docker run -e SENTOR_API_KEY=your_api_key -p 8080:8080 ghcr.io/nikx-tech/sentor-mcp:latest
```
然后在 Claude.ai → 设置 → 集成 → 添加 MCP 服务器:
```
http://your-server:8080/sse
```
---
## 🔧 工具参考
### `analyze_sentiment(docs, language="en")`
分析一个或多个文档中对实体的情感。
```python
docs = [
{
"doc_id": "review-1",
"doc": "配送很快,但包装完全碎了。",
"entities": ["delivery", "packaging"]
}
]
# 返回:predicted_label, probabilities, per-sentence details
```
**支持的语言:** `en`(英语), `nl`(荷兰语)
---
### `cluster_documents(documents, language="en")`
将文档分组为主题集群。需要至少 5 个文档。
```python
documents = [
{"doc_id": "r1", "text": "产品质量很好,很满意。", "entities": ["product"]},
# ... 至少 5 个文档
]
# 返回:clusters with cluster_id, document_count, documents, top_words
# Cluster -1 = 不符合任何主题的异常值
```
---
### `name_topic(cluster_id, documents, top_words, entities, language="en")`
为集群生成一个短标签。直接传递 `cluster_documents` 输出的数据。
```python
name_topic(
cluster_id=0,
documents=cluster["documents"],
top_words=cluster["top_words"],
entities=["BrandName"], # 从标签中排除您的品牌
language="en"
)
# 返回:{ "topic_name": "Shipping Delay Complaints", "generation_method": "LLM" }
```
---
### `health_check()`
```python
# 返回:{ "status": "healthy", "version": "1.0.0", "llm_status": "available" }
```
---
## 💬 使用示例
**单个文档:**
> *"使用 Sentor 分析此评论中对 Apple 和 iPhone 的情感:[粘贴文本]"*
**批量分析:**
> *"我有 100 篇客户评论。使用 Sentor 评估每篇评论中对 'delivery' 和 'support' 的情感,然后告诉我正面的比例。"*
**完整流程:**
> *"使用 Sentor:1) 分析这 200 篇评论中对 'product quality' 和 'price' 的情感,2) 按主题聚类,3) 为每个集群命名,4) 总结发现。"*
**竞争分析:**
> *"使用 Sentor 分析这些推文对 Apple、Samsung 和 Google 的情感,然后比较结果。"*
---
## 📊 速率限制
| 计划 | 每分钟 | 每日 | 每月 | 项目 | AI 报告 |
|------|-----------|---------|-----------|----------|------------|
| **免费** | 5 | 100 | 1,000 | 3 | 2/月 |
| **入门** | 20 | 600 | 5,000 | 5 | 15/月 |
| **成长** | 60 | 3,000 | 25,000 | 15 | 50/月 |
| **商业** | 200 | 10,000 | 100,000 | 50 | 200/月 |
| **企业** | 500 | 30,000 | 500,000 | 无限 | 无限 |
[查看完整定价 →](https://sentor.app/pricing)
---
## 🐳 远程部署
为支持远程 MCP 端点的 AI 工具运行托管的 HTTP/SSE 服务器。
**Docker:**
```bash
docker build -t sentor-mcp .
docker run \
-e SENTOR_API_KEY=your_key \
-p 8080:8080 \
sentor-mcp
```
服务器暴露:
- `GET /sse` — SSE 流(MCP 传输)
- `POST /messages` — 消息端点
**环境变量:**
| 变量 | 默认值 | 描述 |
|----------|---------|-------------|
| `SENTOR_API_KEY` | — | **必填。** 您的 Sentor API 密钥。 |
| `SENTOR_BASE_URL` | `https://sentor.app/api` | 覆盖以指向自托管的 Sentor 实例。 |
| `PORT` | `8080` | HTTP 服务器端口。 |
---
## 🔗 链接
- [Sentor 仪表盘](https://dashboard.sentor.app) — 管理 API 密钥、项目和使用情况
- [API 文档](https://sentor.app/docs) — 完整的 REST API 参考
- [MCP 集成指南](https://sentor.app/docs/integrations/mcp) — 逐步设置
- [PyPI 软件包](https://pypi.org/project/sentor-mcp/) — `pip install sentor-mcp`
- [支持](mailto:sentor@nikx.one)
---
<!-- mcp-name: io.github.NIKX-Tech/sentor-mcp -->
<p align="center">
由 <a href="https://nikx.one">NIKX Technologies B.V.</a> 构建
</p>