kayamcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@kayamcpdraw a 16x16 pixel art of a star"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
kayamcp ๐จ๐ค
LibreSprite Visual MCP Server โ Real-time screen capture, visual UI interaction, and self-healing pixel art automation for LibreSprite.
An AI agent that can see your screen, detect LibreSprite's UI, draw alongside you in real-time, and self-correct any pixel errors automatically.
โจ Features
Feature | Module | Description |
๐ฅ๏ธ Ultra-Fast Screen Streaming |
| 10-60 FPS screen capture via MSS with pre-allocated buffers and zero-copy reads |
๐ฏ Dynamic Calibration |
| Auto-detects LibreSprite window and canvas boundaries using Win32 + OpenCV contour analysis |
๐ง Visual UI Interaction |
| Selects tools (pencil, eraser, fillโฆ), colours from the palette, and manages layers |
โ๏ธ Cooperative Drawing |
| Moves cursor, executes stabilised strokes, and draws alongside the user in real-time |
๐ Self-Healing Loop |
| Verifies drawn pixels post-stroke and auto-corrects mismatches with retry logic |
๐ MCP Server |
| JSON-RPC 2.0 server (stdio/HTTP) implementing the Model Context Protocol |
Related MCP server: pixel-mcp
๐ Quick Start
Prerequisites
Windows 10/11 (uses Win32 API for desktop switching and window detection)
Python 3.10+
LibreSprite installed and running
Installation
# Clone the repository
git clone https://github.com/YOUR_USERNAME/kayamcp.git
cd kayamcp
# Install with pip
pip install -e .
# Or with uv (recommended)
uv pip install -e .Run the MCP Server
# stdio mode (for MCP clients like Claude Desktop, Cursor, etc.)
python -m kayamcp
# HTTP mode (for development/testing)
python -m kayamcp --http --port 7799๐ MCP Client Configuration
Claude Desktop / Cursor
Add this to your MCP client configuration:
{
"mcpServers": {
"kayamcp": {
"command": "python",
"args": ["-m", "kayamcp"],
"cwd": "C:/path/to/kayamcp"
}
}
}Available MCP Tools
Tool | Description |
| Capture current screen frame and return dimensions |
| Re-calibrate LibreSprite window and canvas boundaries |
| Get current canvas rectangle |
| Select a drawing tool ( |
| Select an RGB colour for drawing |
| Select an existing layer by name |
| Add a new layer |
| Draw a stroke through canvas coordinate points |
| Smooth points for jitter-free drawing |
| Verify canvas pixels match expected colours |
| Self-heal: verify + redraw mismatched pixels with retries |
๐๏ธ Architecture
kayamcp/
โโโ __init__.py # Package exports
โโโ __main__.py # python -m kayamcp entry point
โโโ desktop.py # Win32 desktop switching (Default desktop context)
โโโ capture.py # High-FPS screen streaming (MSS, threaded)
โโโ calibration.py # LibreSprite window & canvas detection (Win32 + OpenCV)
โโโ ui.py # Visual UI interaction (tools, palette, layers)
โโโ draw.py # Cooperative drawing & cursor control
โโโ feedback.py # Closed-loop pixel verification & self-healing
โโโ mcp_server.py # JSON-RPC 2.0 MCP server (stdio + HTTP)Data Flow
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ MCP Client โโโโโบโ mcp_server โโโโโบโ capture โ
โ (AI Agent) โ โ (JSON-RPC) โ โ (Screen FPS) โ
โโโโโโโโโโโโโโโ โโโโโโโโฌโโโโโโโโ โโโโโโโโฌโโโโโโโโ
โ โ
โโโโโโโโผโโโโโโโโ โโโโโโโโผโโโโโโโโ
โ calibration โโโโโบโ desktop โ
โ (Win32+CV2) โ โ (Win32 API) โ
โโโโโโโโฌโโโโโโโโ โโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโผโโโโโโโโโโโโ
โ โ โ
โโโโโโโโผโโโโ โโโโโโโผโโโโโ โโโโโผโโโโโโโ
โ ui โ โ draw โ โ feedback โ
โ (tools, โ โ (cursor, โ โ (verify, โ
โ colors) โ โ strokes) โ โ heal) โ
โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ๐งช Testing
The project includes a comprehensive test suite with 71 tests across 4 tiers:
# Run all tests
uv run pytest -v
# Run only the adversarial stress tests
uv run pytest tests/test_adversarial_streamer.py -v
# Run only E2E integration tests
uv run pytest tests/test_e2e.py -vTest Tiers
Tier | Focus | Tests |
Tier 1 | Feature coverage (streaming, calibration, UI, drawing, healing) | 25 |
Tier 2 | Boundary & corner cases (FPS limits, invalid inputs, occlusion) | 25 |
Tier 3 | Cross-feature combinations (calibrate+draw, select+draw+heal) | 5 |
Tier 4 | Real-world scenarios (interactive painting, colour-by-number, zoom/pan) | 5 |
Tier 5 | Adversarial stress (handle leaks, memory leaks, CPU efficiency, thread cleanup) | 4 |
71 total |
๐ฆ Packaging & Distribution
Build a distributable package
# Build wheel and sdist
pip install build
python -m build
# The built files will be in dist/
# dist/kayamcp-0.1.0-py3-none-any.whl
# dist/kayamcp-0.1.0.tar.gzPublish to PyPI
pip install twine
twine upload dist/*๐ง Dependencies
Package | Version | Purpose |
| โฅ9.0.0 | High-performance screen capture |
| โฅ4.8.0 | Canvas detection via contour analysis |
| โฅ306 | Win32 API (desktop switching, window enumeration) |
| โฅ0.1.7 | Direct mouse/keyboard input |
| โฅ1.24.0 | Frame buffer operations |
| โฅ9.5.0 | Image format support |
๐ค Contributing
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Run the test suite (
uv run pytest -v)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgements
LibreSprite โ Free and open-source pixel art editor
MSS โ Ultra-fast cross-platform screen capture
Model Context Protocol โ Open protocol for AI tool integration
This server cannot be deployed
Maintenance
Related MCP Connectors
Agent-Native design tool - create and edit visual designs with agent assistance
Generate pixel art sprites, animations, 8-direction rotations and palettes for games.
AI game assets for agents: consistent sprites, 2D animations, tiles, maps, music and engine exports.
AI visual generation agent: multi-pipeline rendering, prompt crafting, and image composition.
Related MCP Servers
- AlicenseBqualityCmaintenanceEnables AI assistants to create and manipulate pixel art by providing tools for drawing, layer management, and animation frame control. It supports exporting projects to PNG, GIF, and sprite sheet formats via the Model Context Protocol.2217Apache 2.0
- AlicenseBqualityCmaintenanceEnables LLMs to create and edit pixel art reliably with support for layers, frames, symmetry, and various drawing tools.70MIT No Attribution
- AlicenseCqualityBmaintenanceEnables AI assistants to control Aseprite for drawing and editing images through its API.59577MIT
- AlicenseAqualityDmaintenanceEnables AI sprite generation and semantic tools for Aseprite, allowing LLMs to create pixel art, add animations, and manage projects with visual feedback.61GPL 3.0