Sponsored by Deepsite.site

SSE-based Server and mobile Angular App

Created By
DrBenjamin8 months ago
MCP server for image recognition with Angular mobile client app.
Content

SSE-based Server and mobile Angular 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
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="

Test image URL:

https://www.seriousbenentertainment.org/R/Image.png
http://212.227.102.172:9000/templategenerator/subfolder/City.Golf.jpg

Running the MCP server and Streamlit client app:

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

# Activating the conda environment
conda activate imagerecog
python -m pip install "mcp[cli]"

# 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 mobile/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.

Mobile App

The Angular app can be run using the following commands:

# Installing Angular CLI
npm install -g @angular/cli

# Installing the required packages
npm install

# Running the app
ng serve

Buildung the app for mobile

To build the app for mobile, use the following commands (pin matching Capacitor versions):

# Preparing the app for mobile
cd mobile
npm install @capacitor/core@5.7.8 @capacitor/cli@5.7.8
npm install @capacitor/ios@5.7.8
npm install @capacitor/browser@^5 --save
npx cap init BenBox org.benbox.benbox --webDir=../browser
npx cap add ios
# or
npx cap sync ios
cd ios/App
pod install

# Building the app (from project root)
npm install --prefix mobile
npm run build --prefix mobile
npm run cap:copy --prefix mobile
npm run cap:open:ios --prefix mobile
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Serper MCP ServerA Serper MCP Server
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
CursorThe AI Code Editor
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
ChatWiseThe second fastest AI chatbot™
Playwright McpPlaywright MCP server
DeepChatYour AI Partner on Desktop
Amap Maps高德地图官方 MCP Server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Tavily Mcp
WindsurfThe new purpose-built IDE to harness magic
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.