Cover image

MCP -Server zur Bilderkennung mit StreamLit Client App.

3 years

Works with Finder

0

Github Watches

0

Github Forks

0

Github Stars

SSE-based Server and Client-Streamlit-App

Image recognition tool on top of the MCP protocol. This project is designed to provide a simple and efficient way to recognize images using a server-client architecture.

Why?

MCP server can now be some running process that agents (clients) connect to, use, and disconnect from whenever and wherever they want. In other words, an SSE-based server and clients can be decoupled processes (potentially even, on decoupled nodes). This is different and better fits "cloud-native" use-cases compared to the STDIO-based pattern where the client itself spawns the server as a subprocess.

Setup

Install the required packages and the MCP server and client:

# Installing Node.js on Linux
sudo apt install nodejs npm

# Installing Node.js on Mac
brew install nodejs npm

# Installing mcp
npm install -g mcp-framework
conda install -c conda-forge mcp 

# Cloning the repo
git clone https://github.com/DrBenjamin/imagerecog

Usage

Test bytes for an image to test on MCP Inspector or in VS Code Copilot Chat:

"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGNgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII="

Running the MCP server and client:

# Creating a conda environment using the environment.yml file
conda env create -f environment.yml

# Activating the conda environment
conda activate imagerecog

# 1. Running the MCP dev server
mcp dev src/server.py

# 2. Running the MCP server
python src/server.py

# 3. Running the Streamlit app
python -m streamlit run app.py

# or the run script
sudo chmod 755 run.sh
./run.sh
lsof -i :6274
lsof -i :8080
lsof -i :8501

Configuration

Change configuration and add the OpenAI API key in the .streamlit/st.secrets.toml file:

# LLM Provider
LLM_LOCAL = "False"  # `False` for local Ollama model, `True` for OpenAI API

# MCP API
[MCP]
MCP_URL = "http://127.0.0.1:8080"
MCP_SYSTEM_PROMPT = "<system prompt for image recognition>"
MCP_USER_PROMPT = "<user prompt for image recognition>"

# Ollama API
[OLLAMA]
OLLAMA_URL = "http://127.0.0.1:11434"
OLLAMA_MODEL = "<ollama model>" # e.g. llava or "llama3.2-vision"

# OpenAI API
[OPENAI]
OPENAI_API_KEY = "sk-..."
OPENAI_MODEL = "<model>" # e.g. "o4-mini" or "gpt-4.1" or "gpt-4o" or "gpt-4-turbo"

Ollama

To install und run the Ollama model, use the following command:

# Running the Ollama service
# Linux
systemctl start ollama
# or Mac
brew services start ollama

# Running the model
ollama run llama3.2-vision

# Sharing the models between Ollama and LM Studio
# https://smcleod.net/2024/03/llamalink-ollama-to-lm-studio-llm-model-linker/
go install github.com/sammcj/llamalink@latest
llamalink

Docker

To use the Docker for MCP hosting, use the following commands:

# Build the docker image
docker build -t <docker hub user name>/imagerecog .

# Login to Docker Hub
docker login

# Tagging the image (https://hub.docker.com/repositories/drbenjamin)
docker tag <docker hub user name>/imagerecog <docker hub user name>/imagerecog:latest

# Push the image to the registry
docker push <docker hub user name>/imagerecog:latest

Now the MCP docker can be added in VS Code or any other MCP client like Claude Desktop.

