Borrowing it
Nothing to install: this file belongs to xinvxueyuan/NovelAI-Image-MCP. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/xinvxueyuan/NovelAI-Image-MCP/main/AGENTS.mdgit clone --depth 1 https://github.com/xinvxueyuan/NovelAI-Image-MCPWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/xinvxueyuan/novelai-image-mcp/agents-md)<a href="https://agentmods.dev/instructions/xinvxueyuan/novelai-image-mcp/agents-md"><img src="https://agentmods.dev/badge/instructions/xinvxueyuan/novelai-image-mcp/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/xinvxueyuan/novelai-image-mcp/agents-md"><img src="https://agentmods.dev/badge/instructions/xinvxueyuan/novelai-image-mcp/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.03983 | $0.03983 |
| Opus 5 | $0.01992 | $0.01992 |
| Sonnet 5 | $0.00797 | $0.00797 |
| Haiku 4.5 | $0.00398 | $0.00398 |
Grade A, and why
NovelAI-Image-MCP AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 208 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AGENTS.md
面向 AI agent 的仓库级上下文索引。完整开发者文档见
CONTRIBUTING.md与 docs 站。 本文件只沉淀"约束 + 指针",避免与 docs 站重复。
项目是什么
NovelAI Image MCP —— 一个基于 fastmcp 4
(fastmcp==4.0.0b3,底层运行在 MCP SDK v2 mcp>=2.0.0 上)的模型上下文协议
服务器,把 NovelAI 图像生成 API 暴露为 11 个 MCP 工具,
供 Claude Desktop / Cline / 自研 agent 调用。Python 3.13,MIT 协议。
仓库布局(uv + pnpm monorepo,Turbo 编排)
apps/server/ → 可安装的 MCP 服务器包(PyPI: novelai-image-mcp)
src/novelai_image_mcp/
nai/ # NovelAI HTTP 客户端(必须走 create_http_client())
tools/ # 11 个 MCP 工具的注册函数
server.py # FastMCP 实例 + lifespan AppContext
cli.py # typer CLI(同步入口)
tests/
dev_server.py # mcp dev 入口(绕开相对导入问题)
pyproject.toml # 版本号唯一权威源 + ruff/pyright/pytest 配置
apps/docs/ → Sphinx 文档站(Furo + MyST)
.github/ → workflows (ci/release/docs) + sync-version composite action
pyproject.toml (根) → uv workspace 虚拟根(不可安装)
uv.lock → 全仓库唯一锁文件
常用命令
uv sync # 同步 Python workspace
uv run --directory apps/server poe check # format-check + lint + typecheck + test
uv run reuse lint # REUSE 合规
uv run --directory apps/server poe serve # 启动 stdio 服务器
uv run --directory apps/server poe serve-http # 启动 HTTP 服务器
mcp dev apps/server/dev_server.py # MCP Inspector(交互调试)
pnpm docs:serve # sphinx-autobuild 实时预览
硬约束(不要触碰)
- 版本号唯一源 =
apps/server/pyproject.toml的version字段。 不要手改package.json/apps/server/package.json/apps/docs/package.json的版本号——release workflow 的.github/actions/sync-version会自动同步并回写 commit。 - NovelAI HTTP 客户端必须通过
nai/http.py的create_http_client()构造。不要直接httpx.AsyncClient()——image.novelai.net后的 Cloudflare WAF 会按 JA3/JA4 TLS 指纹识别非浏览器客户端并静默重置连接。自 2026 年起 NovelAI 已将大部分第三方 API 访问收口到image.novelai.net:它承载/ai/generate-image、/ai/generate-image-stream、/ai/augment-image、/ai/encode-vibe、/ai/generate-image/suggest-tags以及/user/*(账户 / 订阅 / 数据)端点。例外:/ai/upscale与/ai/annotate-image未迁移, 仍在 Primary APIapi.novelai.net上——api.novelai.net/docs/明确指出 第三方用户可使用其/ai/路由。NovelAISettings.legacy_image_base_url(默认https://api.novelai.net)专门服务这两个端点,upscale()与annotate()必须使用它。create_http_client()用httpx_curl_cffi.AsyncCurlTransport(impersonate="chrome")复刻 Chrome 的 BoringSSL 指纹 + 完整 Chrome 150 请求头块(BROWSER_HEADERS)。 - MCP 工具返回图像时返回 fastmcp 的
Image辅助类(from .._mcp import Image),由 fastmcp 自动转为ImageContent。tools/generate.py与tools/enhance.py的_save_and_return已封装此逻辑:直接return [Image(data=..., format="png"), "saved ..."],fastmcp 在返回 list 时会自动转换。不要手动拼ImageContent,也不要返回裸 bytes。 mcp dev用apps/server/dev_server.py作为入口,不要直接指向server.py——mcp dev直接加载会破坏from ._mcp import FastMCP相对导入。- 提交消息必须 gitmoji + Conventional Commits,例:
🐛 fix(generate): handle zero-seed randomization。commit-msghook 自动追加Signed-off-by实现 DCO。不要--no-verify提交 PR。 - 不要在
releases/*分支推送前忘记uv lock。release workflow 的buildjob 用uv build --package novelai-image-mcp,lock 与 pyproject 不一致会触发警告。 - 不要在 PyPI 重发同版本——PyPI 不允许覆盖。失败的发布用 yank +
patch 版本(
0.1.x→0.1.x+1)补救。 - i18n 翻译页面放在
apps/docs/source/<lang-code>/(如source/zh/、source/ja/)。英文留在source/根。每个语言独立构建,共享同一份conf.py。按语言的 toctree 只能引用该语言目录下实际存在的页面 —— 不要在source/zh/index.md的 toctree 里链接未翻译的tools/或tutorials/章节。未翻译的章节用户切换到英文查看即可。新增语言时同步 更新conf.py的AVAILABLE_LANGUAGES与docs.yml的 matrix。
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 11d ago First seen · 208 lines · 3,983 tokens per session scan A f5f78c33f8e4
NovelAI-Image-MCP AGENTS.md is an instructions file published in the GitHub repository xinvxueyuan/NovelAI-Image-MCP (4 stars, last pushed 4d ago), licensed MIT. It adds 3,983 tokens to every session, about $0.0199 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other instructions, from other repositories
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
spec-kit AGENTS.md
AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).