Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,12 +1,82 @@
|
|
| 1 |
---
|
| 2 |
-
title: Mcp Images
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: gray
|
| 5 |
colorTo: red
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.34.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Mcp Images Server
|
| 3 |
+
emoji: πΌοΈ
|
| 4 |
colorFrom: gray
|
| 5 |
colorTo: red
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.34.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
+
tags:
|
| 11 |
+
- images
|
| 12 |
+
- mcp-server
|
| 13 |
+
|
| 14 |
---
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
# Image Analysis MCP Server
|
| 18 |
+
|
| 19 |
+
This Gradio application serves as an MCP (Model Control Protocol) server that provides image analysis tools for LLMs like Claude.
|
| 20 |
+
|
| 21 |
+
## π§ Available Tools
|
| 22 |
+
|
| 23 |
+
- **analyze_image**: Comprehensive image analysis including dimensions, format, colors, and orientation
|
| 24 |
+
- **get_image_orientation**: Determine if an image is portrait, landscape, or square
|
| 25 |
+
- **count_colors**: Analyze color information and identify dominant colors
|
| 26 |
+
- **extract_text_info**: Basic analysis for potential text content in images
|
| 27 |
+
|
| 28 |
+
## π Usage with Claude Desktop
|
| 29 |
+
|
| 30 |
+
To use this MCP server with Claude Desktop, add this configuration to your `claude_desktop_config.json`:
|
| 31 |
+
|
| 32 |
+
```json
|
| 33 |
+
{
|
| 34 |
+
"mcpServers": {
|
| 35 |
+
"image-analysis": {
|
| 36 |
+
"url": "https://YOUR_USERNAME-image-analysis-mcp.hf.space/gradio_api/mcp/sse"
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
Replace `YOUR_USERNAME` with your actual HuggingFace username.
|
| 43 |
+
|
| 44 |
+
## π Example Prompts
|
| 45 |
+
|
| 46 |
+
Once configured, you can ask Claude:
|
| 47 |
+
|
| 48 |
+
- "Analyze this image for me"
|
| 49 |
+
- "What are the dominant colors in this photo?"
|
| 50 |
+
- "Is this image portrait or landscape?"
|
| 51 |
+
- "Does this image contain text?"
|
| 52 |
+
|
| 53 |
+
Claude will automatically use these tools to provide detailed image analysis!
|
| 54 |
+
|
| 55 |
+
## π How It Works
|
| 56 |
+
|
| 57 |
+
1. Upload an image to Claude or paste an image
|
| 58 |
+
2. Claude automatically converts the image to base64
|
| 59 |
+
3. Claude calls the appropriate MCP tool on this server
|
| 60 |
+
4. The server processes the image using PIL (Python Imaging Library)
|
| 61 |
+
5. Results are returned to Claude and presented to you
|
| 62 |
+
|
| 63 |
+
## π οΈ Technical Details
|
| 64 |
+
|
| 65 |
+
- Built with **Gradio** and **PIL (Pillow)**
|
| 66 |
+
- Accepts images in various formats (JPEG, PNG, GIF, etc.)
|
| 67 |
+
- Automatically handles base64 image data from MCP clients
|
| 68 |
+
- Provides JSON-formatted analysis results
|
| 69 |
+
- Includes error handling for invalid inputs
|
| 70 |
+
|
| 71 |
+
## π Requirements
|
| 72 |
+
|
| 73 |
+
- `gradio[mcp]>=4.0.0`
|
| 74 |
+
- `Pillow>=9.0.0`
|
| 75 |
+
|
| 76 |
+
## π Links
|
| 77 |
+
|
| 78 |
+
- [MCP Documentation](https://modelcontextprotocol.io/)
|
| 79 |
+
- [Gradio MCP Guide](https://www.gradio.app/guides/building-an-mcp-server-with-gradio)
|
| 80 |
+
- [Claude Desktop](https://claude.ai/desktop)
|
| 81 |
|
| 82 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|