NovelAI-Image-MCP: Instructions file for Codex

AGENTS.md

NovelAI-Image-MCP AGENTS.md is an instructions file for Codex, OpenCode from xinvxueyuan/NovelAI-Image-MCP. It costs 3,983 tokens per session, scanned A, original, MIT.

Project instructions for NovelAI Image MCP, a Python server that exposes NovelAI image-generation functions to AI assistants through the Model Context Protocol.

In plain words
What is it for?
Use them when changing the server, its image-generation tools, tests, documentation, or the surrounding Python and JavaScript workspace.
Why use it?
They explain the repository layout, required tools, commands, and constraints so development follows the project’s conventions.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions AGENTS.md; built for cline.

This is xinvxueyuan/NovelAI-Image-MCP's own configuration. It tells Codex and OpenCode how to work on NovelAI-Image-MCP itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything NovelAI-Image-MCP configures →

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/xinvxueyuan/NovelAI-Image-MCP/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/xinvxueyuan/NovelAI-Image-MCP

Made for: Codex, OpenCode.

Wrote 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.

agentmods badge for NovelAI-Image-MCP AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/xinvxueyuan/novelai-image-mcp/agents-md/github.svg)](https://agentmods.dev/instructions/xinvxueyuan/novelai-image-mcp/agents-md)
Your own site
<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.

agentmods 80×15 button for NovelAI-Image-MCP AGENTS.md

Your own site · 80×15
<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>
Per session 3,983 This file is loaded in full into every session.
When invoked 3,983 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 11d ago against content hash f5f78c33f8e4, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

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.

AGENTS.md · 208 lines

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.mddocs 站。 本文件只沉淀"约束 + 指针",避免与 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 实时预览

硬约束(不要触碰)

  1. 版本号唯一源 = apps/server/pyproject.tomlversion 字段。 不要手改 package.json / apps/server/package.json / apps/docs/package.json 的版本号——release workflow 的 .github/actions/sync-version 会自动同步并回写 commit。
  2. NovelAI HTTP 客户端必须通过 nai/http.pycreate_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 API api.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)。
  3. MCP 工具返回图像时返回 fastmcp 的 Image 辅助类(from .._mcp import Image),由 fastmcp 自动转为 ImageContenttools/generate.pytools/enhance.py_save_and_return 已封装此逻辑:直接 return [Image(data=..., format="png"), "saved ..."],fastmcp 在返回 list 时会自动转换。不要手动拼 ImageContent,也不要返回裸 bytes。
  4. mcp devapps/server/dev_server.py 作为入口,不要直接指向 server.py——mcp dev 直接加载会破坏 from ._mcp import FastMCP 相对导入。
  5. 提交消息必须 gitmoji + Conventional Commits,例: 🐛 fix(generate): handle zero-seed randomizationcommit-msg hook 自动追加 Signed-off-by 实现 DCO。不要 --no-verify 提交 PR。
  6. 不要在 releases/* 分支推送前忘记 uv lock。release workflow 的 build job 用 uv build --package novelai-image-mcp,lock 与 pyproject 不一致会触发警告。
  7. 不要在 PyPI 重发同版本——PyPI 不允许覆盖。失败的发布用 yank + patch 版本(0.1.x0.1.x+1)补救。
  8. i18n 翻译页面放在 apps/docs/source/<lang-code>/(如 source/zh/source/ja/)。英文留在 source/ 根。每个语言独立构建,共享同一份 conf.py按语言的 toctree 只能引用该语言目录下实际存在的页面 —— 不要在 source/zh/index.md 的 toctree 里链接未翻译的 tools/tutorials/ 章节。未翻译的章节用户切换到英文查看即可。新增语言时同步 更新 conf.pyAVAILABLE_LANGUAGESdocs.yml 的 matrix。

Read the full file on GitHub · 208 lines

Changes

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.

  1. 11d ago First seen · 208 lines · 3,983 tokens per session scan A f5f78c33f8e4

Subscribe to this mod's changes

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.

Related

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.

vercel/next.js · 7,296 tokens

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.

openai/codex · 5,153 tokens

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).

microsoft/vscode · 6,785 tokens

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.

github/spec-kit · 7,104 tokens

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.

langchain-ai/langchain · 4,469 tokens

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).

microsoft/vscode · 5,001 tokens