Borrowing it
Nothing to install: this file belongs to ranbo12138/mcp-image-gen. 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/ranbo12138/mcp-image-gen/main/AGENTS.mdgit clone --depth 1 https://github.com/ranbo12138/mcp-image-genWrote 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/ranbo12138/mcp-image-gen/agents-md)<a href="https://agentmods.dev/instructions/ranbo12138/mcp-image-gen/agents-md"><img src="https://agentmods.dev/badge/instructions/ranbo12138/mcp-image-gen/agents-md.svg" alt="Measured on agentmods" 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.02111 | $0.02111 |
| Opus 5 | $0.01056 | $0.01056 |
| Sonnet 5 | $0.00422 | $0.00422 |
| Haiku 4.5 | $0.00211 | $0.00211 |
Grade A, and why
mcp-image-gen 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 7d 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 — 227 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AGENTS.md
项目概述
这是一个基于 ** Model Context Protocol(MCP)** 的图像生成服务器项目。项目作为中间件,将 MCP 协议请求转换为标准的 OpenAI 兼容格式(/v1/images/generations)调用上游图像生成 API。专为云端部署场景设计,通过 Streamable HTTP 提供服务,支持 Claude Desktop、RikkaHub 等 MCP 客户端远程连接。
技术栈
- 运行时环境:Node.js >= 18.0.0
- 语言:TypeScript 5.4+
- Web 框架:Express.js 4.18.2
- MCP 协议 SDK:
@modelcontextprotocol/sdk^1.0.0 - 参数验证:Zod ^3.23.8
- 环境配置:dotenv ^16.4.5
- 跨域支持:cors ^2.8.5
- 模块格式:ES Module(
"type": "module")
核心文件结构
mcp-image-gen/
├── src/
│ ├── index.ts # Express 服务器入口,Streamable HTTP 传输层实现
│ └── config.ts # 配置管理,环境变量定义和类型
├── dist/ # TypeScript 编译输出(由 npm run build 生成)
│ ├── index.js
│ └── config.js
├── .env.example # 环境变量配置模板
├── Dockerfile # Docker 镜像构建文件
├── package.json # 项目依赖声明和 npm 脚本
├── tsconfig.json # TypeScript 编译配置
├── .github/workflows/
│ └── docker-publish.yml # GitHub Actions 自动构建 Docker 镜像工作流
└── README.md # 项目使用文档
构建和运行
本地开发
# 安装项目依赖
npm install
# 复制环境变量模板并配置
cp .env.example .env
# 编辑 .env 文件,填入 API_KEY 等必要配置
# 构建 TypeScript
npm run build
# 启动服务(前台运行)
npm start
# 开发模式(监听文件变化自动重启)
npm run dev
# 使用 MCP Inspector 测试
npm run inspect
Docker 部署
# 构建 Docker 镜像
docker build -t mcp-image-gen .
# 运行容器
docker run -d -p 3000:3000 -e API_KEY=your_api_key mcp-image-gen
# 使用 GitHub Container Registry 镜像
docker run -d -p 3000:3000 -e API_KEY=your_api_key ghcr.io/ranbo12138/mcp-image-gen:latest
服务端点
| 端点 | 方法 | 说明 |
|---|---|---|
/mcp |
POST | MCP 协议主端点,处理客户端请求和初始化 |
/mcp |
GET | SSE 通知端点,服务器向客户端推送消息 |
/mcp |
DELETE | 会话终止端点 |
/health |
GET | 健康检查端点,返回服务状态和活跃会话数 |
开发约定
代码风格规范
- 使用 TypeScript,启用严格模式(
strict: true) - 模块导入导出采用 ES Module 形式
- 变量和函数命名使用 camelCase 风格
- 常量命名使用大写字母加下划线
- 所有配置和类型在
config.ts中集中定义
MCP 服务器架构
项目采用 MCP SDK 推荐的高级 API 模式:
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
import { z } from "zod";
// 创建服务器实例
const server = new McpServer({
name: "cloud-image-generator",
version: "3.0.0",
});
// 使用 Zod 定义参数 Schema
server.registerTool("generate_image", {
title: "Generate Image",
description: "...",
inputSchema: {
prompt: z.string().describe("..."),
size: z.enum(["16:9", "9:16", "1:1", "2:3", "3:2"]).default("2:3"),
},
}, async (params) => {
// 工具实现
return { content: [{ type: "text", text: "..." }] };
});
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.
- 7d ago First seen · 227 lines · 2,111 tokens per session scan A 2c0769a3bcd7
mcp-image-gen AGENTS.md is an instructions file published in the GitHub repository ranbo12138/mcp-image-gen (2 stars, last pushed 5mo ago), licensed MIT. It adds 2,111 tokens to every session, about $0.0106 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).
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).
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.
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.