使用说明
🚀 Roblox MCP服务器-生产部署
一个完整的、生产就绪的服务器,为Roblox Studio集成提供HTTP端点和MCP工具功能。
✨ 特性
🎯 完整的MCP功能
- ✅ HTTP API终结点:适用于Roblox Studio插件的完整REST API
- ✅ MCP工具通过HTTP:所有可通过HTTP访问的MCP协议
- ✅ Web管理界面:漂亮的管理仪表板
- ✅ 公共部署就绪:已为云平台配置
🌐 可用端点
核心HTTP端点
GET /health-服务器运行状况和状态POST /receiveScript-从Roblox插件接收脚本GET /scripts-列出所有存储的脚本GET /scripts/:id-按ID获取特定脚本
MCP工具通过HTTP
POST /mcp/generateRobloxScript-生成新的Roblox Lua脚本POST /mcp/pushToRobloxStudio-将脚本发送到Roblox StudioPOST /mcp/updateRobloxScript-更新现有脚本GET /mcp/listScripts-通过MCP协议列出脚本GET /mcp-tools-获取MCP工具信息
🚀 快速开始
1. 再进行
npm install
2. 启动服务器
npm start
# or
node server.js
3. 访问服务器
- web界面: http://localhost:3000
- API基地: http://localhost:3000
🌐 云部署
Heroku (推荐)
# Install Heroku CLI first
heroku create your-app-name
git init && git add . && git commit -m "Initial commit"
git push heroku main
维塞尔
npm install -g vercel
vercel --prod
铁路
npm install -g @railway/cli
railway login
railway deploy
渲染
- 连接GitHub存储库
- 构建命令:
npm install - 启动命令:
node server.js
数字海洋/AWS/GCP
git clone <your-repo>
cd roblox-mcp-server
npm install
PORT=80 node server.js
🎮 Roblox工作室集成
更新您的Roblox插件配置:
-- In your Roblox Studio plugin
local SERVER_ENDPOINT = "https://your-deployed-domain.com/receiveScript"
local API_BASE = "https://your-deployed-domain.com"
local MCP_BASE = "https://your-deployed-domain.com/mcp"
local httpService = game:GetService("HttpService")
-- Send script to server
local function sendScriptToServer(scriptName, code)
local response = httpService:PostAsync(SERVER_ENDPOINT,
httpService:JSONEncode({
scriptName = scriptName,
code = code,
timestamp = os.time()
}),
Enum.HttpContentType.ApplicationJson
)
if response.Success then
local result = httpService:JSONDecode(response.Body)
print("Script sent successfully! ID:", result.script.id)
return true
else
print("Failed to send script: " .. response.StatusCode)
return false
end
end
📋 API使用示例
健康检查
curl https://your-domain.com/health
发送脚本
curl -X POST https://your-domain.com/receiveScript \
-H "Content-Type: application/json" \
-d '{
"scriptName": "MyScript",
"code": "print(\"Hello World!\")",
"timestamp": "2025-11-02T17:12:18Z"
}'
通过MCP生成脚本
curl -X POST https://your-domain.com/mcp/generateRobloxScript \
-H "Content-Type: application/json" \
-d '{
"feature": "Player movement controller",
"style": "OOP",
"requirements": ["smooth movement", "collision detection"]
}'
列出脚本
curl https://your-domain.com/scripts
🛠️ 发展
地方发展
npm run dev
环境变量
PORT-服务器端口(默认值:3000)NODE_ENV-环境模式
项目结构
roblox-mcp-server/
├── server.js # Main server application
├── package.json # Dependencies and scripts
├── README.md # This file
├── public/
│ └── index.html # Admin web interface
└── node_modules/ # Dependencies
📊 特性
演出
- ⚡ 内存中的脚本存储,可快速访问
- 🔄 基于UUID的脚本识别
- 🚀 并发请求处理
- 📏 10MB请求大小限制
安全
- 🔐 为Roblox集成启用CORS
- ✅ 输入验证和净化
- 📝 请求日志记录和监控
- 🛡️ 全面的错误处理
监控
- 💓 健康检查端点
- 📊 实时脚本跟踪
- 📈 性能指标
- 🔍 错误记录
🆘 故障排除
常见问题
端口已在使用中
# Find process
lsof -i :3000
# Kill process
kill -9 <PID>
缺少依赖关系
npm install
权限问题
sudo chown -R $USER:$USER ./
📞 测试
部署后,测试这些端点:
- 健康:
https://your-domain.com/health - 脚本:
https://your-domain.com/scripts - MCP工具:
https://your-domain.com/mcp-tools - 管理员:
https://your-domain.com/
🎯 后续步骤
- 部署到云平台
- 测试所有端点
- 更新Roblox插件配置
- 开始使用Roblox Studio
📄 许可证
MIT许可证-有关详细信息,请参阅许可证文件
🆘 支持
对于问题或疑问:
- 检查上面的故障排除部分
- 查看服务器日志以了解错误详细信息
- 使用curl命令测试端点
- 验证Roblox插件配置
✅ 准备生产!
此服务器已准备就绪,可以立即部署到任何云平台。它提供了Roblox MCP集成所需的所有功能,同时易于部署和维护。
