submarine-attack-mcp-apps

submarine-attack-mcp-apps

MCP server for playing a submarine (Battleship-style) game against an AI, with game rules enforced server-side to prevent cheating.

Category
访问服务器

README

Submarine attack for MCP Apps

English / Japanese

Migrating from https://github.com/mfukushim/reversi-mcp-ui.

This is a submarine game by MCP Apps.

The game rules are similar to the grid attack in Nintendo's Wi-Fi Clubhouse Games (though 3x1 attacks are not yet included).

Game Rules
mcp/rule-logic/gameRule.ts

<img width="300" alt="image" src="./web_media/img.png" />
<img width="400" alt="image" src="./web_media/img_1.png" />
<img width="300" alt="image" src="./web_media/img_2.png" />

The rules and board control of the submarine game are handled by MCP. The user plays as player 1 and the AI plays as player 2.

Available MCP clients

Currently, operation has been confirmed with Claude Desktop for Windows.
Because it complies with the MCP Apps specifications, it is likely to work with MCP Apps-compatible clients.
Operation has also been confirmed with the following MCP clients:

  • Avatar-Shell https://github.com/mfukushim/avatar-shell

Note: This MCP server outputs HTML data using the ui:// schema, one screen at a time, one move at a time. Depending on the MCP client's design, token consumption may be large.
When you first start using it, please check for unexpected token consumption.

Get started

Public Server

Submarine MCP Apps is built on the MCPAgent mechanism of CloudFlare AI Agent and supports Streamable-http connections.

A demo using Cloudflare workers is available below.

Please configure the following MCP settings on each MCP client.

  • Claude Desktop(oauth required MCP client)
{
  "mcpServers": {
    "submarine": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://submarine-attack-mcp-apps.daisycodes.workers.dev/mcp"
      ]
    }
  }
}
  • MCP clients that do not require OAuth (Goose, Avatar-Shell, etc.)
{
  "mcpServers": {
    "submarine": {
      "type": "streamable-http",
      "url": "https://submarine-attack-mcp-apps.daisycodes.workers.dev/mcp"
    }
  }
}

(The public server may be shut down in the future.)

Local Server

You can run it as a local server by running wrangler locally.

pnpm run dev # run wrangler local

or 

npm run dev # run wrangler local

Please configure the following MCP settings on each MCP client.

  • Claude Desktop(oauth required MCP client)
{
  "mcpServers": {
    "submarine": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "http://localhost:8787/mcp"
      ]
    }
  }
}
  • MCP clients that do not require OAuth (Goose, Avatar-Shell, etc.)
{
  "mcpServers": {
    "submarine": {
      "type": "streamable-http",
      "url": "http://localhost:8787/mcp"
    }
  }
}
  1. First, load the MCP resource GameRule to have the AI load the game rules.
    <img width="300" alt="image" src="./web_media/img_3.png" />
    Depending on the MCP client, the resource loading message may not appear. The AI ​​can play with general knowledge even without loading GameRule, but game progress may be unstable.
  2. Then, enter a prompt such as "Play Submarine" to start the game. The game will begin.
  3. First, arrange your pieces on the board. You can also arrange them automatically using the Random Arrange button. Once arrangement is complete, press the "Done" button.
  4. Depending on the MCP client, you may need to click a piece and press Enter to send a prompt in order for the game to proceed. When a prompt such as "press enter" appears, check the entered prompt and send it.
  5. Once you have finished placing your pieces, the AI will begin placing its pieces. Depending on the performance of the LLM, placement may not be successful in one try, so if the board state is still in player 2 placement mode, urge the AI to place by saying something like "Please place using player2-placement."
  6. Once placement is complete, you and the AI will take turns clicking on the opponent's board to attack. You may need to press Enter after clicking as the game progresses.

Tool Functions

tool functions

  • new-game
    Displays the initial game screen. If the game is in progress, it will force the initial screen.
  • get-board
    The AI retrieves the game board. It is not displayed to the user. The retrieved board is only the AI's side of the board.
    By specifying a token unknown to the AI, information about the user's side of the board can be obtained and used to update the HTML screen.
  • show-board
    The AI retrieves the game board and displays it to the user. The AI sees the AI's side of the board, and the user sees the user's side of the board.
  • player1-placement
    Player 1's piece placement. This tool is intended to be called by the board JS.
  • player2-placement
    Player 2's piece placement. This tool is intended to be called by the AI's MCP.
  • player1-attack-position
    Player 1's attack information. This tool is intended to be called by the board JS.
  • player2-attack-position
    Player 2's attack information. This tool is intended to be called by the AI's MCP.

Resource

  • file:///game-rule
    Game rules text resource (English/Japanese)
  • ui://submarine-mcp-apps/game-board
    Board html+js (Vue rendering)

Program Structure

Game rules are processed within the MCP server. This means that the AI cannot directly intervene in the execution of the rules. This prevents the AI from cheating according to the rules, which is a common occurrence with AI.

MCP handling

This client configuration is mostly compliant with @modelcontextprotocol/ext-apps.
It has been extended to work with Cloudflare MCPAgent.

Local Debugging and Deployment

This mostly follows the instructions for running and debugging Cloudflare MCPAgent.

pnpm install # install

pnpm run dev # start dev server

pnpm run inspector # start inspector

pnpm run deploy # deploy to cloudflare workers

Guide (Japanese)

https://note.com/marble_walkers/n/na7e577612b27

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选