Skip to main content
Glama
kevinten-ai

Media Toolkit MCP Server

by kevinten-ai

Media Toolkit MCP Server

Features

  • 5 toolsremove_background, search_stock_media, resize_image, convert_format, create_collage

  • Free & local — no paid cloud APIs required for image processing

  • AI background removal — powered by rembg (U2Net), runs entirely on your machine

  • Stock photo search — search millions of free photos via Pexels (free API key)

  • Smart resize — fit, fill, or center crop modes

  • Format conversion — PNG, JPG, WebP, SVG→PNG

  • Grid collage — arrange multiple images into customizable grids

  • Auto-save output images to disk with timestamps

Related MCP server: jgkme/kilo-image-gen-mcp

Architecture

User Prompt → AI Assistant (Claude / Cursor) → MCP Server → Local Processing (Pillow / rembg)
                                                   ↓
                                             Save to disk + Display

How It Works

All image processing happens locally using Python libraries:

Tool

Library

Cloud API?

Notes

remove_background

rembg (U2Net)

No

Model downloads on first use (~170MB)

search_stock_media

httpx

Pexels API (free)

Requires free API key

resize_image

Pillow

No

Fit, fill, crop modes

convert_format

Pillow

No

PNG/JPG/WebP/SVG→PNG

create_collage

Pillow

No

Grid layout with spacing

Quick Start

1. Clone & install

git clone https://github.com/kevinten-ai/mcp-media-toolkit.git
cd mcp-media-toolkit
uv sync

Background removal is optional because its ML dependencies are much larger than the core server:

uv sync --extra background-removal

2. (Optional) Get a free Pexels API key — visit https://www.pexels.com/api/ → sign up → copy your key

3. Configure MCP

# Without Pexels (all local tools work without any API key)
claude mcp add --transport stdio mcp-media-toolkit \
  -- uv --directory /path/to/mcp-media-toolkit run media-toolkit

# With Pexels stock photo search
claude mcp add --transport stdio mcp-media-toolkit \
  --env PEXELS_API_KEY=your_pexels_key \
  -- uv --directory /path/to/mcp-media-toolkit run media-toolkit
{
  "mcpServers": {
    "mcp-media-toolkit": {
      "command": "uv",
      "args": ["--directory", "/path/to/mcp-media-toolkit", "run", "media-toolkit"],
      "env": {
        "PEXELS_API_KEY": "your_pexels_key"
      }
    }
  }
}

4. Use it — just ask your AI assistant:

"Remove the background from /path/to/photo.png"
"Search for stock photos of mountain landscapes"
"Resize this image to 1920x1080 using fill mode"
"Convert image.png to WebP format"
"Create a 3-column collage from these 6 images"

Output images are automatically saved to the output/ directory.

Tools

remove_background — AI Background Removal

Remove image backgrounds using the rembg library (U2Net model). Runs entirely locally.

remove_background(image_path="/path/to/photo.png")
remove_background(image_path="photo.jpg", output_path="/custom/output/result.png")

Parameter

Required

Description

image_path

Yes

Path to the input image

output_path

No

Custom output path (auto-generated if omitted)

Note: The first call downloads the U2Net model (~170MB). Subsequent calls are fast.

Search millions of free stock photos via the Pexels API.

search_stock_media(query="sunset beach")
search_stock_media(query="office workspace", count=10, orientation="landscape")

Parameter

Required

Description

query

Yes

Search terms (e.g. "sunset beach")

count

No

Number of results (default: 5, max: 80)

orientation

No

Filter: landscape, portrait, or square

Returns image URLs (original, large, medium) with photographer credits.

resize_image — Resize & Crop

Resize images with three modes:

resize_image(image_path="photo.png", width=1920, height=1080)
resize_image(image_path="photo.png", width=800, height=800, mode="fill")
resize_image(image_path="photo.png", width=500, height=500, mode="crop")

Parameter

Required

Description

image_path

Yes

Path to the input image

width

Yes

Target width in pixels

height

Yes

Target height in pixels

mode

No

fit (default, contain), fill (cover + crop), crop (center crop)

output_path

No

Custom output path

Modes explained:

  • fit — Resize to fit within the bounds, preserving aspect ratio. Result may be smaller than target.

  • fill — Resize to cover the bounds, then center crop. Result is exactly the target size.

  • crop — Center crop the original image to the target size (no resize).

convert_format — Format Conversion

Convert between PNG, JPG, WebP. Also supports SVG→PNG (requires cairosvg).

convert_format(image_path="photo.png", output_format="webp")
convert_format(image_path="icon.svg", output_format="png")
convert_format(image_path="photo.webp", output_format="jpg")

Parameter

Required

Description

image_path

Yes

Path to the input image

output_format

Yes

Target format: png, jpg, webp

output_path

No

Custom output path

Note: Converting RGBA images to JPEG automatically composites onto a white background.

create_collage — Grid Collage

Arrange multiple images into a grid layout.

