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

@fuwasegu/code-image-generator-mcp

v1.0.0

Published

MCP server that generates beautiful source code images like Carbon

Readme

@fuwasegu/code-image-generator-mcp

An MCP server that generates beautiful source code images with syntax highlighting, similar to Carbon. Designed to be used by AI agents (e.g., slide generation agents) via the Model Context Protocol.

TypeScript — github-dark

TypeScript example

Python — dracula

Python example

Rust — nord

Rust example

Features

  • VS Code-quality syntax highlighting powered by Shiki
  • Carbon-like appearance: rounded card, macOS window dots, line numbers
  • 40+ themes (github-dark, dracula, one-dark-pro, nord, github-light, etc.)
  • 200+ languages supported
  • No browser dependency — fast SVG-based rendering with Sharp
  • Returns both a saved PNG file and inline base64 image

Setup

Claude Code

claude mcp add code-image-generator -- npx @fuwasegu/code-image-generator-mcp

Claude Desktop / MCP Client

Add to your config (e.g., claude_desktop_config.json):

{
  "mcpServers": {
    "code-image-generator": {
      "command": "npx",
      "args": ["@fuwasegu/code-image-generator-mcp"]
    }
  }
}

Tool: generate_code_image

Generates a PNG image of source code and saves it to the specified path.

Parameters

| Parameter | Type | Required | Default | Description | |---|---|---|---|---| | code | string | Yes | — | Source code to render | | language | string | Yes | — | Language for highlighting (e.g., "typescript", "python", "rust") | | outputPath | string | Yes | — | Absolute file path for the output PNG | | theme | string | No | "github-dark" | Shiki theme name | | fontFamily | string | No | "JetBrains Mono" + fallbacks | Font family for rendering | | fontSize | number | No | 14 | Font size in pixels | | imageWidth | number | No | auto | Image width in pixels (auto-calculated from content if omitted) | | showLineNumbers | boolean | No | true | Whether to show line numbers |

Response

Returns two content blocks:

  1. Text — Summary with file path and dimensions (e.g., Code image saved to /tmp/out.png (800x400px))
  2. Image — Base64-encoded PNG for inline preview

Architecture

Shiki (tokenize) → SVG (build layout) → Sharp (render PNG)
  • Shiki — Tokenizes source code using TextMate grammars (same as VS Code)
  • SVG Builder — Constructs an SVG string with Carbon-like layout: outer background, rounded card, window controls, line numbers, and colored code tokens
  • Sharp — Converts SVG to PNG via librsvg (no headless browser needed)

Project Structure

src/
  index.ts              # MCP server entry point (stdio transport)
  generate-image.ts     # Pipeline: Shiki → SVG → Sharp
  svg-builder.ts        # SVG string construction
  defaults.ts           # Default styling values

Font Notes

The rendered image uses system fonts. For best results, install a monospace font like JetBrains Mono or Fira Code. The default fallback chain is:

JetBrains Mono → Fira Code → SF Mono → Menlo → Consolas → DejaVu Sans Mono → monospace

License

MIT