mcpField
U
uMCP

uMCP

本地服务
github.com/mika-f开发工具739 周前更新

关于 uMCP

uMCP 是面向 Unity 的 MCP 服务,可让 AI Agent 与 Unity 应用通信。它通过 Streamable HTTP 直接连接客户端,并将操作限制在预授权命令内。

主要功能

  1. 01通过 Streamable HTTP 通信
  2. 02仅执行预授权操作
  3. 03支持添加自定义命令
  4. 04提供 Unity 管理工具示例

适用场景

  1. 01从 MCP 客户端与 Unity 项目交互
  2. 02为 Unity 添加自定义操作
  3. 03通过预授权命令执行管理任务

MCP 相关

uMCP 将 Unity 应用中的操作通过 MCP 工具暴露给客户端,并使用 Streamable HTTP 连接。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

暂未收录安装方式

我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。

代码仓库

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

uMCP

uMCP 是 MCP 协议的服务端实现,旨在用于在 Unity 中与 AI 协作。
这是一个简约高效的服务,可用于将 AI Agent 连接到 Unity 应用程序。

功能

  • 安全性:uMCP 不允许 AI 执行任意代码,所有操作都只能通过预先授权的操作执行。
  • 可扩展性:uMCP 旨在便于扩展,你可以通过 McpServerToolType 和 McpServerTool 特性添加自定义命令和操作。
    • 你可以在 Assets/NatsunekoLaboratory/ModelContextProtocol/ManagementTools 目录中找到示例。

工作原理(与其他 MCP 实现有何不同)

uMCP 可以直接使用 Streamable HTTP 协议与 MCP 客户端通信,无需任何其他依赖。 与依赖 Python、Node.js 或其他语言运行时等额外依赖的其他 MCP 服务相比,这种实现更加高效轻量。

Your MCP Client <-- Streamable HTTP --> uMCP Server

安装

前置条件
  • Unity Editor:2022.3 LTS 或更高版本。
  • MCP 客户端必须支持 Streamable HTTP(例如 VSCode Agent Mode、Cursor、CLINE 等)。
1. 安装 CoreFramework
使用 Unity Package Manager
  1. openupm add com.natsuneko.modelcontextprotocol.core-framework
  2. 打开你的 Unity 项目。
使用 Git URL
  1. 打开你的 Unity 项目。
  2. 前往 Window > Package Manager。
  3. 点击 +,选择 Add package from git URL...。
  4. 输入 URL:
    https://github.com/mika-f/uMCP.git?path=/Assets/NatsunekoLaboratory/ModelContextProtocol/CoreFramework
    
  5. 点击 Add。
  6. 运行 Unity 项目时,MCP 服务会自动启动。
2. 安装 Management Tools(及其他软件包)
使用 Unity Package Manager
  • openupm add com.natsuneko.modelcontextprotocol.management-tools
  • openupm add com.natsuneko.modelcontextprotocol.vrchat-world-tools
使用 Git URL
  1. 打开你的 Unity 项目。
  2. 前往 Window > Package Manager。
  3. 点击 +,选择 Add package from git URL...。
  4. 输入 URL:
    https://github.com/mika-f/uMCP.git?path=/Assets/NatsunekoLaboratory/ModelContextProtocol/MagagementTools
    
  5. 点击 Add。
3. 配置 MCP 客户端

将支持 Streamable HTTP 的 MCP 客户端(VSCode Agent Mode、Cursor、CLINE 等)连接到 MCP 服务。

http://localhost:7225/sse
# or
http://localhost:7225/mcp

VSCode Agent Mode 配置示例:

{
  "servers": {
    "uMCP": {
      "url": "http://localhost:7225/mcp"
    }
  }
}

使用方法

  1. 打开你的 Unity 项目。
  2. 启动 MCP 客户端(VSCode Agent Mode、Cursor、CLINE 等)。
  3. 开始交互!现在,你的 MCP 客户端应该可以与 Unity 应用程序通信了。

扩展

你可以通过创建自定义命令和操作来扩展 uMCP。

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,由 @6jz 提供

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。