
NovelAI Image MCP
io.github.xinvxueyuan由 GitHub 账号 xinvxueyuan 发布v0.7.1更新于 Oct 31, 2026
NovelAI image generation as MCP tools: txt2img, img2img, inpaint, upscale, Director, ControlNet.
概览
把 NovelAI 图像生成能力开放给 AI 助手:文生图、图生图、局部重绘、放大、Director 编辑与 ControlNet 标注。
- 可以做什么
- 生成与编辑图像:文生图、带强度/噪声的图生图、需要蒙版的局部重绘,以及 4 倍放大
- 调用 Director 工具(线稿、素描、去背景、去杂物、上色、表情)与 ControlNet 标注(hed、midas、涂鸦、mlsd、uniformer)
- 辅助撰写提示词:标签建议,以及把参考图编码为 vibe token
- 查看账户:订阅状态、Anlas 余额、用户数据,并在不调用 API 的情况下估算 Anlas 消耗
- 通过资源查看模型、采样器与默认值,并读回已生成的 PNG;图像以 base64 内容块返回,同时保存到磁盘
- 适用场景
- 适合在对话中让助手生成或修改 NovelAI 图像,也适合围绕 NovelAI 账户编写可重复的生成、放大与标注流程。
- 运行要求
- 以 stdio 在本地运行(通过 uvx 或 pip 安装 PyPI 包,或使用 Docker 镜像)。需要 NovelAI 账户及 NOVELAI_TOKEN 持久 API 令牌,或 NOVELAI_USERNAME 加 NOVELAI_PASSWORD;需要访问 NovelAI API 的网络。可选设置包括输出目录、默认模型、尺寸、步数、采样器,以及带 MCP_AUTH_TOKEN 的 HTTP 传输。
安装
在 SourceWeft 中
- 打开 控制台中的 NovelAI Image MCP,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
NovelAI Image MCP
Languages
[CI] [Docs] [License: MIT] [Python 3.13+] [uv] [REUSE status] [DeepWiki] [skills.sh]
[NovelAI Image MCP - MCP server for integrating NovelAI Image generation into AI | Product Hunt] [Featured on Lifto]
An MCP (Model Context Protocol) server that exposes NovelAI image generation to AI agents (Claude Desktop, Cline, custom agents, remote clients), plus a sync CLI and three skills.sh packages that teach those agents how to drive either surface.
Built on FastMCP 4 (the fastmcp framework over the MCP SDK v2 mcp>=2.3.0),
it covers txt2img / img2img / inpaint, 4× upscale, Director tools (line art,
emotion, background removal, …), ControlNet annotation, tag suggestions, vibe
encoding and account subscription — all through the standard MCP tool
interface.
📖 Documentation: xinvxueyuan.github.io/NovelAI-Image-MCP
Three ways to drive it
All three wrap the same async NovelAIClient; they differ in how you invoke
it.
- MCP tools — interactive agent sessions (Claude Desktop, Cline, …). The
agent sees base64
Imagecontent blocks. - CLI — shell scripting, CI jobs, one-off commands. Saves a PNG and prints its path; no image blocks.
- Agent skills — portable instructions that tell an agent how to use the other two. They inherit the mode they drive.
Features
- 11 MCP tools covering the full NovelAI image API surface.
- 2 prompts + 3 resources + 1 resource template: house-style prompt drafting and tool sequencing
(
novelai_prompt_writer,novelai_image_workflow), plusnovelai://models,novelai://samplers,novelai://defaultsandnovelai://outputs/{name}for discovering the model/sampler vocabulary and reading generated PNGs back. - Three agent skills (
novelai-cli,novelai-mcp-tools,novelai-workflows) grouped as CLI / MCP Tools / Workflows, installable with onenpx skills addcommand. - A sync
typerCLI with six subcommands for scripting outside an MCP host. - Two transports: stdio (local agents) + HTTP (remote / multi-client), the
latter optionally protected by a bearer token (
MCP_AUTH_TOKEN). - Opt-in routing and audit (HTTP): a client that sends
X-MCP-Insidersgets per-route output directories, per-route loggers and an append-only JSONL audit trail (prompts and credentials are never written verbatim). Without the header nothing changes. See Insiders header, routing and audit. - Structured results: enum-validated tool schemas, MCP tool annotations and
ToolErrorfor expected failures. - Dual image return: base64
Imagecontent blocks (the agent sees the image) and PNG saved to disk (path returned as text). - Monorepo: uv workspace (Python) + pnpm workspace (Node tooling) orchestrated by Turbo; MIT-licensed, Docker-ready, GitHub Pages docs.
Quick start
1. Install the agent skills
--yes skips the interactive picker; --global installs to
~/.agents/skills/ so every project on the machine can use them. Drop
--global to install into the current project's .agents/skills/ instead.
See Agent skills for what each skill covers.
2. Install the server (from source, development)
3. Install the server (PyPI, runtime only)
Optional: Node tooling (contributors)
If you plan to contribute, install the cross-cutting Node toolchain (turbo, husky, markdownlint) via pnpm:
This wires the husky pre-commit + commit-msg hooks and gives you turbo /
markdownlint-cli2 for local development. The MCP server has zero Node
runtime dependencies — this step is only for contributors.
Connect an agent
The MCP server supports two transports (stdio + http), all configured under
mcpServers:
stdio (local agent — Claude Desktop / Cline)
claude_desktop_config.json:
Alternative: uvx (published package)
Set NOVELAI_TOKEN (or NOVELAI_USERNAME + NOVELAI_PASSWORD) in the host
environment before launching — uvx inherits the parent shell env.
http (remote / Docker deployment)
After docker compose up --build (server listens on http://HOST:8000/mcp):
Replace http://127.0.0.1:8000/mcp with your self-deployed endpoint (e.g.
https://mcp.example.com/mcp behind a TLS-terminating reverse proxy). Swap
the literal token placeholder for a host-managed secret reference if your
MCP host supports one (Claude Desktop, Cline, etc. expose this via their
own secrets UI).
Standard FastMCP entry points
The repository ships a fastmcp.json whose source points at
apps/server/mcp_server.py, so plain FastMCP tooling works too (run from the
repository root, after uv sync):
fastmcp.json has no environment block on purpose: the workspace virtualenv
already has the package installed, and an environment entry would make
FastMCP build a second, throwaway environment for every run.
CLI (sync, for scripting)
The CLI exposes six subcommands: serve, generate, upscale, director,
annotate, info.
Install it with pip install novelai-image-mcp, run it ad hoc with
uvx novelai-image-mcp <command>, or from the monorepo with
uv run --directory apps/server novelai-image-mcp <command>. Every
image-producing command saves a PNG to NOVELAI_OUTPUT_DIR (default
outputs) and prints its path; -o / --output-dir overrides the
directory for one invocation. The full flag list lives in the
novelai-cli skill.
Agent skills
Three skills.sh packages ship in skills/. They teach AI
agents (Claude Code, Codex, GitHub Copilot, Cursor, …) how to drive the CLI and
the MCP tools, so you do not have to paste docs into the conversation.
Skills and the CLI/MCP tools are complementary, not either/or: install all three and the agent picks the mode that fits the task. Each skill points at the other two instead of repeating them. See the Agent skills docs for the group descriptions and a mode-comparison table.
Repository layout
This is a uv + pnpm monorepo:
See CONTRIBUTING.md for the developer guide and
apps/docs/source/ for the full documentation source.
Tools
See the tools reference on the docs site for parameters and examples.
Configuration
All settings are environment variables (see .env.example). Key ones:
List- and dict-valued settings are read as JSON: MCP_MODEL_HEADERS='["X-MCP-Model"]'
works, while A,B raises a settings error and an empty value is not valid JSON.
Routing candidate defaults (JSON lists, first non-empty header wins):
MCP_MODEL_HEADERS—["X-MCP-Model", "X-MCP-Model-Name"]MCP_AGENT_HEADERS—["X-MCP-Agent-ID", "X-MCP-Agent", "X-MCP-Agent-Source"]MCP_CLIENT_HEADERS—["X-MCP-Client", "X-MCP-Client-Session-Id"]
Insiders header and routing
Over HTTP a client can opt in to experimental behaviour and declare which route, model, agent and session a request belongs to:
The server then writes that request's images under
<NOVELAI_OUTPUT_DIR>/team-a/, emits one line to the
novelai_image_mcp.audit.team-a logger, and appends one record to the audit
JSONL (the record keeps a prompt's length and a truncated SHA-256, never the
prompt, and never a credential header or an image payload).
Nothing changes without the header -- no scoped directory, no audit file, no
tool added or removed -- with one deliberate exception: director_tool's
emotion and emotion_level parameters now require the opt-in and fail with a
ToolError otherwise (see the CHANGELOG). Routing headers are client-supplied
and forgeable, so grant the opt-in only behind a trusted gateway.
Full contract: Insiders header, routing and audit.
NovelAI API reference: image.novelai.net/docs
Development
The project is a uv + pnpm monorepo orchestrated by Turbo. See
CONTRIBUTING.md for the full setup; the short version:
Per-member commands (via uv):
Docker
The Dockerfile lives at apps/server/Dockerfile but
the build context is the repository root (so uv can resolve the workspace
graph). See docker-compose.yml.
Documentation
The Sphinx documentation site is built with Furo + MyST Markdown and
auto-deploys to GitHub Pages on every push to main:
- Live site: xinvxueyuan.github.io/NovelAI-Image-MCP
- Source:
apps/docs/source/ - Build locally:
pnpm docs:serve
License
MIT — see LICENSE. Per-file SPDX annotations live in
REUSE.toml. Contributions are subject to the
Developer Certificate of Origin (the commit-msg hook signs off
commits automatically).
Links
来源:README.md,提交 1a60690
工具
0版本历史
7- v0.7.1最新Oct 31, 2026
- v0.7.0Oct 22, 2026
- v0.6.3Oct 19, 2026
- v0.6.2Oct 18, 2026
- v0.5.1Oct 13, 2026
- v0.5.0Oct 10, 2026
- v0.4.0Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分