create_collage(image_paths=["a.png", "b.png", "c.png", "d.png"])
create_collage(image_paths=["a.png", "b.png", "c.png"], columns=3, spacing=20)

Parameter

Required

Description

image_paths

Yes

List of image file paths

columns

No

Grid columns (default: 2)

spacing

No

Pixel spacing between images (default: 10)

output_path

No

Custom output path

Images are automatically resized to fit uniform cells within the grid.

Safety limits

  • Resize width and height must be between 1 and 8192 pixels.

  • A collage accepts 1–50 images, 1–20 columns, and 0–512 pixels of spacing.

  • Pexels searches return 1–80 results.

  • Collage canvases are limited to 40 million pixels.

  • Inline MCP image previews are limited to 5 MiB; larger results remain available at the returned file path.

  • A custom output_path must use the target format's extension, must differ from every input path, and must not already exist. Tools never overwrite source images or existing outputs.

Environment Variables

Variable

Required

Default

Description

PEXELS_API_KEY

No*

Pexels API key for stock photo search. *Only required for search_stock_media tool. Free at pexels.com/api

IMAGE_OUTPUT_DIR

No

./output

Directory to save output images

Custom Output Directory

--env IMAGE_OUTPUT_DIR=/absolute/path/to/your/images

Images are saved with microsecond timestamps: rembg_20260331_143022_123456.png, resize_20260331_143055_123456.jpg, etc.

Troubleshooting

Common Errors

Error

Root Cause

Solution

PEXELS_API_KEY is required

Missing API key for stock search

Get a free key at pexels.com/api and set PEXELS_API_KEY

Image not found: /path/to/file

File doesn't exist at given path

Check the file path is correct and the file exists

rembg is not installed

Optional dependency missing

Run uv sync --extra background-removal

Background Removal

Issue

Solution

First call is very slow (~30s)

Normal — rembg downloads U2Net model (~170MB) on first use. Subsequent calls are fast.

Poor removal quality

Try images with clear subject/background contrast. rembg works best with distinct foregrounds.

Out of memory

Large images (>4000px) use significant RAM. Resize first with resize_image.

Format Conversion

Issue

Solution

SVG conversion fails

Install cairosvg: pip install cairosvg (requires system Cairo library)

JPEG output has black areas

Transparent regions in source image. The tool auto-composites onto white — check input has correct alpha.

WebP not supported

Ensure Pillow is built with WebP support (default in most installations)

Pexels API

Issue

Solution

429 Too Many Requests

Free tier allows 200 requests/hour and 20,000/month. Wait or upgrade.

No results

Try broader search terms. Pexels search works best with English keywords.

Prerequisites

  • Python 3.11+

  • uv — install with curl -LsSf https://astral.sh/uv/install.sh | sh

Local Development

git clone https://github.com/kevinten-ai/mcp-media-toolkit.git
cd mcp-media-toolkit

# Install dependencies
uv sync

# Run the server directly
uv run media-toolkit

Debug with MCP Inspector

npx @modelcontextprotocol/inspector uv --directory /path/to/mcp-media-toolkit run media-toolkit

License

MIT — see LICENSE for details.

Available Tools

5 tools
convert_formatC

Convert an image between formats: PNG, JPG, WebP, or SVG to PNG. Works locally with Pillow. Note: SVG input is rasterized to PNG via cairosvg if available, otherwise Pillow.

ParametersJSON Schema
NameRequiredDescriptionDefault
image_pathYesPath to the input image file
output_pathNoPath to save the output image (optional, auto-generated if omitted)
output_formatYesTarget format

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must fully disclose behavior. It mentions local execution and SVG rasterization, but does not address file overwrites, size limits, library dependencies beyond Pillow, or any destructive aspects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences plus a note—efficient and to the point. No filler, but could be more structured with explicit input/output format mapping.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Missing important details like return value, error handling, and supported input formats explicitly (only implied). The ambiguity about SVG conversion to non-PNG outputs and lack of output format clarification reduces completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description adds no extra meaning to parameters beyond the schema; it only provides a note on SVG conversion behavior, which is more about overall process than parameter semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states it converts images between formats, names specific formats, and notes local processing with Pillow. However, the phrase 'or SVG to PNG' is slightly ambiguous about input-output combinations, and it doesn't differentiate from siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool vs alternatives like resize_image or remove_background. The description only states what it does, leaving the agent to infer context from sibling names.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

create_collageB

Arrange multiple images into a grid collage. Images are resized to fit uniformly. Works locally with Pillow.

ParametersJSON Schema
NameRequiredDescriptionDefault
columnsNoNumber of columns in the grid (default: 2)
spacingNoSpacing between images in pixels (default: 10)
image_pathsYesList of image file paths to include in the collage
output_pathNoPath to save the output collage (optional, auto-generated if omitted)

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so the description must carry full burden. It only states 'Images are resized to fit uniformly' and 'Works locally with Pillow', lacking details on side effects, error handling, or permission requirements.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences front-loading the main action with no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema and simple tool, description covers basic operation but omits output format details, error conditions, and prerequisites (e.g., image existence). Adequate but with gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so baseline is 3. The description adds no extra meaning to individual parameters beyond what the schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states the verb 'Arrange' and resource 'multiple images into a grid collage', and distinguishes from sibling tools like convert_format, remove_background, etc. by specifying the collage goal.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool vs alternatives. The description implies use for collage creation but lacks exclusions or context about prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

