Cover image

MCP服务器,用于使用简化客户端应用程序的图像识别。

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
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • 1Panel-dev
  • 🔥1Panel提供了直观的Web接口和MCP服务器,用于在Linux服务器上管理网站,文件,容器,数据库和LLMS。

  • WangRongsheng
  • 🧑‍🚀 llm 资料总结(数据处理、模型训练、模型部署、 o1 模型、mcp 、小语言模型、视觉语言模型)|摘要世界上最好的LLM资源。

  • sigoden
  • 使用普通的bash/javascript/python函数轻松创建LLM工具和代理。

  • hkr04
  • 轻巧的C ++ MCP(模型上下文协议)SDK

  • rulego
  • ⛓️Rulego是一种轻巧,高性能,嵌入式,下一代组件编排规则引擎框架。

  • RockChinQ
  • 😎简单易用、🧩丰富生态 -大模型原生即时通信机器人平台| 适配QQ / 微信(企业微信、个人微信) /飞书 /钉钉 / discord / telegram / slack等平台| 支持chatgpt,deepseek,dify,claude,基于LLM的即时消息机器人平台,支持Discord,Telegram,微信,Lark,Dingtalk,QQ,Slack

  • dmayboroda
  • 带有可配置容器的本地对话抹布

  • paulwing
  • 使用MCP服务创建的测试存储库

    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.