Read Image MCP Server
MCP server using Google Gemini to read and describe image content, supporting single or multiple images and custom prompts.
README
Read Image MCP Server v1.0.0
MCP (Model Context Protocol) server dùng Google Gemini để đọc và mô tả nội dung ảnh. Hỗ trợ cả ảnh đơn và nhiều ảnh cùng lúc (so sánh, đối chiếu).
🚀 Tính năng
- 📷 Đọc ảnh đơn — Gửi 1 ảnh và nhận mô tả chi tiết bằng tiếng Việt
- 🖼️ Đọc nhiều ảnh — Gửi nhiều ảnh trong 1 lần gọi để so sánh, đối chiếu
- 📝 Prompt tùy chỉnh — Đặt câu hỏi cụ thể về ảnh (không bắt buộc)
- 🎨 Hỗ trợ nhiều định dạng — PNG, JPEG, GIF, WebP, BMP, SVG, TIFF, ICO, AVIF
- ⚡ Tích hợp MCP — Dùng được ngay trong Claude Code, VS Code, JetBrains...
📋 Yêu cầu
- Node.js >= 18
- Google AI Studio API Key (miễn phí)
- Claude Code hoặc MCP client khác
🔧 Cài đặt
1. Clone repo
git clone https://github.com/hovie/read-image-mcp.git
cd read-image-mcp
2. Cài đặt dependencies
npm install
3. Build
npm run build
⚙️ Cấu hình
Lấy Gemini API Key (miễn phí)
- Truy cập Google AI Studio
- Đăng nhập bằng tài khoản Google
- Nhấn "Create API Key" để tạo key mới
- Copy key vừa tạo
Cấu hình MCP Server
Có 2 cách cấu hình:
Cách 1: Dùng file .mcp.json (khuyên dùng cho Claude Code)
Copy file mẫu và sửa API key:
copy .mcp.json.example .mcp.json
Sau đó mở .mcp.json và thay YOUR_GEMINI_API_KEY_HERE bằng API key thật của bạn:
{
"mcpServers": {
"read-image": {
"command": "npx",
"args": ["tsx", "d:\\MCP\\read-image\\src\\index.ts"],
"env": {
"GEMINI_API_KEY": "AIzaSy...your-key-here",
"GEMINI_MODEL": "gemini-2.5-flash"
}
}
}
}
Cách 2: Dùng file .env
copy .env.example .env
Sửa .env với API key của bạn:
GEMINI_API_KEY=your-api-key-here
GEMINI_MODEL=gemini-2.5-flash
Chọn Model
| Model | Mô tả | Dùng khi |
|---|---|---|
gemini-2.5-flash |
Nhanh, miễn phí | Hầu hết trường hợp |
gemini-2.5-pro |
Mạnh hơn, có trả phí | Ảnh phức tạp, cần phân tích sâu |
Sửa biến GEMINI_MODEL trong .env hoặc .mcp.json để đổi model.
🏃 Cách chạy
Chạy dev (không cần build)
npm run dev
Chạy production (sau khi build)
npm run build
npm start
Dùng trong Claude Code
Sau khi cấu hình .mcp.json, Claude Code sẽ tự động nhận MCP server. Bạn có thể gọi tool read_image từ Claude Code để đọc ảnh.
Tool sẽ xuất hiện với tên read_image với các tham số:
| Tham số | Loại | Bắt buộc | Mô tả |
|---|---|---|---|
image_path |
string | Không* | Đường dẫn đến 1 file ảnh |
image_paths |
string[] | Không* | Đường dẫn đến nhiều file ảnh |
prompt |
string | Không | Câu hỏi / yêu cầu về ảnh |
*Phải có ít nhất 1 trong 2:
image_pathhoặcimage_paths
📖 Ví dụ
Đọc 1 ảnh
Dùng read_image đọc ảnh D:\photos\cat.png
Đọc nhiều ảnh để so sánh
Dùng read_image đọc 2 ảnh D:\photos\before.png và D:\photos\after.png,
so sánh sự khác biệt giữa 2 ảnh
Hỏi câu hỏi cụ thể về ảnh
Dùng read_image đọc ảnh D:\screenshots\dashboard.png,
cho biết có những số liệu gì trên dashboard này?
📁 Cấu trúc project
read-image-mcp/
├── src/
│ └── index.ts # MCP server chính
├── dist/ # Build output (sau khi chạy npm run build)
├── .env.example # Mẫu file biến môi trường
├── .mcp.json.example # Mẫu cấu hình MCP cho Claude Code
├── .gitignore
├── package.json
├── tsconfig.json
└── README.md
🔒 Bảo mật
- KHÔNG commit file
.envhoặc.mcp.jsonchứa API key thật - File
.envvà.mcp.jsonđã được thêm vào.gitignore - Dùng file
.examplelàm mẫu cho người khác - Nếu lỡ commit API key, xóa ngay trên Google AI Studio và tạo key mới
🛠️ Tech Stack
- Model Context Protocol SDK — Giao thức MCP
- Google Generative AI SDK — Gemini API
- TypeScript + tsx — Runtime
📄 License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.