Solar2D MCP Server
Enables the AI to run, debug, and interact with Lua-based Solar2D projects by capturing print() output, injecting debug modules, and monitoring real-time console logs.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Solar2D MCP Server
A Model Context Protocol (MCP) server for working with Solar2D (Corona SDK) projects. This server enables AI assistants to run, debug, and interact with Solar2D games.
Works with any MCP-compatible client, including:
Claude Code CLI
Other AI assistants that support MCP
Custom integrations
Setup
Install dependencies:
pip install -e .Optional extras for the experimental integrations:
pip install -e ".[trello,social]"encode_recording_videoalso needs ffmpeg on the host (brew install ffmpeg).The SolarScope test tools need the SolarScope runtime added to your game (see SolarScope Tests).
Test the server:
python server.py
Related MCP server: LÖVE2D MCP Server
Configuration
Claude Desktop
Add this configuration to your Claude Desktop config file:
MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"solar2d": {
"command": "/path/to/solar2d-mcp/.venv/bin/python",
"args": [
"/path/to/solar2d-mcp/server.py"
]
}
}
}After adding the configuration, restart Claude Desktop.
Claude Code CLI
Add the server using the claude mcp add command:
claude mcp add --scope user --transport stdio solar2d \
/path/to/solar2d-mcp/.venv/bin/python \
/path/to/solar2d-mcp/server.pyVerify the server is connected:
claude mcp listYou can also add it to a specific project using --scope project or create a .mcp.json file in your project root.
First-Time Setup
On first use, the server needs to know where your Solar2D Simulator is installed.
Auto-detection: The server automatically scans common installation paths
Confirmation: You'll be prompted to confirm or provide the simulator location
Remembered: Your choice is saved to
~/.config/solar2d-mcp/config.json
Example first-run flow:
User: Run my Solar2D project
Assistant: Solar2D simulator needs to be configured. Detected:
- /Applications/Corona-3726/Corona Simulator.app/Contents/MacOS/Corona Simulator
Use configure_solar2d with confirm=true to use this path.
User: Yes, use that one
Assistant: [calls configure_solar2d(confirm=true)]
✓ Solar2D simulator confirmed and saved!Features
Tools
configure_solar2d- Configure the Solar2D simulator pathAuto-detects installed simulators
Persists configuration across sessions
Use
confirm=trueto accept detected pathOr provide custom path with
simulator_path="..."
run_solar2d_project- Run a Solar2D project in the simulatorAccepts project directory or main.lua path
Optional debug and console flags
Launches simulator in background
Injects logger that captures all print() output
read_solar2d_logs- Read console logs from running Solar2D SimulatorView all Lua print() statements from your game code
Configurable number of recent lines to display
Helps debug your Lua code in real-time
Automatic setup: Logger is auto-injected into main.lua on first run
Note: Only captures Lua print() output, not Solar2D system messages
list_running_projects- List all tracked Solar2D Simulator instancesShows PID, status, and log file location
Useful for managing multiple running projects
start_screenshot_recording- Start capturing screenshots from the simulatorCaptures at 10 fps (100ms interval)
Default recording duration: 60 seconds (max: 300 seconds / 5 minutes)
The 300s ceiling is enforced in the Lua capture loop too, so a recording stops on its own even if
stop_screenshot_recordingis never calledCan extend recording while already capturing
stop_screenshot_recording- Stop screenshot recording earlyget_simulator_screenshot- Get screenshot(s) for visual analysiswhich="latest"- Capture fresh screenshot now (default)which="last"- Get most recent from recording sessionwhich="all"- List all recorded screenshotswhich="5"- Get specific recorded screenshot by number
list_screenshots- List all available screenshots with file sizesencode_recording_video- Stitch a recording session's frames into an MP4Optional
fps,width,start_frame/end_frame, andfilenameWritten to a
video/subfolder of the screenshot directoryMP4 plays inline in the Claude app (a GIF does not) and is smaller
Requires ffmpeg
simulate_tap- Tap/click on the simulator screenUses percentage-based bounding box (left, right, top, bottom)
Taps the center of the specified area
Example: button at 30-50% horizontal, 60-70% vertical
simulate_drag- Drag/swipe between two points on the simulator screenPercentage-based start and end bounding boxes
Configurable drag duration
Useful for swipes, card plays, and sliders
find_object- Locate touchable display objects on screenReports positions so taps/drags can be targeted precisely
get_display_info- Get display coordinate system info
Game State & Scenarios
get_game_state- Get structured game state as JSONReturns current scene, combat state, player stats, and UI state
Much faster and more reliable than parsing screenshots
run_scenario- Configure and launch a test scenario without restartingLoad a saved scenario from
scenarios/or pass settings inlineOptionally seed
math.randomfor deterministic replaySupports scripted scenarios with a
stepsarray that runs a pass/fail test (actions:wait_for,verify,wait,tap,drag,play_card,tap_stat,tap_choice)
list_scenarios- List saved scenario files from the project'sscenarios/folder
SolarScope Tests
Drive SolarScope, an in-game test framework for Solar2D ("Playwright for Solar2D"). Tests are plain Lua that run inside the simulator. They drive the real UI through hit-tested input and assert on structured game state.
Optional dependency. SolarScope is only needed for the three tools below. The rest of the server works without it. These tools don't install SolarScope. They write a command to
<project>/.solar_scope/command.jsonand read the result the framework writes to the simulator sandbox, so the game must already include the SolarScope runtime. To add it, copysolar_scope.luaand thesolar_scope/folder from the SolarScope repo into your project. See its README for details.Results are read from
~/Library/Application Support/Corona Simulator/<project>-*/Documents/solar_scope/, so these tools currently work on macOS only.
run_solar_scope_test- Launch the project running a specific test module (e.g.tests.regression.match_clears) without editing the game's configReplaces any running instance
Returns a command sequence number for
get_solar_scope_result
rerun_solar_scope_test- Hot-reload a test into an already-running simulatorMuch faster than relaunching when iterating on a test
get_solar_scope_result- Read the structured result of the latest run (status, message, errors, artifacts, probe report)Pass
wait_seqto poll until that run's result appears (timeout_ms, default 8000)
Resources
solar2d://info- Server information
Experimental / WIP
These integrations are in progress and their tool surface may change:
Trello - Manage a project board from the assistant:
configure_trello,setup_trello_board,create_trello_card,list_trello_cards,get_trello_card,update_trello_card,comment_trello_card,attach_to_trello_cardSocial media - Draft and publish posts:
configure_social_media,preview_social_post,publish_social_post
Possible Plans
More complex ability to "play", based on "watching"
Built-in Skills
Conventions & Good Practices
Common Patterns / Templates
Development
The server uses the Model Context Protocol (MCP) Python SDK.
Project Structure
solar2d-mcp/
├── server.py # MCP server entry point
├── config.py # Configuration management and auto-detection
├── utils.py # Shared utilities
├── tools/
│ ├── __init__.py # Tool dispatcher
│ ├── configure.py # configure_solar2d tool
│ ├── run_project.py # run_solar2d_project tool
│ ├── read_logs.py # read_solar2d_logs tool
│ ├── list_projects.py # list_running_projects tool
│ ├── screenshot.py # Screenshot recording + MP4 encode tools
│ ├── touch.py # Touch/drag simulation tools
│ ├── state.py # Game state & test scenario tools
│ ├── solar_scope.py # SolarScope test-runner tools
│ ├── social/ # Social media tools (experimental)
│ └── trello/ # Trello board tools (experimental)
├── resources/
│ ├── __init__.py # Resource dispatcher
│ └── info.py # solar2d://info resource
├── pyproject.toml # Project dependencies and metadata
└── README.md # This fileTesting
Once configured, you can test the server with prompts like:
"Configure Solar2D" (first-time setup)
"Run my Solar2D project at /path/to/my-game"
"Launch the Solar2D simulator with debug enabled for my project"
"Show me the logs from my running Solar2D project"
"Read the last 100 lines of Solar2D logs"
"List all running Solar2D projects"
"Record 20 seconds of gameplay and give me an MP4"
"Run the SolarScope test tests.regression.match_clears and report the result"
Capturing Lua print() Output
The MCP server automatically captures all your Lua print() statements!
Setup (One-time)
Run your project once through MCP:
The server creates a
_mcp_logger.luafile in your project directoryAutomatically injects
require("_mcp_logger")into yourmain.lua(if not already present)
The logger is inserted intelligently:
After
mobdebugif presentBefore other
requirestatements if no mobdebugAt the start of the file otherwise
Works with Manual Launches!
Once the logger is injected, it works forever - even when you launch Solar2D manually from your IDE or command line!
Log file location:
<tempdir>/corona_log_<project-name>.txt, where<tempdir>is Python'stempfile.gettempdir()($TMPDIR, usually under/var/folders/...on macOS)All Lua
print()output is captured automatically by_mcp_logger.luaYour prints still display normally in the console (Solar2D's output)
Log file is cleared on each launch -
_mcp_logger.luatruncates the file when Solar2D startsUse
read_solar2d_logstool to view logs anytime, regardless of how Solar2D was launchedThe MCP server only reads the log file -
_mcp_logger.luais responsible for all writing
Capturing Screenshots
The MCP server can capture screenshots from the running simulator for visual analysis!
How It Works
Auto-injected module: When you run a project,
_mcp_screenshot.luais created and injected intomain.luaControl file signaling: The MCP server writes to a control file to start/stop recording
Periodic capture: Screenshots are captured every 100ms (10 fps) while recording is active
JPEG compression: Images are saved as JPEG at content resolution for smaller file sizes
Screenshot Location
Screenshots are saved to: <tempdir>/solar2d_screenshots_<project-name>/ (same temp directory as the log file)
The directory is cleared when the simulator starts, but screenshots persist across recording sessions within the same run.
Recording Workflow
User: Start recording screenshots for 30 seconds
Assistant: [calls start_screenshot_recording with duration=30]
User: Show me what the game looks like now
Assistant: [calls get_simulator_screenshot with which="latest"]
[displays the screenshot for visual analysis]
User: Stop recording early
Assistant: [calls stop_screenshot_recording]Extending Recordings
You can call start_screenshot_recording while already recording to extend the duration. Screenshots continue from where they left off (not reset).
Touch Interaction
The MCP server can simulate taps on the running simulator, allowing the AI to interact with your game!
How It Works
Auto-injected module:
_mcp_touch.luais created and injected intomain.luaHit testing: The module finds touchable objects at the tap location
Event dispatch: Synthetic touch events are sent to the target object
Percentage-Based Coordinates
Taps use a bounding box with percentage coordinates (0-100):
left,right: Horizontal bounds (0=left edge, 100=right edge)top,bottom: Vertical bounds (0=top edge, 100=bottom edge)
The tool taps the center of the bounding box. This makes it easy for the AI to estimate positions visually from screenshots.
Example Workflow
User: Click on the play button
Assistant: [calls get_simulator_screenshot to see current state]
I can see a play button in the center of the screen.
[calls simulate_tap with left=40, right=60, top=45, bottom=55]
Tapped the play button!
User: Click on any popup buttons you see
Assistant: [calls get_simulator_screenshot]
I see a "Continue" button at the bottom of the screen.
[calls simulate_tap with left=30, right=70, top=80, bottom=90]
Tapped the Continue button.Resources
SolarScope - In-game Lua test framework driven by the SolarScope tools
License
MIT © 2025-2026 Under Byte Studios, LLC
This server cannot be deployed
Maintenance
Related MCP Connectors
AI game maker: build, run, screenshot and play-test Godot and retro console games in a live project
Launch and verify high-fidelity mobile simulations from an AI agent.
Cloud iPhone Simulators for AI agents: build the Xcode project, read the screen, tap by label, test.
Give your AI agent a real cloud Android phone: push APKs, drive it, get screenshots and logs.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to build, run, and debug Godot projects by editing scenes and scripts, inspecting live game state, injecting input, capturing viewports, and examining native debugger state through 42 tools.European Union Public 1.2
- AlicenseAqualityBmaintenanceEnables AI assistants to interact with running games in real time — introspecting game state, simulating keyboard and mouse input to actually play, capturing screenshots, executing Lua code, hot-reloading files, and receiving push notifications when state changes.8MIT
- AlicenseBqualityCmaintenanceEnables AI assistants to launch a game engine editor, run and debug projects, capture console output, and manage scenes, nodes, sprites, and UIDs.14171 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to operate directly inside a running Unity Editor project, creating scenes, generating scripts, simulating input, capturing screenshots, inspecting performance, and automating editor tasks through its built-in tools and resources.MIT