相关推荐

  • av
  • Führen Sie mühelos LLM -Backends, APIs, Frontends und Dienste mit einem Befehl aus.

  • 1Panel-dev
  • 🔥 1Panel bietet eine intuitive Weboberfläche und einen MCP -Server, um Websites, Dateien, Container, Datenbanken und LLMs auf einem Linux -Server zu verwalten.

  • WangRongsheng
  • 🧑‍🚀 全世界最好的 llm 资料总结(数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Zusammenfassung der weltbesten LLM -Ressourcen.

  • rulego
  • ⛓️Rugele ist ein leichter, leistungsstarker, leistungsstarker, eingebetteter Komponenten-Orchestrierungsregel-Motor-Rahmen für GO.

  • sigoden
  • Erstellen Sie einfach LLM -Tools und -Argarten mit einfachen Bash/JavaScript/Python -Funktionen.

  • hkr04
  • Leichtes C ++ MCP (Modellkontextprotokoll) SDK

  • RockChinQ
  • 😎简单易用、🧩丰富生态 - 大模型原生即时通信机器人平台 | 适配 qq / 微信(企业微信、个人微信) / 飞书 / 钉钉 / diskord / telegram / slack 等平台 | 支持 Chatgpt 、 Deepseek 、 Diffy 、 Claude 、 Gemini 、 xai 、 ppio 、 、 ulama 、 lm Studio 、阿里云百炼、火山方舟、 siliconflow 、 qwen 、 mondshot 、 chatglm 、 sillytraven 、 mcp 等 llm 的机器人 / agent | LLM-basierte Instant Messaging Bots-Plattform, unterstützt Zwietracht, Telegramm, Wechat, Lark, Dingtalk, QQ, Slack

  • dmayboroda
  • On-Premise-Konversationslappen mit konfigurierbaren Behältern

  • modelscope
  • Bauen Sie LLM-Multi-Agent-Anwendungen auf einfachere Weise auf.

  • paulwing
  • Ein Test -Repository, das mit MCP -Dienst erstellt wurde

    Reviews

    3 (8)
    Avatar
    user_nHodIxXR
    2025-04-23

    As a dedicated MCP Application user, I am thoroughly impressed with imagerecog by DrBenjamin. This tool seamlessly integrates with my workflow, offering precise image recognition capabilities that enhance productivity and accuracy. The user-friendly interface and comprehensive support have made it an indispensable part of my daily tasks. Highly recommended!

    Avatar
    user_y5yCbdtz
    2025-04-23

    Imagerecog by DrBenjamin is an outstanding application for image recognition. Its user-friendly interface and high accuracy make it a go-to tool for both professionals and hobbyists. The seamless integration and robust features demonstrate the author's expertise in the field. Highly recommended for anyone looking to enhance their image analysis capabilities!

    Avatar
    user_xL3YgX9p
    2025-04-23

    I've been using imagerecog and it has been a game-changer for my image recognition tasks. DrBenjamin has done an exceptional job creating this tool. With its user-friendly interface and efficient algorithms, it's incredibly easy to use and accurate. Highly recommend it to anyone looking for a reliable image recognition solution!

    Avatar
    user_8qgfWSvU
    2025-04-23

    Imagerecog by DrBenjamin is a fantastic application for all your image recognition needs. As an avid user, I've found it to be incredibly accurate and efficient. The user interface is intuitive and easy to navigate, making the process seamless even for beginners. Highly recommend it for anyone looking for a reliable and effective image recognition solution!

    Avatar
    user_ruYF5Ll9
    2025-04-23

    I've been using imagerecog by DrBenjamin and it has exceeded my expectations. The accuracy and efficiency in recognizing images are outstanding, saving me a lot of time and effort. Highly recommend this tool to anyone in need of reliable image recognition software!

    Avatar
    user_QIQIILiB
    2025-04-23

    I've been using ImageRecog by DrBenjamin and am thoroughly impressed! This tool provides highly accurate image recognition capabilities and great performance. It's user-friendly, making it easy to integrate into my projects. I recommend it to anyone needing reliable image recognition solutions.

    Avatar
    user_yK3z71wR
    2025-04-23

    Imagerecog by DrBenjamin is an outstanding tool for image recognition. It quickly and accurately identifies objects, making it ideal for various applications. The user interface is intuitive, and the performance is impressive. Highly recommended for both beginners and professionals!

    Avatar
    user_bmQ6xY1m
    2025-04-23

    As an avid user of the MCP application, I must say that ImageRecog by DrBenjamin is simply outstanding! It offers incredibly accurate image recognition capabilities. The intuitive interface makes it accessible for users of all skill levels. Highly recommend this tool for anyone in need of reliable and efficient image analysis.