windy-civitai-mcp
v1.0.3
Published
MCP server and CLI tool for querying Civitai images from the Civitai API
Maintainers
Readme
windy-civitai-mcp
一个 MCP 服务器和 CLI 工具,用于从 Civitai API 查询图像。
安装
要使用此工具,您需要安装 Node.js 和 npm。
# 如果要全局安装
npm install -g windy-civitai-mcp
# 或者直接使用 npx,不需要全局安装
npx windy-civitai-mcp <command> [options]使用
命令行界面 (CLI)
您可以使用 query 命令直接从终端查询 Civitai 图像:
npx windy-civitai-mcp query --username C29 --limit 10 --sort Newest
npx windy-civitai-mcp query --modelId 12345 --nsfw Nonequery 命令的可用选项:
-l, --limit <number>: 返回的图像数量限制 (默认: 5)-p, --postId <number>: 帖子ID-m, --modelId <number>: 模型ID-v, --modelVersionId <number>: 模型版本ID-u, --username <string>: 用户名-n, --nsfw <string>: NSFW 过滤 (None, Soft, Moderate, Mature, X)-s, --sort <string>: 排序方式 (Newest, Oldest, Most Reactions, Most Comments, Most Downloads)-P, --period <string>: 时间段过滤 (Day, Week, Month, Year, AllTime)-g, --page <number>: 页码
Model Context Protocol (MCP) 服务器
此包还包含一个 MCP 服务器,它公开了 civitai_image_query 工具。您可以使用 start-server 命令启动服务器:
npx windy-civitai-mcp start-server服务器将自动在当前工作目录中查找 mcp-config.json 以配置工具和端口。
mcp-config.json 示例:
{
"$schema": "https://mcp.dev/schemas/mcp-config.json",
"name": "windy-civitai-mcp-server",
"port": 3000,
"tools": [
{
"name": "civitai_image_query",
"description": "查询 Civitai 的图像信息",
"implementation": {
"type": "javascript",
"path": "index.js",
"function": "civitaiImageQuery"
},
"input_schema": {
"type": "object",
"properties": {
"limit": {
"type": "number",
"description": "返回的图像数量限制",
"default": 5
},
"postId": {
"type": "number",
"description": "帖子ID"
},
"modelId": {
"type": "number",
"description": "模型ID"
},
"modelVersionId": {
"type": "number",
"description": "模型版本ID"
},
"username": {
"type": "string",
"description": "用户名"
},
"nsfw": {
"type": "string",
"description": "NSFW过滤 (None, Soft, Moderate, Mature, X)",
"enum": ["None", "Soft", "Moderate", "Mature", "X"]
},
"sort": {
"type": "string",
"description": "排序方式 (Newest, Oldest, Most Reactions, Most Comments, Most Downloads)",
"enum": ["Newest", "Oldest", "Most Reactions", "Most Comments", "Most Downloads"]
},
"period": {
"type": "string",
"description": "时间段过滤 (Day, Week, Month, Year, AllTime)",
"enum": ["Day", "Week", "Month", "Year", "AllTime"]
},
"page": {
"type": "number",
"description": "页码"
}
}
},
"output_schema": {
"type": "object",
"properties": {
"items": {
"type": "array",
"description": "图像列表"
}
},
"additionalProperties": true
}
}
]
}配置为 MCP 客户端服务器
如果您正在使用 MCP 客户端(如 Cline)并希望将 windy-civitai-mcp 集成为服务器,您需要在客户端的 MCP 配置文件(例如 Cline 的 .mcp-config.json)中添加类似以下的配置:
{
"mcpServers": {
"windy-civitai-mcp": {
"command": "npx",
"args": ["windy-civitai-mcp", "start-server"],
"disabled": false
}
}
}此配置告诉 MCP 客户端如何启动 windy-civitai-mcp 服务器。配置完成后,您可以在客户端中使用 use_mcp_tool 命令与此服务器提供的 civitai_image_query 工具进行交互。
发布到 npm
要将此包发布到 npm,请导航到 civitai-mcp 目录并运行:
npm publish请确保您已登录 npm (npm login) 并拥有必要的权限。
开发
要在本地开发,克隆仓库后,导航到项目目录并安装依赖项:
npm install然后您可以测试 CLI:
node index.js query --username C29 --limit 5
node index.js start-server