Computer Vision Tools MCP server

Provides computer vision capabilities including image generation, OCR text extraction, and object detection through containerized Docker services with MinIO integration for image storage and retrieval.
Back to servers
Provider
Omid Rezai
Release date
Feb 22, 2025
Language
Python
Stats
1 star

This repository provides a specialized Computer Vision Model Context Protocol (MCP) server that integrates computer vision capabilities with language models. It enables easy communication between vision tools and language models through a standardized protocol.

Installation

Prerequisites

  • Python 3.10 or higher
  • pip package manager

Setup Instructions

  1. Clone the repository:

    git clone https://github.com/username/cv-mcp-tools.git
    cd cv-mcp-tools
    
  2. Create and activate a virtual environment (recommended):

    python -m venv venv
    source venv/bin/activate  # On Windows, use: venv\Scripts\activate
    
  3. Install the required dependencies:

    pip install -r requirements.txt
    

Configuration

Create a configuration file named config.yaml with the following structure:

server:
  host: "127.0.0.1"
  port: 8000

models:
  vision_model:
    type: "resnet"
    weights: "path/to/model/weights.pth"
    
logging:
  level: "INFO"
  file: "logs/server.log"

Running the Server

Start the MCP server with:

python server.py --config config.yaml

By default, the server will run on http://127.0.0.1:8000 unless specified otherwise in your configuration.

Using the API

Basic Requests

Send images to the server for processing:

import requests
import base64
from PIL import Image
import io

# Prepare the image
image = Image.open("example.jpg")
buffered = io.BytesIO()
image.save(buffered, format="JPEG")
img_str = base64.b64encode(buffered.getvalue()).decode()

# Send request to the server
response = requests.post(
    "http://127.0.0.1:8000/process",
    json={
        "image": img_str,
        "settings": {
            "model": "vision_model",
            "task": "detection"
        }
    }
)

# Process the response
results = response.json()
print(results)

Available Endpoints

  • /process - Main endpoint for image processing
  • /models - Lists available vision models
  • /health - Server health check
  • /metrics - Server performance metrics

Processing Options

The /process endpoint accepts the following parameters:

  • image: Base64 encoded image data
  • settings: Configuration object with:
    • model: The vision model to use (string)
    • task: The type of vision task (detection, classification, segmentation)
    • threshold: Confidence threshold (float, 0-1)
    • max_detections: Maximum number of detections to return (integer)

Troubleshooting

  • Connection issues: Verify the server is running and check your firewall settings
  • Processing errors: Check that your image format is supported (JPEG, PNG)
  • Performance issues: Try reducing image size or adjusting batch processing settings

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later