Back to MCP directory
publicPublicdnsLocal runtime

roblox-studio-mcp-server-updated

Roblox Studio MCP服务器是一个专为Roblox Studio开发设计的TypeScript实现,提供资源、工具和提示,支持LLM应用程序通过标准化接口访问Roblox Studio文档、模板和代码生成功能。

article

README

🚀 Roblox 项目配置与使用指南

本指南旨在帮助您更好地开发和管理 Roblox 项目,详细介绍了项目的配置方法、使用步骤、代码示例等内容。

🚀 快速开始

配置文件结构

在项目的根目录下创建一个 config.json 文件,内容如下:

{
    "version": "1.0.0",
    "name": "my_roblox_project",
    "description": "一个基本的 Roblox 平台跳跃游戏项目。",
    "configuration": {
        "api_key": "your_roblox_api_key_here", // 必填,Roblox 开发者 API 密钥
        "server_url": "http://localhost:3000", // MCP 服务器地址
        "cache_enabled": true, // 是否启用缓存,默认为 true
        "logging": {
            "level": "info", // 日志级别:debug、info、warning、error
            "output_file": "logs/app.log" // 日志输出文件路径
        },
        "performance_tuning": {
            "max_connections": 100, // 最大并发连接数,默认为 100
            "request_timeout": 30 // 请求超时时间(秒),默认为 30
        }
    },
    "tools": [
        {
            "name": "mcp",
            "description": "Roblox Studio MCP 服务器接口调用工具",
            "parameters": {
                "$schema": "http://json-schema.org/draft-04/schema",
                "type": "object",
                "properties": {
                    "server_url": {
                        "type": "string",
                        "description": "MCP 服务器的 URL 地址"
                    },
                    "tool_name": {
                        "type": "string",
                        "description": "要调用的 MCP 工具名称"
                    },
                    "tool_parameters": {
                        "type": "object",
                        "description": "传递给 MCP 工具的具体参数"
                    }
                },
                "required": ["server_url", "tool_name"]
            }
        }
    ],
    "scripts": [
        {
            "name": "generate_roblox_code",
            "description": "生成 Roblox 游戏代码",
            "parameters": {
                "$schema": "http://json-schema.org/draft-04/schema",
                "type": "object",
                "properties": {
                    "script_type": {
                        "type": "string",
                        "enum": ["ClientScript", "ServerScript"],
                        "description": "脚本类型,可选值为 ClientScript 或 ServerScript"
                    },
                    "functionality": {
                        "type": "string",
                        "description": "脚本的功能描述"
                    },
                    "include_comments": {
                        "type": "boolean",
                        "description": "是否包含注释,默认为 false"
                    }
                }
            }
        }
    ],
    "templates": [
        {
            "name": "roblox_platformer_template",
            "description": "基本平台跳跃游戏模板",
            "source": "template://roblox/game/platformer" // 模板来源 URL
        }
    ]
}

启动服务器

运行以下命令启动 Roblox 项目服务器:

rbxserver.exe --project="path/to/your/project" --server-port=8080

✨ 主要特性

  • 提供详细的项目配置指南,帮助您快速搭建 Roblox 项目。
  • 支持使用 MCP 工具调用服务器接口,实现代码生成和模板应用。
  • 提供日志记录和性能调优配置,方便您监控和优化项目。

📦 安装指南

本项目无需额外安装,只需按照上述快速开始部分的步骤进行配置和启动即可。

💻 使用示例

基础用法

调用生成代码工具

使用以下命令通过 MCP 工具生成 Roblox 游戏代码:

mcp-cli call generate_roblox_code \
--parameters '{"script_type": "ServerScript", "functionality": "Player join event handler", "include_comments": true}'

调用模板工具

使用以下命令通过 MCP 工具应用游戏模板:

mcp-cli call apply_template \
--parameters '{"template_name": "roblox_platformer_template"}'

高级用法

暂无高级用法示例,后续可根据实际需求进行扩展。

📚 详细文档

项目脚本

-- 游戏初始化脚本示例
local Players = game:GetService("Players")
local player = Players.LocalPlayer or Players.PlayerAdded:WaitForPlayer()
player.CharacterAdded:Connect(function(char)
    -- 玩家角色加载时的事件处理逻辑
    print("Character added:", char.Name)
end)

-- 绑定退出游戏按键(默认为 ESC)
game:BindKey(Enum.KeyCode.Escape, function()
    print("Game exited by player")
    game.Players.LocalPlayer:Kick() -- 强制退出游戏
end)

Roblox 客户端启动脚本

#!/bin/bash
# 自动化启动 Roblox 客户端的示例脚本
echo "Starting Roblox client..."
roblox-player.exe --project="path/to/your/client"

🔧 技术细节

配置文件参数说明

| 属性 | 详情 | |------|------| | version | 项目版本号 | | name | 项目的唯一标识符 | | description | 项目描述 | | configuration.api_key | 必填,Roblox 开发者 API 密钥 | | configuration.server_url | MCP 服务器地址 | | configuration.cache_enabled | 是否启用缓存,默认为 true | | configuration.logging.level | 日志级别:debug、info、warning、error | | configuration.logging.output_file | 日志输出文件路径 | | configuration.performance_tuning.max_connections | 最大并发连接数,默认为 100 | | configuration.performance_tuning.request_timeout | 请求超时时间(秒),默认为 30 | | tools.name | 工具名称 | | tools.description | 工具描述 | | tools.parameters | 工具参数配置 | | scripts.name | 脚本名称 | | scripts.description | 脚本描述 | | scripts.parameters | 脚本参数配置 | | templates.name | 模板名称 | | templates.description | 模板描述 | | templates.source | 模板来源 URL |

故障排除

常见问题

  • Q1: 如何处理服务器连接超时?

    • A1: 检查 config.json 中的 request_timeout 设置,建议增加超时时间或优化网络配置。
  • Q2: 日志文件路径无法写入怎么办?

    • A2: 确保项目目录具有写入权限,并检查 logging.output_file 路径是否正确。

📄 许可证

文档中未提及许可证相关信息。

附录

  • 日志文件: logs/app.log
  • 配置文件: config.json
  • 服务器进程: rbxserver.exe

如果有任何问题或需要进一步的帮助,请随时联系技术支持团队。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client