remove_backgroundA

Remove the background from an image using AI (rembg). Works locally — no cloud API needed. The model (~170MB) is downloaded automatically on first use.

ParametersJSON Schema
NameRequiredDescriptionDefault
image_pathYesPath to the input image file
output_pathNoPath to save the output image (optional, auto-generated if omitted)

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Despite no annotations, the description discloses key behavioral traits: works locally (no cloud API), model downloaded automatically on first use, and model size (~170MB). This provides transparency about resource usage and offline operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences efficiently convey purpose, technical details, and model behavior. No unnecessary words, front-loaded with key information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no output schema, the description covers operation and parameters well. However, it does not explain what the tool returns (e.g., saved file path or success signal), which could be helpful for the agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and both parameters have descriptions in the schema. The tool description does not add additional meaning beyond what is already in the schema, so baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool removes background from an image using AI (rembg). It distinguishes from siblings as none perform background removal, making it unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for background removal and mentions local operation, but does not explicitly specify when to use this tool versus alternatives like resize_image or create_collage. No when-not-to-use guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

resize_imageA

Resize or crop an image to specific dimensions. Supports three modes: fit (preserve aspect ratio, fit within bounds), fill (preserve aspect ratio, cover bounds), crop (center crop to exact size). Works locally with Pillow.

ParametersJSON Schema
NameRequiredDescriptionDefault
modeNoResize mode: 'fit' (contain within bounds, default), 'fill' (cover bounds), 'crop' (center crop to exact size)fit
widthYesTarget width in pixels
heightYesTarget height in pixels
image_pathYesPath to the input image file
output_pathNoPath to save the output image (optional, auto-generated if omitted)

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided; mentions 'works locally with Pillow' and auto-generated output path, but lacks disclosure on file overwriting or permissions beyond basic operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences covering purpose, modes, and local operation with no wasted words; highly efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given full schema coverage and no output schema, the description adequately explains the three modes and local usage; missing potential warnings about input validity or return value.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%; the description reinforces mode options already in the schema but adds little new semantic value beyond the structured definitions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool resizes or crops images to dimensions, lists three modes (fit, fill, crop) distinct from sibling tools like convert_format or remove_background.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains when to use each mode (fit, fill, crop) but does not explicitly compare to sibling tools or state when not to use this tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_stock_mediaA

Search free stock photos via the Pexels API. Returns image URLs with photographer credits. Requires PEXELS_API_KEY env var (free at pexels.com/api).

ParametersJSON Schema
NameRequiredDescriptionDefault
countNoNumber of results to return (default: 5, max: 80)
queryYesSearch query (e.g. 'sunset beach', 'office workspace')
orientationNoPhoto orientation filter

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must fully disclose behavior. It mentions the API source and that results include image URLs and photographer credits, but does not cover potential side effects, rate limits, or error handling. Still, it provides baseline transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences long with no extraneous information. The first sentence states purpose and output; the second covers requirements. Every word adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, the description adequately explains what is returned (URLs and credits) and the source. It is sufficient for a simple parameter set. Could mention orientation filter but schema handles it. Minor gap: no mention of pagination or result handling.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% coverage with descriptions for all three parameters. The description adds no additional semantic detail beyond the schema; it focuses on the tool's overall behavior rather than parameter specifics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb 'Search' and resource 'free stock photos' and identifies the API source (Pexels). It clearly distinguishes from sibling tools (image editing functions) by focusing on searching rather than editing.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states the prerequisite (PEXELS_API_KEY env var) and where to obtain it. This provides clear context for when the tool can be used, though it lacks explicit when-not-to-use guidance, which is less critical given siblings are for different tasks.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 5 tool updatesv1.0.0
    • First observedconvert_format
    • First observedcreate_collage
    • First observedremove_background
    • First observedresize_image
    • First observedsearch_stock_media

TDQS

A3.7/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: format conversion, collage creation, background removal, resizing, and stock photo search. There is no ambiguity or overlap among them.

Naming Consistency5/5

All tool names follow the consistent verb_noun pattern (e.g., convert_format, create_collage, remove_background) with underscores, making them predictable and easy to understand.

Tool Count5/5

With 5 tools, the set is well-scoped for a media toolkit. It covers essential image operations without being excessive or too sparse.

Completeness4/5

The toolkit covers common image tasks like conversion, collage, background removal, resizing, and stock search. However, missing operations like filtering, text overlay, or rotation represent minor gaps that agents may need to work around.

Maintenance

ActivityMaintained
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

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/kevinten-ai/mcp-media-toolkit'

If you have feedback or need assistance with the MCP directory API, please join our Discord server