Skip to main content
Glama

MCP游戏

一款具有 Node.js 后端的多人控制面板游戏,具有带交互元素的虚拟房屋环境。

特征

  • 具有户外环境的沉浸式第一人称 3D 虚拟房屋

  • 精美的房子,内部和外部都有特色

  • 进出房屋的互动门

  • 有树木、植物和装饰元素的花园区

  • 具有图像生成功能的交互式电视

  • 用于访问MCP系统的计算机终端

  • 逼真的运动和碰撞检测

  • 实时服务器通信

设置

  1. 安装依赖项:

npm install
  1. 运行服务器:

npm start

或者对于具有自动重启功能的开发:

npm run dev

服务器将在端口 3002 上启动。

游戏控制

  • 移动:WASD键

  • 环顾四周:鼠标移动(单击游戏即可启用)

  • 互动:靠近互动物体时按 ENTER

  • 退出界面:ESC键

  • 退出鼠标锁:ESC键

互动元素

户外环境

  • 探索树木和花坛的地形

  • 沿着小路走到房子入口

  • 靠近门时按 ENTER 键进入/离开房屋

电视系统

  • 靠近电视并按下 ENTER 键来访问遥控器

  • 生成将在电视屏幕上显示的图像

  • 在终端界面输入图像生成的提示

MCP 终端

  • 找到电脑桌并按 ENTER 进入终端

  • 向 MCP 系统发送命令

  • 访问各种虚拟工具(电子邮件、网络搜索等)

技术细节

  • 使用 Three.js 构建,用于 3D 渲染

  • 带有指针锁定控制的第一人称视角

  • 带有程序化放置树木的户外环境

  • 用于后端通信的 Express.js 服务器

  • 用于图像生成的 Canvas 库

  • 用于服务器通信的 RESTful API

MCP游戏图像系统

本文档解释了 MCP 游戏中图像显示系统的工作原理。

概述

系统会在虚拟房屋的电视上显示来自server/openai-server/public/image目录的现有图像。系统现在不再生成新图像(这会导致 500 内部服务器错误),而是检查指定目录中是否存在现有图像。

工作原理

  1. 虚拟房屋中的电视显示存在于server/openai-server/public/image目录中的图像。

  2. 系统每 10 秒检查一次新图像。

  3. 当用户通过电视遥控界面请求新图像时,系统会从目录中随机选择一张图像。

添加新图像

要将新图像添加到电视:

  1. 将图像文件(jpg、jpeg、png、gif、webp)放在server/openai-server/public/image目录中。

  2. 系统会自动检测并显示它们。

  3. 文件应具有适合网络显示的合理大小(建议:800x450像素)。

用法

  1. 走近虚拟房屋中的电视。

  2. 按 Enter 键进入电视遥控器界面。

  3. 输入任何与显示图像相关的命令。

  4. 系统将从目录中可用的图像中选择并显示一张。

故障排除

  • 如果没有显示图像,请检查server/openai-server/public/image目录是否存在并包含图像文件。

  • 确保服务器在正确的端口上运行(默认值:3002)。

  • 检查浏览器控制台中是否有与图像加载相关的错误消息。

技术细节

  • 系统不再尝试直接生成图像,从而避免出现 500 内部服务器错误。

  • 请求时从目录中随机选择图像。

  • 当没有可用图像时,系统会提供适当的反馈。

连接到 MCP 后端服务器

MCPGame 可以连接到外部 MCP 后端服务器,以实现终端和电视交互的高级 AI 功能。

配置

  1. 打开main.js文件并找到顶部的配置部分:

// --- Configuration --- const MCP_BACKEND_URL = 'http://localhost:3001'; // MCP Terminal backend connection const IMAGE_SERVER_URL = 'http://localhost:3002'; // Image server connection
  1. 更新MCP_BACKEND_URL以指向您的 MCP 后端服务器:

    • 对于本地开发: http://localhost:PORT (将 PORT 替换为您的后端端口)

    • 对于生产:使用已部署后端服务器的完整 URL

所需的 API 端点

您的 MCP 后端服务器应实现以下端点:

  1. GET /api/status - 返回 MCP 系统的状态

  2. POST /api/query - 接受用户查询并返回 AI 响应

响应格式

查询端点应返回以下格式的 JSON:

{ "response": "Text to display in the terminal", "spokenResponse": "Optional text for voice synthesis" }

测试连接

  1. 启动 MCP 后端服务器

  2. 启动 MCPGame 服务器( node server.js

  3. 在浏览器中打开游戏

  4. 与虚拟房屋中的计算机终端进行交互

  5. 当您使用终端时,游戏将连接到您的 MCP 后端服务器

-
security - not tested
F
license - not found
-
quality - not tested

Related MCP Servers

  • A
    security
    A
    license
    A
    quality
    A command-line tool that enables the use of MCP with the Room protocol, allowing agents to create and interact in peer-to-peer virtual rooms for goal-oriented collaboration.
    Last updated -
    5
    12
    17
    Apache 2.0
    • Apple
  • -
    security
    F
    license
    -
    quality
    A simple MCP server that allows accessing and executing shell commands on a VM machine through a web-based terminal interface, with automatic tunneling to make the VM accessible from anywhere.
    Last updated -
    506
    4
  • -
    security
    A
    license
    -
    quality
    MCP server that provides computer control capabilities including mouse movements, keyboard actions, screenshot capture with OCR, and window management through a unified API.
    Last updated -
    68
    MIT License

View all related MCP servers

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AllAboutAI-YT/mcpgame'

If you have feedback or need assistance with the MCP directory API, please join our Discord server