Local offline OpenCV-based image-processing MCP server: webcam capture, image transforms, edges, contours, face/QR detection, video, and ~40 tools.
Project description
farshid-mcp-imageProcessing
A comprehensive OpenCV image-processing MCP server for VS Code Copilot Agent Mode (or any MCP client). Exposes ~40 tools across webcam capture, image I/O, transforms, color, filtering, edges, thresholding, morphology, contours/shapes, feature matching, object detection (faces / eyes / bodies / QR), drawing, image arithmetic, template matching, and video processing.
- PyPI:
farshid-mcp-imageProcessing - MCP Registry:
io.github.pirahansiah/farshid-mcp-imageProcessing - Python: 3.14+
- OS: latest Windows 11, latest macOS, latest mainstream Linux (Ubuntu 24.04+/Fedora 41+)
Install (PyPI)
pip install farshid-mcp-imageProcessing
farshid-mcp-imageprocessing # runs the stdio MCP server
Register in VS Code
Add this to your user or workspace mcp.json:
{
"servers": {
"imageProcessing": {
"command": "farshid-mcp-imageprocessing",
"type": "stdio"
}
}
}
Or, if you cloned the repo and want to run from source with the local .venv:
git clone https://github.com/pirahansiah/farshid-mcp-imageProcessing
cd farshid-mcp-imageProcessing
# Windows (PowerShell):
py -3.14 -m venv .venv ; .\.venv\Scripts\Activate.ps1
# macOS / Linux:
python3.14 -m venv .venv && source .venv/bin/activate
pip install -U pip
pip install -e .
opencv-contrib-python is used so the bundled Haar cascades and extra
algorithms are available.
Quick start: the /cv Copilot prompt
This repo ships a workspace prompt file at .github/prompts/cv.prompt.md. In VS Code Copilot Chat (Agent mode), type:
/cv take image from webcam and save it as gray scale 240 * 240
The agent will call webcam_save, image_to_grayscale, and image_resize
from this server to produce the requested file under ./.farshid/cv/.
Tool catalog
Webcam / capture
webcam_capture(camera_index=0)→ returns a PNG imagewebcam_save(output_path="", camera_index=0)webcam_preview(camera_index=0, seconds=10)(local desktop window)webcam_record(output_path, seconds=5, camera_index=0, fps=20)
Image I/O & info
image_show(path)— return image to chatimage_info(path)— shape, dtype, mean, file sizeimage_convert(input_path, output_path, quality=95)
Geometric transforms
image_resize(... width|height|scale, interpolation)image_crop(input_path, output_path, x, y, width, height)image_rotate(input_path, output_path, angle, scale=1, keep_size=False)image_flip(input_path, output_path, direction)image_pad(... top, bottom, left, right, border_type, color)
Color
image_to_grayscalecolor_convert(target=gray|hsv|hls|lab|ycrcb|rgb|bgr)adjust_brightness_contrasthistogram_equalize(method=clahe|global)histogram_data(bins=32)
Filtering
blur_gaussian(ksize, sigma)blur_median(ksize)blur_bilateral(d, sigma_color, sigma_space)sharpen(amount)denoise(strength)
Edges / gradients
edges_canny(threshold1, threshold2)edges_sobel(ksize)edges_laplacian(ksize)
Thresholding & morphology
threshold(method=otsu|binary|binary_inv|adaptive_mean|adaptive_gaussian)morphology(op=erode|dilate|open|close|gradient|tophat|blackhat)
Contours & shapes
find_contours(input_path, output_path?, thresh, min_area)detect_circles(...)— Houghdetect_lines(...)— Probabilistic Houghdetect_corners(...)— Shi-Tomasi
Feature matching
feature_match(image1, image2, output_path?)— ORB + BFMatcher
Object detection (Haar)
detect_facesdetect_eyesdetect_bodiesdetect_qrcode
Drawing
draw_rectangle,draw_circle,draw_line,draw_text
Composition / arithmetic
image_blend(image1, image2, output_path, alpha)image_diff(image1, image2, output_path?)→ mean/max diffimage_concat(images, output_path, direction)template_match(image_path, template_path, output_path?, threshold)
Video
video_info(path)video_extract_frames(video_path, output_dir, every_n, max_frames, ext)video_thumbnail(video_path, output_path, time_seconds)
Build & publish
pip install -U build twine mcp-publisher
python -m build
twine upload dist/*
mcp-publisher login github
mcp-publisher publish .mcp/server.json
OS notes
- Windows 11 (latest): webcam works out of the box; ensure Settings → Privacy & security → Camera → Let desktop apps access your camera is On.
- macOS (latest): the first webcam call triggers a system Camera permission prompt; grant it to the terminal/VS Code process.
- Linux (latest): requires a working
/dev/video*device. Headless servers without a display cannot usewebcam_preview(it opens an OpenCV window).
Notes
- Never use
print()in tool functions: stdout is the MCP protocol channel. Usesys.stderr(the_loghelper at the bottom ofserver.py). webcam_previewopens a real desktop window — only works where the server has a display (not over plain SSH or in a headless container).- All paths support
~expansion. Output directories are created automatically. - Tools that return annotated images take an optional
output_path; when omitted they only return the JSON metadata.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file farshid_mcp_imageprocessing-0.2.1.tar.gz.
File metadata
- Download URL: farshid_mcp_imageprocessing-0.2.1.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41cf5841d0d1191f0b747bcff6bdb03587ae083f143f61a9a4f8858afe483c30
|
|
| MD5 |
681ff96bb007038ea10b9f3140a9a9ec
|
|
| BLAKE2b-256 |
2008c05d83d18333f09e6e63061529e97d376608b443dd60f7256d745dec5c3f
|
Provenance
The following attestation bundles were made for farshid_mcp_imageprocessing-0.2.1.tar.gz:
Publisher:
python-publish.yml on pirahansiah/farshid-mcp-imageProcessing
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
farshid_mcp_imageprocessing-0.2.1.tar.gz -
Subject digest:
41cf5841d0d1191f0b747bcff6bdb03587ae083f143f61a9a4f8858afe483c30 - Sigstore transparency entry: 1417313924
- Sigstore integration time:
-
Permalink:
pirahansiah/farshid-mcp-imageProcessing@a671d3d63ef2ef77d5e83e06a418f1c0d6ba0af4 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/pirahansiah
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@a671d3d63ef2ef77d5e83e06a418f1c0d6ba0af4 -
Trigger Event:
release
-
Statement type:
File details
Details for the file farshid_mcp_imageprocessing-0.2.1-py3-none-any.whl.
File metadata
- Download URL: farshid_mcp_imageprocessing-0.2.1-py3-none-any.whl
- Upload date:
- Size: 15.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbca5cb32a3d1a510b4054356bceedc099db74bbd7c637ce75f3986ecc51bff4
|
|
| MD5 |
f9621462462c00ca06ffb62c2a17163f
|
|
| BLAKE2b-256 |
24288d6666ba67cdb7835de9f52d142672b19da381891f4aaa4d7129a9c26cf5
|
Provenance
The following attestation bundles were made for farshid_mcp_imageprocessing-0.2.1-py3-none-any.whl:
Publisher:
python-publish.yml on pirahansiah/farshid-mcp-imageProcessing
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
farshid_mcp_imageprocessing-0.2.1-py3-none-any.whl -
Subject digest:
dbca5cb32a3d1a510b4054356bceedc099db74bbd7c637ce75f3986ecc51bff4 - Sigstore transparency entry: 1417313930
- Sigstore integration time:
-
Permalink:
pirahansiah/farshid-mcp-imageProcessing@a671d3d63ef2ef77d5e83e06a418f1c0d6ba0af4 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/pirahansiah
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@a671d3d63ef2ef77d5e83e06a418f1c0d6ba0af4 -
Trigger Event:
release
-
Statement type: