
一个混合型AI控制的游戏模组,通过模型上下文协议(MCP)连接《星露谷物语》与AI助手。
概览
一款混合型AI控制游戏模组,通过模型上下文协议(MCP)连接星露谷物语与AI助手。使自主AI代理能够通过实时游戏状态同步控制并游玩星露谷物语。 - 星露谷物语(游戏)- SMAPI(星露谷物语模组API)v4.0.0+ - .NET 6.0 SDK - Go 1.23+ - GitHub Copilot 访问权限(通过 Copilot SDK 支持 Claude Sonnet) 这会编译StardewMCP.dll并放入 bin/Debug/net6.0/。 这会产生 stardew-mcp 可执行文件。 1. 构建模组(见上文) 2.将整个mod/StardewMCP/bin/Debug/net6.0/文件夹复制到你的Stardew Valley mods目录中:- : %AppData%\StardewValley\Mods\StardewMCP\ - : ~/.config/StardewValley/Mods/StardewMCP/ - : ~/.config/StardewValley/Mods/StardewMCP/ 3.将manifest.json复制到同一个文件夹 通过SMAPI启动游戏。模组会自动启动 ws://localhost:8765/game 的WebSocket服务器。 这个模组一旦你加载到游戏存档就会激活。
概述(AI 翻译)
一款混合型AI控制游戏模组,通过模型上下文协议(MCP)连接星露谷物语与AI助手。使自主AI代理能够通过实时游戏状态同步控制并游玩星露谷物语。
建筑
先修条件
对于SMAPI模组
- 星露谷物语(游戏)
- SMAPI(Stardew Modding API)v4.0.0+
- .NET 6.0 SDK
对于MCP服务器
- Go 1.23+
- GitHub Copilot 访问(通过 Copilot SDK 支持 Claude Sonnet)
建筑
1.构建C#模组
这会编译 StardewMCP.dll 并置于 bin/Debug/net6.0/。
2.构建 Go MCP 服务器
这会生成 stardew-mcp 可执行文件。
安装
安装SMAPI模组
- 构建模组(见上文)
- 将整个
mod/StardewMCP/bin/Debug/net6.0/文件夹复制到你的《星露谷物语》mods目录:
- Windows:
%AppData%\StardewValley\Mods\StardewMCP\ - macOS:
~/.config/StardewValley/Mods/StardewMCP/ - Linux:
~/.config/StardewValley/Mods/StardewMCP/
- 将
manifest.json复制到同一文件夹
或者使用SMAPI的mod文件夹结构:
用途
1.用SMAPI开始玩《星露谷物语》
通过SMAPI启动游戏。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Stardew Valley MCP Bridge
A hybrid AI-controlled game mod that bridges Stardew Valley with AI assistants via the Model Context Protocol (MCP). Enables autonomous AI agents to control and play Stardew Valley through real-time game state synchronization.
Architecture
┌─────────────────────────────────────────────────────────┐
│ STARDEW VALLEY (Game) │
│ SMAPI Mod (C# .NET 6) │
│ ModEntry → GameStateSerializer │
│ → CommandExecutor (w/ Pathfinder) │
│ → WebSocketServer │
└─────────────────────────────────────────────────────────┘
↕ ws://localhost:8765/game
┌─────────────────────────────────────────────────────────┐
│ MCP Server (Go) │
│ GameClient: WebSocket connection, state tracking │
│ StardewAgent: 12 tools + 30 cheats, autonomous loop │
└─────────────────────────────────────────────────────────┘
↕ Copilot SDK
┌─────────────────────────────────────────────────────────┐
│ Claude Sonnet (via GitHub Copilot SDK) │
└─────────────────────────────────────────────────────────┘
Prerequisites
For the SMAPI Mod
- Stardew Valley (game)
- SMAPI (Stardew Modding API) v4.0.0+
- .NET 6.0 SDK
For the MCP Server
- Go 1.23+
- GitHub Copilot access (for Claude Sonnet via Copilot SDK)
Building
1. Build the C# Mod
cd mod/StardewMCP
dotnet build
This compiles StardewMCP.dll and places it in bin/Debug/net6.0/.
2. Build the Go MCP Server
cd mcp-server
go build -o stardew-mcp
This produces the stardew-mcp executable.
Installation
Install the SMAPI Mod
- Build the mod (see above)
- Copy the entire
mod/StardewMCP/bin/Debug/net6.0/folder to your Stardew Valley mods directory:- Windows:
%AppData%\StardewValley\Mods\StardewMCP\ - macOS:
~/.config/StardewValley/Mods/StardewMCP/ - Linux:
~/.config/StardewValley/Mods/StardewMCP/
- Windows:
- Copy
manifest.jsonto the same folder
Or use SMAPI’s mod folder structure:
Mods/
└── StardewMCP/
├── manifest.json
├── StardewMCP.dll
└── (other build outputs)
Usage
1. Start Stardew Valley with SMAPI
Launch the game through SMAPI. The mod will automatically start a WebSocket server on ws://localhost:8765/game.
2. Load a Save File
The mod activates once you load into a game save.
3. Run the MCP Server
cd mcp-server
./stardew-mcp # Run with default autonomous mode
./stardew-mcp -auto=false # Connect without starting AI agent
./stardew-mcp -goal "Clear the farm and plant parsnips"
./stardew-mcp -url ws://localhost:8765/game # Custom WebSocket URL
The server connects to the game via WebSocket and begins the autonomous AI agent loop.
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →