Preface

When extending agent capabilities in DSH, a common need is to encapsulate external tools, local services, or client operations into callable tools. dsh-mc-agent takes this step for Minecraft: it drives Mineflayer bots via the LAN protocol, supporting autonomous survival, mining and tree-cutting, in-game chat, and real-time maps. It also provides a built-in launcher that handles Microsoft login, version downloads, and Java game process launching.

This plugin is labeled UNOFFICIAL and has no official affiliation with Mojang Studios / Microsoft. It does not include or distribute Mojang game content; game files are downloaded from Mojang’s official endpoints.

What Is This

dsh-mc-agent is a DSH plugin maintained by hellosky983, licensed under MIT. It exposes game data and capabilities as mc_* tools for DSH agents to invoke via dialogue. By default, it can be used as a Minecraft tab within the DSH chat interface or switched to a full-screen launcher.

It primarily addresses three aspects:

  1. AI Agent: Connects directly to the game via the LAN protocol to drive a real Mineflayer bot, supporting autonomous survival, mining and tree-cutting, in-game chat, and real-time maps.

  2. Visual and Control: mc_screenshot captures the game window, mc_see uses DashScope Qwen-VL for visual understanding, and mc_control simulates keyboard and mouse input via xdotool. Together, agents can take next actions based on the on-screen state.

  3. Built-in Launcher: Uses the official version list to install client jar, libraries, assets, and starts the Java game process. Microsoft login uses the user’s own registered Azure application client id via the device code flow.

Core Features

Mineflayer Fast Mode

The mc_bot_* tools read real-time position, inventory, health, surrounding blocks, and perform precise control via the LAN protocol. This mode directly reads in-game data, suitable for scenarios requiring rapid state updates and precise operations.

Visual and Control Loop

mc_screenshot captures the game window, mc_see sends the screenshot to DashScope Qwen-VL for visual understanding, and mc_control simulates keyboard and mouse input using xdotool. Combined, agents can make decisions based on the visual state.

Launcher Capabilities

The built-in launcher uses the official version list to install client jar, libraries, and assets, and starts the Java game process. Microsoft login uses the user’s own registered Azure application client id via the device code flow.

Dialogue Tools

Beyond the launcher and bot control, the plugin provides the following capabilities:

  • mc_analyze_crash: AI crash analysis
  • mc_world_info / mc_mods / mc_version_advice: Game assistant
  • mc_set_goals / mc_goals / mc_complete_goal: Autonomous survival goal framework

These tools allow agents to query saves, mods, version suggestions, crash reports, and progress goals within dialogue.

Installation and Enablement

Environment Requirements: Node.js 18+, DSH 0.1.0-rc.6, Java required for launching games; different MC versions have specific Java version requirements, e.g., 1.21+ requires Java 21+.

Method A: Install into an Existing DSH Profile

First, clone the repository:

git clone https://github.com/hellosky983/dsh-mc-agent.git

Then edit the target profile’s package.json. Add dsh-mc-agent to dependencies and include the bundle name in dsh.profile.bundles:

{
  "dependencies": {
    "dsh-mc-agent": "link:/path/to/dsh-mc-agent"
  },
  "dsh": {
    "profile": {
      "bundles": ["dsh-mc-agent"]
    }
  }
}

If the profile already has other bundles, append to the existing bundles array instead of overwriting.

Navigate to the profile directory, install dependencies, and restart DSH:

cd <profile directory>
pnpm install

Method B: Create a Standalone Profile

Suitable for isolation from existing DSH instances.

Clone the repository:

git clone https://github.com/hellosky983/dsh-mc-agent.git

Create <project>/dsh-home/profiles/minecraft/package.json:

{
  "name": "dsh-profile-minecraft",
  "private": true,
  "dependencies": {
    "dsh-mc-agent": "link:../../../dsh-mc-agent"
  },
  "dsh": {
    "profile": {
      "bundles": [
        "@deepseek-ai/dsh-base",
        "@deepseek-ai/dsh-web-app",
        "dsh-mc-agent"
      ]
    }
  }
}

Install and start the standalone instance:

cd <project>/dsh-home/profiles/minecraft
pnpm install
DSH_HOME=<project>/dsh-home dsh --profile minecraft --port 39970

Open in browser:

http://127.0.0.1:39970

Typical Usage

Configuring Microsoft Login

  1. Create an App registration in the Azure portal, allowing public client flows.

  2. Copy the Application (client) ID.

  3. Enter the Microsoft client id in the launcher settings.

  4. Log in using the device code.

It is mandatory to use your own registered Azure application client id; do not use someone else’s registered client id.

Dialogue-Driven Gameplay

After completing login and launching, tools can be invoked within DSH dialogue. Common workflows include:

  1. Use mc_set_goals to set autonomous survival goals, then mc_goals to view goals, and mc_complete_goal to progress goals.

  2. Use mc_bot_* to read position, inventory, health, surrounding blocks, and perform precise control.

  3. Use mc_screenshot, mc_see, mc_control to form a visual and control loop.

  4. Use mc_analyze_crash to analyze crashes; use mc_world_info, mc_mods, mc_version_advice to query saves, mods, and version suggestions.

Uninstallation

Remove the dsh-mc-agent entry from the dependencies and dsh.profile.bundles in the profile’s package.json, then reinstall dependencies and restart DSH:

cd <profile directory>
pnpm install

To clean up plugin local data, you can delete ~/.dsh-mc/; the game directory ~/.minecraft/ remains unaffected and can be retained.

Use Cases and Considerations

Suitable for:

  • Integrating Minecraft’s launch, runtime status, saves, and crash information into a DSH agent
  • Enabling agents to read in-game data and perform mining, movement, placement, and other operations
  • Using visual models to understand game screens and perform keyboard/mouse control

Considerations:

  1. Unofficial: The plugin is labeled UNOFFICIAL and is not affiliated with Mojang Studios / Microsoft.

  2. Account Requirements: Offline mode is not provided; gameplay requires login with the user’s own Microsoft account. Microsoft login requires using your own registered Azure application client id.

  3. Permissions: The plugin reads and writes ~/.minecraft, writes to ~/.dsh-mc, and accesses network endpoints such as Mojang, Microsoft, and DashScope. mc_control executes xdotool to simulate keyboard and mouse, and mc_screenshot captures the Minecraft window.

  4. Runtime Permissions: The plugin runs with the current DSH process permissions. Before installation, check the source code, license, and dependencies.

  5. Data: No telemetry or third-party statistics; account tokens are saved in ~/.dsh-mc/account.json with permissions 600.

Conclusion

The value of dsh-mc-agent lies in bringing together Minecraft launching, Mineflayer bots, visual control, and dialogue tools into a single DSH plugin, enabling agents not only to chat about games but also to read game states and execute operations.

Repository: https://github.com/hellosky983/dsh-mc-agent