LIFX MCP 服务器
基于 TypeScript 的MCP服务器,用于通过官方 LIFX HTTP API 控制LIFX智能灯。
特征
- 使用 MCP 工具控制 LIFX 灯
- 设置状态、切换和应用效果(呼吸、移动、变形、火焰)
- 激活场景并解析颜色字符串
- 采用FastMCP构建,易于集成
入门
先决条件
- Node.js(建议使用 v16+)
- LIFX 云 API 令牌(在此处获取)
- 与 MCP 兼容的客户端(例如 VS Code)
安装
建造
跑步
您可以直接启动服务器:
或者使用 MCP 工具(推荐):
与 VS Code 一起使用
为了快速安装,请使用本自述文件顶部的一键安装按钮之一。
如需手动安装,请将以下 JSON 块添加到 VS Code 中的“用户设置 (JSON)”文件中。您可以按下Ctrl + Shift + P
并输入Preferences: Open User Settings (JSON)
来完成此操作。
或者,您可以将其添加到工作区中名为.vscode/mcp.json
的文件中。这样您就可以与其他人共享该配置。
请注意
.vscode/mcp.json
文件中不需要mcp
键。
配置
服务器需要 LIFX API 令牌。您可以通过以下方式提供:
.env
文件:- 或者通过 VS Code MCP 扩展提示(参见
.vscode/mcp.json
)。
用法
该服务器公开以下 MCP 工具:
get-lights
:通过选择器获取灯光状态set-state
:设置状态(电源、颜色、亮度等)set-states
:一次设置多个状态set-state-delta
:应用增量更改toggle-lights
:切换电源breathe-effect
、move-effect
、morph-effect
、flame-effect
:运行效果get-scenes
、activate-scene
:场景管理parse-color
:解析颜色字符串
示例:切换灯光
发展
- TypeScript 源码:
src/
- 构建输出:
build/
- 类型和模式:
src/types.ts
- FastMCP 服务器:
src/index.ts
脚本
npm run build
– 编译 TypeScript 以build/
npm start
– 运行已编译的服务器npm run dev
– 使用 tsx 运行进行开发npm run inspect
– 使用 FastMCP Inspector 检查
API 参考
有关完整的 LIFX API 详细信息和颜色格式,请参阅.docs/lifxapi.md
。
执照
国际学习中心
本项目与 LIFX 无关。使用风险自负。
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
基于 TypeScript 的 MCP 服务器,用于通过官方 LIFX HTTP API 控制 LIFX 智能灯,允许用户管理灯光状态、切换电源、应用效果和激活场景。
Related MCP Servers
- AsecurityAlicenseAqualityA TypeScript-based server that allows calling other MCP clients from your own MCP client, facilitating task delegation and context window offloading for enhanced multi-agent interactions.Last updated -314JavaScriptMIT License
- -securityFlicense-qualityA simple TypeScript library for creating Model Context Protocol (MCP) servers with features like type safety, parameter validation, and a minimal code API.Last updated -1TypeScriptMIT License
- -security-license-qualityA TypeScript-based server that connects MCP Clients to Dify applications, dynamically exposing Dify applications as tools that can be used directly within the MCP Client.Last updated -2JavaScriptMIT License
- -securityAlicense-qualityA TypeScript framework for building MCP servers with client session management capabilities, supporting tools definition, authentication, image content, logging, and error handling.Last updated -6,371TypeScriptMIT License