{"_id":"@airiot/mcp-server","name":"@airiot/mcp-server","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@airiot/mcp-server","version":"1.0.0","description":"MCP server for AIRIOT IoT platform","type":"module","main":"dist/index.js","bin":{"airiot-mcp-server":"dist/index.js"},"scripts":{"build":"tsc","watch":"tsc --watch","start":"node dist/index.js","dev":"tsc --watch"},"publishConfig":{"access":"public"},"keywords":["mcp","airiot","iot","model-context-protocol"],"author":"","license":"MIT","dependencies":{"@modelcontextprotocol/sdk":"^1.0.4","axios":"^1.7.9","dotenv":"^17.2.3"},"devDependencies":{"@types/node":"^22.0.0","typescript":"^5.6.0"},"gitHead":"7fe541c1366e1a204013f74697b5b737b78b8d5a","types":"./dist/index.d.ts","_id":"@airiot/mcp-server@1.0.0","_nodeVersion":"24.11.1","_npmVersion":"11.7.0","dist":{"integrity":"sha512-P8kWODzsbogAIYgWqMe/JoQHorKuKS1SYFCOgjxPhOpKS/X6PpK3a9M11oEtg3RnKhu7Xkn1EqIfelTw+xnm3w==","shasum":"3f11a303e67ceb8380e2e19b25b3a60b200cb869","tarball":"https://registry.npmjs.org/@airiot/mcp-server/-/mcp-server-1.0.0.tgz","fileCount":18,"unpackedSize":59789,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDIFDZMceoTpwUQfdt4IA7hAt4PkubJbb9flMPKLVyxWgIgJM16ObmkgkD0iFzM4Gxy1gpmHf9oAprkaWf2RbUSX1w="}]},"_npmUser":{"name":"sshwsfc","email":"23025006@qq.com"},"directories":{},"maintainers":[{"name":"sshwsfc","email":"23025006@qq.com"},{"name":"airiot3308521255","email":"3308521255@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mcp-server_1.0.0_1769348987079_0.825783646350225"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-25T13:49:46.962Z","1.0.0":"2026-01-25T13:49:47.210Z","modified":"2026-01-25T13:49:47.497Z"},"maintainers":[{"name":"sshwsfc","email":"23025006@qq.com"},{"name":"airiot3308521255","email":"3308521255@qq.com"}],"description":"MCP server for AIRIOT IoT platform","keywords":["mcp","airiot","iot","model-context-protocol"],"license":"MIT","readme":"# AIRIOT MCP Server\n\n基于 Model Context Protocol (MCP) 的 AIRIOT IoT 平台服务器，为 AI 助手提供对 AIRIOT 数据表、记录、属性点和时序数据的访问能力。\n\n## 功能特性\n\n- 📊 **数据表管理**: 查询、创建、更新、删除数据表\n- 📝 **记录操作**: 对表记录进行 CRUD 操作\n- 🏷️ **属性点查询**: 查询表和记录的属性点定义\n- 📈 **时序数据**: 查询设备最新数据和历史数据\n- 📊 **统计分析**: 设备在线状态统计\n\n## 安装\n\n```bash\ncd airiot-mcp-server\nnpm install\nnpm run build\n```\n\n## 配置\n\n### 环境变量\n\n创建 `.env` 文件或设置以下环境变量：\n\n```bash\n# AIRIOT 服务器地址（必填）\nexport AIRIOT_BASE_URL=\"https://your-airiot-server.com\"\n\n# 项目ID（必填）\nexport AIRIOT_PROJECT_ID=\"your-project-id\"\n\n# 认证方式1: 使用Token（推荐）\nexport AIRIOT_TOKEN=\"your-api-token\"\n\n# 认证方式2: 使用用户名密码\nexport AIRIOT_USERNAME=\"your-username\"\nexport AIRIOT_PASSWORD=\"your-password\"\n```\n\n### MCP 配置\n\n在 Claude Desktop 配置文件中添加：\n\n**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`\n**Windows**: `%APPDATA%\\Claude\\claude_desktop_config.json`\n\n```json\n{\n  \"mcpServers\": {\n    \"airiot\": {\n      \"command\": \"node\",\n      \"args\": [\n        \"/path/to/airiot-mcp-server/dist/index.js\"\n      ],\n      \"env\": {\n        \"AIRIOT_BASE_URL\": \"https://your-airiot-server.com\",\n        \"AIRIOT_PROJECT_ID\": \"your-project-id\",\n        \"AIRIOT_TOKEN\": \"your-api-token\"\n      }\n    }\n  }\n}\n```\n\n## 可用工具\n\n### 表管理\n\n| 工具名 | 描述 |\n|--------|------|\n| `get_tables` | 查询数据表列表 |\n| `get_table_by_id` | 根据ID查询单个表 |\n| `create_table` | 创建新数据表 |\n| `update_table` | 更新表信息 |\n| `delete_table` | 删除数据表 |\n\n### 记录管理\n\n| 工具名 | 描述 |\n|--------|------|\n| `get_table_records` | 查询表记录列表 |\n| `get_record_by_id` | 根据ID查询单条记录 |\n| `create_record` | 创建新记录 |\n| `update_record` | 更新记录 |\n| `delete_record` | 删除单条记录 |\n| `batch_delete_records` | 批量删除记录 |\n\n### 属性点查询\n\n| 工具名 | 描述 |\n|--------|------|\n| `get_table_tags` | 查询表的属性点定义 |\n| `get_record_tags` | 查询记录的属性点 |\n\n### 时序数据\n\n| 工具名 | 描述 |\n|--------|------|\n| `get_latest_data` | 查询最新数据 |\n| `get_history_data` | 查询历史时序数据 |\n\n### 统计\n\n| 工具名 | 描述 |\n|--------|------|\n| `get_online_stats` | 统计设备在线状态 |\n\n## 使用示例\n\n### 查询所有数据表\n\n```\n调用 get_tables 工具，参数：\n{\n  \"limit\": 50,\n  \"sort\": { \"createTime\": -1 }\n}\n```\n\n### 查询特定表的记录\n\n```\n1. 先调用 get_tables 查找表ID\n2. 调用 get_table_records 工具，参数：\n{\n  \"tableId\": \"表ID\",\n  \"filter\": { \"status\": \"online\" },\n  \"limit\": 100\n}\n```\n\n### 创建新记录\n\n```\n调用 create_record 工具，参数：\n{\n  \"tableId\": \"表ID\",\n  \"data\": {\n    \"name\": \"设备名称\",\n    \"status\": \"online\",\n    \"location\": \"位置信息\"\n  }\n}\n```\n\n### 查询设备最新数据\n\n```\n调用 get_latest_data 工具，参数：\n{\n  \"deviceTagPairs\": [\n    { \"deviceId\": \"设备ID\", \"tagId\": \"属性点ID\" }\n  ]\n}\n```\n\n### 查询历史数据\n\n```\n调用 get_history_data 工具，参数：\n{\n  \"deviceTagPairs\": [\n    { \"deviceId\": \"设备ID\", \"tagId\": \"属性点ID\" }\n  ],\n  \"startTime\": 1704067200000,\n  \"endTime\": 1704153600000,\n  \"limit\": 1000\n}\n```\n\n## 开发\n\n```bash\n# 安装依赖\nnpm install\n\n# 开发模式（自动编译）\nnpm run dev\n\n# 构建\nnpm run build\n\n# 运行\nnpm start\n```\n\n## API 文档\n\n本服务器基于 [AIRIOT API 4.0](https://airiot.apifox.cn/llms.txt) 文档实现。\n\n主要接口包括：\n\n- **表管理**: `/api/core/table/*`\n- **表记录管理**: `/api/core/table-record/*`\n- **属性点管理**: `/api/core/table/{id}/tags`\n- **时序数据**: `/api/core/time-series/*`\n- **统计**: `/api/core/table/online-stats`\n\n## 注意事项\n\n1. **认证**: 建议使用 Token 认证，避免频繁登录\n2. **权限**: 确保账号有相应的数据访问权限\n3. **性能**: 大数据量查询时注意使用 `limit` 和 `skip` 参数\n4. **错误处理**: 所有工具调用都会返回详细错误信息\n\n## 许可证\n\nMIT\n\n## 贡献\n\n欢迎提交 Issue 和 Pull Request！\n","readmeFilename":"README.md","_rev":"1-2b5dba6311b018b8bbd52c762d3b8724"}