内容
# Tenable.sc MCP 服务器
[]()
[]()
[]()
Tenable.sc 的模型上下文协议(MCP)服务器,允许 Claude Desktop、Cursor、OpenCode 和 VS Code 等 AI 助手通过自然语言安全地与 Tenable.sc 进行交互。
该服务器将 Tenable.sc 功能作为 MCP 工具公开,允许 AI 客户端:
- 查询漏洞和资产
- 启动和管理扫描
- 运行分析查询
- 检索仓库和报告
- 自动化 Tenable.sc 工作流程
支持:
- `stdio` 传输协议,用于本地桌面 MCP 客户端
- `streamable-http` 传输协议,用于远程/共享部署
---
## 功能特点
- 完整的 MCP 兼容服务器
- Docker 和 Docker Compose 支持
- 本地 (`stdio`) 和远程 (`streamable-http`) 传输协议
- 通用 REST 接口支持
- 多实例部署支持
- 环境变量配置
- SSL 验证控制
- 与现代 MCP 客户端兼容
---
## 架构
```mermaid
flowchart LR
A[Claude Desktop / Cursor / OpenCode] --> B[Tenable.sc MCP 服务器]
B --> C[Tenable.sc REST API]
```
---
# 快速入门
## 1. 创建 `.env`
```env
SC_HOST=https://securitycenter.example.com
SC_USERNAME=svc_mcp
SC_PASSWORD=super-secret-password
SC_PORT=443
SC_VERIFY_SSL=true
MCP_PORT=8080
LOG_LEVEL=INFO
```
---
<details>
<summary><strong>Docker Compose 快速入门</strong></summary>
### docker-compose.yml
```yaml
services:
tenable-sc-mcp:
image: ghcr.io/sparksbenjamin/tenable.sc-mcp:latest
container_name: tenable-sc-mcp
restart: unless-stopped
ports:
- "${MCP_PORT:-8080}:${MCP_PORT:-8080}"
environment:
SC_HOST: ${SC_HOST}
SC_USERNAME: ${SC_USERNAME}
SC_PASSWORD: ${SC_PASSWORD}
SC_PORT: ${SC_PORT:-443}
SC_VERIFY_SSL: ${SC_VERIFY_SSL:-true}
MCP_HOST: 0.0.0.0
MCP_PORT: ${MCP_PORT:-8080}
LOG_LEVEL: ${LOG_LEVEL:-INFO}
```
### 启动
```bash
docker compose up -d
```
### MCP 端点
```text
http://localhost:8080/mcp
```
</details>
---
## MCP 客户端配置
### 远程 MCP
```json
{
"mcp": {
"tenable-sc": {
"type": "remote",
"url": "http://localhost:8080/mcp"
}
}
}
```
---
## 本地开发
### 克隆仓库
```bash
git clone https://github.com/sparksbenjamin/tenable.sc-mcp.git
cd tenable.sc-mcp
```
---
### 创建虚拟环境
```bash
python3 -m venv .venv
source .venv/bin/activate
```
---
### 安装依赖
```bash
pip install -r requirements.txt
```
---
### 本地运行
```bash
python -m tenable_sc_mcp \
--transport streamable-http \
--host 0.0.0.0 \
--port 8080 \
--allow-remote-hosts
```
---
### 本地 Docker 开发
使用本地源代码构建代替发布的镜像:
```yaml
services:
tenable-sc-mcp:
build: .
container_name: tenable-sc-mcp
restart: unless-stopped
ports:
- "${MCP_PORT:-8080}:${MCP_PORT:-8080}"
environment:
SC_HOST: ${SC_HOST}
SC_USERNAME: ${SC_USERNAME}
SC_PASSWORD: ${SC_PASSWORD}
SC_PORT: ${SC_PORT:-443}
SC_VERIFY_SSL: ${SC_VERIFY_SSL:-true}
MCP_HOST: 0.0.0.0
MCP_PORT: ${MCP_PORT:-8080}
LOG_LEVEL: ${LOG_LEVEL:-INFO}
```
运行:
```bash
docker compose up -d --build
```
---
## 可用的 MCP 工具
| 工具 | 描述 |
|---|---|
| `tsc_current_user` | 返回认证的 Tenable.sc 身份 |
| `tsc_list` | 列出资源的对象 |
| `tsc_get` | 检索特定对象 |
| `tsc_create` | 创建支持的资源 |
| `tsc_update` | 更新现有资源 |
| `tsc_delete` | 删除资源 |
| `tsc_analyze` | 执行分析查询 |
| `tsc_download` | 下载报告和导出 |
| `tsc_upload_file` | 上传文件 |
| `tsc_request` | 通用 REST API 接口 |
---
## 示例提示
```text
显示我最近 7 天发现的严重漏洞
```
```text
列出所有仓库及其 ID
```
```text
启动每周外部扫描
```
```text
显示按严重性排序的顶级易受攻击资产
```
---
## 安全注意事项
> [!WARNING]
> 此 MCP 服务器继承配置的 Tenable.sc API 用户的权限。
> 使用专用的最小权限服务帐户。
> [!CAUTION]
> 远程 HTTP 模式不提供内置身份验证。
> 使用 VPN、反向代理、防火墙或 SSH 隧道限制访问。
---
## 故障排除
### SSL 错误
对于实验室或自签名环境:
```env
SC_VERIFY_SSL=false
```
---
### 浏览器访问错误
直接在浏览器中打开 `/mcp` 可能会显示协议错误。
这是预期的 — 该端点适用于 MCP 兼容客户端。
---
## 路线图
- OAuth 支持
- 工具级 RBAC 过滤
- 增强的模式发现
- 流式分析查询
- 审计日志改进
- 其他 MCP 资源
---
## 许可证
GPLv3