npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

prism-context-imagegen

v0.2.0

Published

Context-aware image generation and editing for Codex through a configurable local MCP server.

Readme

prism-context-imagegen

Context-aware image generation and editing for Codex IDE and Codex CLI. The package installs a user-level Skill and runs a local STDIO MCP server, so it works in any project without copying Prism AI Studio.

Requirements

  • Node.js 18+
  • Codex IDE extension or Codex CLI
  • A sub2api or OpenAI-compatible synchronous image generation/editing endpoint

Install

Run the generated prompt from Prism AI Studio, or install directly:

npx -y [email protected] setup --yes \
  --base-url "https://fastrouter.cloud" \
  --model "gpt-image-2" \
  --generations-path "/v1/images/generations" \
  --edits-path "/v1/images/edits"

setup only writes user-level files:

~/.agents/skills/context-imagegen/SKILL.md
~/.codex/config.toml
~/.config/prism-context-imagegen/config.json

It does not modify the current project. Restart Codex IDE or open a new Codex session after setup. If data[].url points to a different CDN hostname, explicitly trust it during setup with --download-hosts "cdn.example.com"; the API hostname is trusted automatically.

Configure the API key

Do not paste API keys into a Codex chat or pass them as command-line arguments. Run this yourself in a local terminal:

npx -y [email protected] auth

The prompt hides the key. It is stored in the user config file with mode 0600. IMAGE_API_KEY remains supported and takes precedence over the stored key. These environment variables also override stored settings:

IMAGE_API_BASE_URL
IMAGE_API_KEY
IMAGE_API_MODEL
IMAGE_GENERATIONS_PATH
IMAGE_EDITS_PATH
IMAGE_DOWNLOAD_HOSTS

Verify

npx -y [email protected] doctor
codex mcp list

The MCP server exposes generate_image and edit_image. It uses MCP roots/list when available and accepts an explicit absolute workspaceRoot for multi-root clients. Roots errors fail closed; clients without roots are restricted to the MCP process working directory. Project inputs and all outputs stay inside the trusted workspace; the only external input exception is Codex session images under CODEX_HOME/generated_images. Existing outputs are rejected unless the user explicitly requested overwrite: true. URL downloads are restricted to the API hostname plus IMAGE_DOWNLOAD_HOSTS, including every redirect.

Commands

prism-imagegen setup --yes [options]  Install/update Skill and MCP config
  --edits-path PATH                    Configure sub2api/OpenAI image edits endpoint
  --download-hosts HOST1,HOST2        Trust cross-origin image CDN hosts
prism-imagegen auth                   Save API key from a hidden local prompt
prism-imagegen doctor                 Check local installation without generating
prism-imagegen serve                  Run the STDIO MCP server

Tools

generate_image

Creates a new image from a context-derived text prompt.

edit_image

Edits one primary workspace image and optionally uses up to two additional references:

prompt          Required edit instruction
imagePaths      1-3 workspace-relative images, or absolute Codex generated_images paths
images          1-3 inline { dataUrl, fileName? } images when caller has image bytes
maskPath        Optional workspace-relative PNG mask or Codex generated_images path
maskDataUrl     Optional inline PNG mask data URL
outputPath      Workspace-relative output file
inputFidelity   low or high (Skill defaults to high)
size            Optional output size
outputFormat    png, jpeg, or webp

Each source image is limited to 19 MiB to stay below sub2api's 20 MiB multipart-part limit. A mask is limited to 4 MiB and must be PNG. The first image is the primary source. Sources can be workspace paths, Codex session paths under CODEX_HOME/generated_images, or inline base64 data URLs for clients that can provide the original bytes. Arbitrary absolute paths and symlinks are rejected. Outputs remain inside the active workspace. The tool sends repeated image parts, an optional mask, n=1, and response_format=b64_json to IMAGE_EDITS_PATH.

Output path and overwrite checks run before the paid API request. If the path has no extension, the result extension follows the returned image MIME type.

Codex's standard MCP tool call carries JSON arguments and does not automatically attach the visual content of a chat message. Inline data URLs work when a caller actually has the original bytes; if a Codex session exposes only visual context and neither bytes nor a local path, the MCP cannot recover the original image data.

The bundled Skill selects edit_image whenever the request depends on an existing image and never silently downgrades an edit to text-only generation.

Supported responses

The configured image endpoint must return one synchronous result:

{ "data": [{ "url": "https://example.com/image.png" }] }

or:

{ "data": [{ "b64_json": "..." }] }

Asynchronous taskId responses are not supported yet. Calls default to one image, and the bundled Skill avoids generating extra variants unless the user requests them.

Development

From the Prism AI Studio repository root:

npm install
npm run build:mcp
npm run test:mcp
npm pack --workspace prism-context-imagegen --dry-run

Before public publishing, confirm the package name, repository metadata, and license, then run:

npm publish --workspace prism-context-imagegen