styleline mcp
A. 模型上下文协议 Stylelint的(MCP)服务器,使AI模型能够直接与Stylelint交互。
安装
npm -D install stylelint-mcp注意:您必须在项目中全局或本地安装styleline。
用法
服务器由编辑器的MCP客户端自动启动,但您可以手动运行它进行测试:
npx stylelint-mcp编辑器设置示例
VS代码
添加 .vscode/mcp.json:
{
"servers": {
"Stylelint": {
"type": "stdio",
"command": "npx",
"args": ["stylelint-mcp@latest"]
}
}
}光标
添加 .cursor/mcp.json:
{
"mcpServers": {
"stylelint": {
"command": "npx",
"args": ["stylelint-mcp@latest"],
"env": {}
}
}
}示例提示
Run Stylelint on the current file and explain the warnings
Lint #file:index.css and fix