README
🚀 FastAlert MCP 服务器
FastAlert MCP 服务器是 FastAlert 的官方模型上下文协议(MCP)服务器。该服务器允许 AI 代理(如 Claude、ChatGPT 和 Cursor)列出你的频道列表,并通过 FastAlert API 直接发送通知。
✨ 主要特性
- 频道发现:列出你所有的频道,并可选择按名称进行过滤。
- 发送通知:向一个或多个频道发送丰富的消息(包括标题、内容、操作、图像)。
🚀 快速开始
{
"mcpServers": {
"fastalert": {
"command": "npx",
"args": ["-y", "fastalert-mcp-server"],
"env": {
"API_KEY": "your-api-key-here"
}
}
}
}
你可以访问 FastAlert 并导航到 设置 来找到你的 API 密钥。
💻 使用示例
可用工具
以下工具可通过此 MCP 服务器使用。每个工具都可以由 AI 助手调用以执行特定操作。
1. list_channels
返回可用的 FastAlert 频道列表。
输入参数:
name(字符串,可选):用于按名称过滤频道的搜索词。
调用示例:
{
"name": "Service Alerts"
}
结构化 JSON 输出(默认):
{
"status": true,
"message": "You have fetch channels successfully",
"data": {
"channels": [
{
"uuid": "sdf12sdf-6541-5d56-s5sd-1fa513e88a81",
"name": "Service Alerts",
"subscriber": 1000
}
]
}
}
人类可读文本输出:
Here are your FastAlert channels:
Service Alerts
UUID: sdf12sdf-6541-5d56-s5sd-1fa513e88a81
Subscribers: 1000
2. send_message
向一个或多个频道发送通知消息。
输入参数:
channel-uuid(字符串,必需):目标频道的唯一标识符。title(字符串,必需):警报通知的标题。content(字符串,必需):通知的正文文本。action(字符串,可选):操作类型('call'、'email'、'website'、'image')。action_value(字符串,可选):操作的值(例如,URL 或电话号码)。image(字符串,可选):要包含的图像的 URL 或标识符。
调用示例:
{
"channel-uuid": "sdf12sdf-6541-5d56-s5sd-1fa513e88a81",
"title": "System Update",
"content": "A new version of the system is now live.",
"action": "website",
"action_value": "https://fastalert.now/updates"
}
结构化 JSON 输出(默认):
{
"status": true,
"message": "Message has been sent successfully"
}
人类可读文本输出:
Message Sent Successfully!
Your message "System Update" has been sent to Service Alerts.
Channel UUID: sdf12sdf-6541-5d56-s5sd-1fa513e88a81
Title: System Update
Content: A new version of the system is now live.
📚 详细文档
与大语言模型(LLMs)的集成
在 Cursor 中配置
- 转到 设置 -> MCP。
- 点击 添加新的 MCP 服务器。
- 名称:
FastAlert - 类型:
command - 命令:
npx -y fastalert-mcp-server - 环境变量:添加
API_KEY。
在 ChatGPT 中配置
- 转到 设置 -> 集成。
- 点击 添加 MCP 服务器。
- 使用你的服务器的托管 URL(例如,
https://mcp.fastalert.now/mcp)。 - 按照 OAuth 提示操作。
在 Claude 中配置
- 打开
claude_desktop_config.json。 - 添加以下条目:
{
"mcpServers": {
"fastalert": {
"command": "npx",
"args": ["-y", "fastalert-mcp-server"],
"env": {
"API_KEY": "your-api-key-here"
}
}
}
}
📦 安装指南
要求
- Node:建议使用 18 或更高版本。
- API_KEY:需要有效的 FastAlert API 密钥进行身份验证。
本地安装
- 克隆仓库
- 复制示例环境文件:
cp .env.example .env - 在
.env中配置环境变量。 - 安装依赖:
npm install - 构建项目:
npm run build - 运行检查器测试:
npm run inspector - 本地运行:
npm start
配置(环境变量)
以下环境变量应在你的 .env 文件中进行配置:
| 变量 | 描述 | 示例 |
| --------- | ------------------------------------------ | ----------------------------- |
| API_URL | FastAlert API 端点 | https://api.fastalert.now/api |
| FRONT_URL | 你的前端应用程序 URL | https://fastalert.now |
| BASE_URL | 此 MCP 服务器的公共托管 URL | http://localhost:3000 |
| API_KEY | 你的 FastAlert API 密钥 | your-api-key-here |
| PORT | (可选)运行服务器的端口 | 3000 |
🤝 贡献
欢迎贡献代码!请随时提交拉取请求。
📄 许可证
本项目采用 MIT 许可证。
Scan to join WeChat group