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
Visit Server

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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured