Control Unity via HTTP API from any AI CLI tool - Claude Code, Gemini CLI, Codex CLI, and more.
Anthropic's official CLI tool. Powerful code generation.
Google's latest AI model from command line.
OpenAI's code-specialized model.
Any CLI tool that can make HTTP requests works with this API.
Pass the system prompt template below to your CLI tool.
The AI understands your instructions and generates appropriate HTTP API requests.
Generated commands execute in Unity Editor and return results.
Use this template as your CLI's system prompt. The AI will understand how to use the HTTP API.
# Unity Control via Synaptic AI Pro HTTP API
You have access to Unity Editor through the Synaptic AI Pro HTTP API running at http://localhost:8080
## Prerequisites - Start the Server First!
Before using any HTTP API commands, you MUST start the MCP server:
```bash
cd <Unity Project>/Assets/Synaptic\ AI\ Pro/MCPServer && node index.js
```
The server will output "HTTP server listening on port 8080" when ready.
Keep this terminal running while using the API.
## Available Endpoints
### Check Connection
```bash
curl http://localhost:8080/health
```
### List Available Tools
```bash
curl http://localhost:8080/tools
```
### Execute Tool
```bash
curl -X POST http://localhost:8080/tool/{tool_name} \
-H 'Content-Type: application/json' \
-d '{"param1": "value1", "param2": "value2"}'
```
## Example Commands
Create a GameObject:
```bash
curl -X POST http://localhost:8080/tool/unity_create_gameobject \
-H 'Content-Type: application/json' \
-d '{"name": "MyCube", "type": "cube"}'
```
Create a C# Script:
```bash
curl -X POST http://localhost:8080/tool/unity_create_script \
-H 'Content-Type: application/json' \
-d '{"scriptName": "PlayerController", "code": "using UnityEngine;\n\npublic class PlayerController : MonoBehaviour\n{\n void Start() { }\n void Update() { }\n}"}'
```
## Workflow
1. First call /tools to see available tools and their parameters
2. Use the appropriate tool endpoint to execute commands
3. Check the response for success/error status
Always verify Unity is running and HTTP Server is enabled in Synaptic AI Pro settings before executing commands.Save prompt to file and load:
claude --system-prompt "$(cat unity-prompt.txt)"