code-shot
This server renders source code or git diffs as syntax-highlighted images (SVG or PNG) for easy visual sharing.
render_code: Convert source code snippets in 40+ languages (TypeScript, Rust, Python, Go, JavaScript, CSS, HTML, SQL, etc.) into beautiful images with full syntax highlighting.render_diff: Render unified git diffs with color-coded additions (green) and deletions (red), plus language-aware highlighting within diff hunks.Output formats: SVG (crisp, scalable, copyable) or PNG (raster, for platforms without SVG support).
Themes: Choose from 18 bundled themes, including dark options (github-dark, nord, dracula, one-dark-pro, catppuccin-mocha) and light options (github-light, solarized-light, catppuccin-latte).
Customization: Configure font size, padding, line numbers, window title, and code area width.
Auto-detection: Language is automatically identified from code content, shebangs, or diff file headers.
Config file: Set default options via
~/.code-shotrc.
Allows rendering source code as beautiful images (SVG/PNG) with syntax highlighting, line numbers, and diff rendering, directly from the Hermes AI assistant.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@code-shotRender this Python code as a PNG with line numbers."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
@thesimonharms/code-shot
MCP server that renders source code as beautiful images. Perfect for AI agents to show code visually to humans on mobile devices, or for sharing syntax-highlighted snippets.
Example
Generated from this TypeScript snippet with theme: github-dark and title: greet.ts:
function greet(name: string): string {
const message = `Hello, ${name}!`;
return message;
}
console.log(greet('world'));Related MCP server: Code Screenshot Generator
Tools
render_code
Render source code as SVG or PNG with full syntax highlighting.
Param | Type | Default | Description |
| string | required | Source code to render |
| string | auto-detect | Language (ts, rust, py, go, js, and 40+ more) |
| string |
| Color theme (nord, dracula, catppuccin, one-dark-pro, etc.) |
| string | — | Window title bar text (e.g. filename) |
| boolean |
| Line number gutter |
| number |
| Font size in px |
|
|
| SVG is crisp & copyable; PNG is raster |
| number | auto | Code area width in characters |
| number |
| Padding in px |
render_diff
Render a git unified diff with color-coded additions/deletions and language-aware syntax highlighting.
Param | Type | Default | Description |
| string | required | Unified diff content ( |
| string | auto-detect | Language for highlighting within hunks. Auto-detected from |
... | — | — | Same options as |
Diff lines are highlighted with:
@@hunk headers → blue background+additions → green background (#1b4520dark /#dafbe1light)-deletions → red background (#4f1818dark /#ffebe9light)
Syntax highlighting is applied per-hunk in the detected language — not just plain diff markup.
Themes
18 bundled themes:
Dark | Light |
github-dark | github-light |
nord | one-light |
one-dark-pro | material-theme-lighter |
dracula | min-light |
dracula-soft | solarized-light |
catppuccin-mocha | catppuccin-latte |
material-theme | vitesse-light |
min-dark | — |
solarized-dark | — |
vitesse-dark | — |
Test Suite
46 tests across two runners:
npm test # Build → MCP integration tests (cobasaja) → Unit tests (node --test)5 MCP integration tests (
tests/code-shot.test.ts) — tool discovery, rendering, error cases37 unit tests (
tests/*.node-test.ts) — renderSvg structure, diffToLines parsing, guessLanguage heuristics
Usage with Hermes
Add to ~/.hermes/config.yaml:
mcp_servers:
code-shot:
command: "npx"
args: ["-y", "@thesimonharms/code-shot"]Or from local build:
mcp_servers:
code-shot:
command: "node"
args: ["/path/to/code-shot/dist/index.js"]Configuration
Set defaults via ~/.code-shotrc (JSON):
{
"theme": "nord",
"show_line_numbers": true,
"font_size": 14,
"padding": 16
}Also checked (in order): ~/.code-shotrc > ~/.code-shotrc.json > ~/.config/code-shot/config.json.
Tool call arguments override config file values.
Usage with Claude Code / Cursor
{
"mcpServers": {
"code-shot": {
"command": "node",
"args": ["/path/to/code-shot/dist/index.js"]
}
}
}Development
npm install
npm run build # tsc
npm test # build + cobasaja + node --testHow it works
Shiki tokenizes the code with full syntax highlighting (grammars for 40+ languages)
SVG renderer builds a pixel-perfect SVG with monospace positioning, window chrome, line numbers, and diff markers
Optional PNG via
@resvg/resvg-jsfor platforms that don't support SVG nativelyLanguage auto-detection via shebang parsing and code heuristics (18 language patterns)
Diff language detection from
diff --git a/file.ext b/file.extheaders
No browser, no DOM, no headless Chromium — pure math-based SVG generation.
License
MIT
Maintenance
Tools
Related MCP Servers
- Flicense-qualityDmaintenanceEnables AI assistants to generate UML diagrams through natural language by rendering PlantUML code into PNG or SVG images. Supports sequence diagrams, class diagrams, use case diagrams, and other UML chart types with Base64-encoded output.Last updated7
- AlicenseBqualityFmaintenanceEnables generating beautiful syntax-highlighted code screenshots with professional themes directly from Claude. Supports file reading, line selection, git diff visualization, and batch processing across 20+ programming languages.Last updated42844MIT
- Flicense-qualityDmaintenanceEnables AI agents to generate images from HTML/CSS, capture URL screenshots, and manage reusable templates through the RendShot API. Provides tools for rendering visual content programmatically within AI workflows.Last updated4
- Alicense-qualityCmaintenanceGenerates beautiful code snippet images with syntax highlighting and customizable themes for sharing on social media.Last updated43MIT
Related MCP Connectors
Generate images, GIFs, and PDFs from HTML, URLs, or templates — from your AI agent.
Multilingual semantic SVG icon search with previews for AI coding agents. 20,000+ icons.
Screenshots, PDFs and Markdown from any URL or HTML for AI agents, via the SnapForge API
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/thesimonharms/code-shot'
If you have feedback or need assistance with the MCP directory API, please join our Discord server