uMCP is a server implementation of the MCP protocol, designed for working with the AI in Unity.
It is a minimalistic and efficient server that can be used to connect AI agents to Unity applications.
- Safety: uMCP does not allow the AI to execute arbitrary code, and any and all operations can only be performed through pre-authorized operations.
- Extensible: uMCP is designed to be easily extensible, allowing you to add your own custom commands and operations via
McpServerToolType
andMcpServerTool
attribute.- You can find examples in the
Assets/NatsunekoLaboratory/ModelContextProtocol/ManagementTools
directory.
- You can find examples in the
uMCP could directly communicate with the MCP client using the Streamable HTTP protocol, without any other dependencies. This allows for a more efficient and lightweight implementation compared to other MCP servers that rely on that requires additional dependencies such as Python, Node.js or other language runtimes.
Your MCP Client <-- Streamable HTTP --> uMCP Server
- Unity Editor: Version 2022.3 LTS or newer.
- The MCP client must support Streamable HTTP (e.g., VSCode Agent Mode, Cursor, CLINE, etc.).
openupm add com.natsuneko.modelcontextprotocol.core-framework
- Open your Unity project.
- Open your Unity project.
- Go to
Window > Package Manager
. - Click
+
toAdd package from git URL...
. - Enter the URL:
https://github.com/mika-f/uMCP.git?path=/Assets/NatsunekoLaboratory/ModelContextProtocol/CoreFramework
- Click
Add
. - The MCP server automatically starts when you run the Unity project.
openupm add com.natsuneko.modelcontextprotocol.management-tools
openupm add com.natsuneko.modelcontextprotocol.vrchat-world-tools
- Open your Unity project.
- Go to
Window > Package Manager
. - Click
+
toAdd package from git URL...
. - Enter the URL:
https://github.com/mika-f/uMCP.git?path=/Assets/NatsunekoLaboratory/ModelContextProtocol/MagagementTools
- Click
Add
.
Connect your MCP client that support Streamable HTTP (VSCode Agent Mode, Cursor, CLINE, etc.) to the MCP server.
http://localhost:7225/sse
# or
http://localhost:7225/mcp
Example for VSCode Agent Mode:
{
"servers": {
"uMCP": {
"url": "http://localhost:7225/mcp"
}
}
}
- Open your Unity project.
- Start your MCP client (VSCode Agent Mode, Cursor, CLINE, etc.).
- Interact! Your MCP client should now be able to communicate with the Unity application.
You can extend uMCP by creating your own custom commands and operations.
using System;
using System.ComponentModel;
using NatsunekoLaboratory.ModelContextProtocol.CoreFramework.Attributes;
using NatsunekoLaboratory.ModelContextProtocol.CoreFramework.Models;
using NatsunekoLaboratory.ModelContextProtocol.CoreFramework.Protocol.Abstractions;
using NatsunekoLaboratory.ModelContextProtocol.CoreFramework.Protocol.Interfaces;
namespace NatsunekoLaboratory.Examples.MyCustomCommands
{
[McpServerToolType]
public class MyCustomCommand
{
[McpServerTool]
[Description("This is a custom command that does something.")]
public static IToolResult Execute([Description("An example parameter for the custom command.")] string exampleParameter)
{
// Your custom command logic here
return new TextResult($"Executed custom command with parameter: {exampleParameter}");
}
}
}
MIT by @6jz