Skip to main content

Graphics MCP Server

Code style: crackerjack Runtime: oneiric Framework: FastMCP uv Python: 3.13+

Unified MCP server for raster image inspection, conversion, and manipulation.

Version: 0.2.0 Status: Internal Bodai integration component

Quick Links

Quality & CI

Crackerjack is the standard quality-control and CI/CD gate for Graphics MCP changes. Local verification should mirror the Crackerjack workflow used across the Bodai ecosystem.


Overview

Graphics MCP exposes common image operations through a FastMCP server. It gives agents a bounded way to inspect image metadata, convert formats, resize, crop, rotate, flip, thumbnail, and apply filters while keeping filesystem access constrained to configured directories.

The current implementation uses the Pillow backend. The settings model already reserves flags for ImageMagick and GIMP backends, but those should be treated as future or optional surfaces unless validated for the target deployment.

Capabilities

Implemented tool surface:

  • Image inspection: read dimensions, format, mode, and file metadata
  • Format conversion: convert among JPEG, PNG, GIF, BMP, WEBP, and TIFF
  • Resize and crop: fit, fill, exact, and crop-oriented raster transformations
  • Filter operations: blur, sharpen, grayscale, sepia, invert, contrast, brightness, and related effects
  • Orientation operations: rotate and flip images
  • Thumbnail generation: create bounded thumbnails from source images
  • Filesystem guardrails: list and enforce configured allowed directories and maximum file size
  • HTTP health routes: /health and /healthz for MCP client and process supervision checks

Quick Start

Prerequisites

  • Python 3.13+
  • UV package manager
  • Local image files under an allowed directory

Local Setup

git clone https://github.com/lesleslie/graphics-mcp.git
cd graphics-mcp
uv sync --group dev

Run The Server

uv run graphics-mcp start
uv run graphics-mcp health

The default HTTP bind is 127.0.0.1:3040.

Allow A Working Directory

export GRAPHICS_ALLOWED_DIRECTORIES="/tmp,/Users/les/Pictures,/Users/les/Downloads"
uv run graphics-mcp start

CLI Commands

The CLI is built with mcp-common and provides the standard lifecycle command surface used by Bodai MCP servers.

uv run graphics-mcp start      # Start the HTTP MCP server
uv run graphics-mcp stop       # Stop the managed server process
uv run graphics-mcp restart    # Restart the managed server process
uv run graphics-mcp status     # Show process status
uv run graphics-mcp health     # Run the local health probe

MCP Server Configuration

Claude / Codex Style Configuration

Add the server to an MCP client configuration:

{
  "mcpServers": {
    "graphics": {
      "command": "uv",
      "args": ["run", "graphics-mcp", "start"],
      "cwd": "/Users/les/Projects/graphics-mcp",
      "env": {
        "GRAPHICS_ALLOWED_DIRECTORIES": "[\"/tmp\", \"/Users/les/Pictures\", \"/Users/les/Downloads\"]"
      }
    }
  }
}

Health Checks

curl http://127.0.0.1:3040/health
curl http://127.0.0.1:3040/healthz

Installation via Bodai Marketplace

This repo ships a Bodai Claude Code plugin manifest (.claude-plugin/plugin.json) plus a colocated .mcp.json and three slash commands in commands/. To install via the Bodai marketplace, first register the marketplace with Claude Code, then install the plugin by name. Once installed, the slash commands /graphics-convert, /graphics-resize, and /graphics-thumbnail become available alongside the mcp__graphics__* tools.

Tool Reference

Tool Purpose Key Inputs
get_image_info Inspect image metadata image_path
convert_image Convert an image to another format image_path, output_format
resize_image Resize an image by width, height, and mode image_path (required); width XOR height
crop_image Crop an image to pixel boundaries image_path, left, top, right, bottom
apply_filter Apply a raster filter effect image_path, filter_type
rotate_image Rotate an image by degrees image_path, degrees
flip_image Flip horizontally or vertically image_path
create_thumbnail Create a thumbnail within max dimensions image_path, width, height
list_available_filters List supported filter names none
list_allowed_directories Show configured filesystem guardrails none
list_supported_formats Show supported image formats none

Tool responses follow a consistent ToolResponse shape:

{
  "success": true,
  "message": "Image converted successfully",
  "data": {},
  "error": null,
  "next_steps": []
}

Configuration

Committed defaults live in settings/graphics.yaml. Runtime overrides should come from environment variables or a local .env file that is not committed.

Setting Environment Variable Default
Default backend GRAPHICS_DEFAULT_BACKEND pillow
Enable Pillow GRAPHICS_ENABLE_PILLOW true
Enable ImageMagick GRAPHICS_ENABLE_IMAGEMAGICK false
Enable GIMP GRAPHICS_ENABLE_GIMP false
Allowed directories GRAPHICS_ALLOWED_DIRECTORIES /tmp, ~/Pictures, ~/Downloads
Max file size GRAPHICS_MAX_FILE_SIZE_MB 100
Allowed formats GRAPHICS_ALLOWED_FORMATS JPEG, PNG, GIF, BMP, WEBP, TIFF
Enable HTTP transport GRAPHICS_ENABLE_HTTP_TRANSPORT false
HTTP host GRAPHICS_HTTP_HOST 127.0.0.1
HTTP port GRAPHICS_HTTP_PORT 3040
Log level GRAPHICS_LOG_LEVEL INFO
JSON logs GRAPHICS_LOG_JSON true

Project Structure

graphics_mcp/
  backends/          # Backend interface and Pillow implementation
  cli.py             # mcp-common lifecycle CLI
  config.py          # Pydantic settings and logging
  models.py          # Typed image operation models
  server.py          # FastMCP application factory
  tools/             # Universal and raster MCP tools
settings/
  graphics.yaml      # Committed defaults
tests/

Development

uv sync --group dev
uv run pytest
uv run ruff check graphics_mcp tests
uv run ruff format graphics_mcp tests
uv run mypy graphics_mcp

Use targeted tests when isolating a backend or tool behavior:

uv run pytest tests -k resize -v

Security Notes

  • Keep image file access constrained with GRAPHICS_ALLOWED_DIRECTORIES.
  • Do not add tools that write outside configured paths.
  • Treat user-provided image paths as untrusted input.
  • Avoid logging full sensitive local paths when examples are shared outside local development.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

graphics_mcp-0.3.0.tar.gz (299.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

graphics_mcp-0.3.0-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

File details

Details for the file graphics_mcp-0.3.0.tar.gz.

File metadata

  • Download URL: graphics_mcp-0.3.0.tar.gz
  • Upload date:
  • Size: 299.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for graphics_mcp-0.3.0.tar.gz
Algorithm Hash digest
SHA256 12e0787874985600df2f6c6d146f5c10a48198245dafb7fa3aec4cea9746bc59
MD5 a245dbc0615cf5a514b7818ba0816167
BLAKE2b-256 3fa76599481586e51279f1e6ce05258d57586363b9aa625442f3d2fb21d71adf

See more details on using hashes here.

File details

Details for the file graphics_mcp-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: graphics_mcp-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 23.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for graphics_mcp-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e36660abbda6983908cc9a87e2306633b19d880093244e47b6bf52c4d0bc73b7
MD5 c2b0dbb094a1e6c82053a37e56afe491
BLAKE2b-256 236dabe9ce36eb5d16f888a4cc07cc8445cee6cb73187c6e15ec3b188e8c6614

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page