mcp-nearest-color-finder

sagar-gavhane/mcp-nearest-color-finder

3.1

If you are the rightful owner of mcp-nearest-color-finder and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

MCP Nearest Color Finder is a Python-based server that helps in finding the nearest color match from predefined or custom color lists using RGB color space distance calculation.

Tools
2
Resources
0
Prompts
0

MCP Nearest Color Finder

A Python-based MCP server that provides tools for finding the nearest color match from predefined colors or custom color lists.

Features

  • Find nearest color from a predefined set of basic colors
  • Find nearest color from a custom list of hex colors
  • RGB color space distance calculation
  • Hex color validation
  • Support for standard hex color format (#RRGGBB)

Installation

  1. Make sure you have Python 3.7+ installed
  2. Install the required dependencies:
uv pip install 'mcp[cli]'

Usage

Starting the Server

python main.py

Available Tools

1. find_nearest_color

Finds the nearest color from a predefined set of basic colors.

from mcp.client import Client

client = Client()
result = client.find_nearest_color("#FF8800")
print(result)  # Returns closest predefined color

Predefined colors include:

  • Red (#FF0000)
  • Green (#00FF00)
  • Blue (#0000FF)
  • Yellow (#FFFF00)
  • Cyan (#00FFFF)
  • Magenta (#FF00FF)
2. find_nearest_color_from_list

Finds the nearest color from a custom list of hex colors.

from mcp.client import Client

client = Client()
colors = ["#FF0000", "#00FF00", "#0000FF"]
result = client.find_nearest_color_from_list("#FF8800", colors)
print(result)  # Returns closest color from the provided list

Error Handling

The tools include validation for:

  • Proper hex color format (#RRGGBB)
  • Valid hex digits
  • Non-empty color lists
  • Valid predefined colors

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

MIT License

Requirements

  • Python 3.7+
  • MCP Server package
  • Typer (for CLI support)

For development:

uv pip install -r requirements.txt