
mcp fiar
使用 Spring Boot 实现的基于 MCP 协议的四子棋游戏,支持与 GitHub Copilot 对战。
Repository Info
About This Server
使用 Spring Boot 实现的基于 MCP 协议的四子棋游戏,支持与 GitHub Copilot 对战。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
Four in a Row - MCP Game
!Connect Four
A Connect Four-style game implemented as a Model Context Protocol (MCP) server using Spring Boot.
Overview
This project implements a Four in a Row (also known as Connect Four) game as a Model Context Protocol (MCP) server built using Spring Boot. The game allows players to compete against GitHub Copilot in a classic game of vertical checkers where the goal is to connect four pieces in a row - horizontally, vertically, or diagonally.
Prerequisites
- Java JDK 17 or later
- Maven 3.6 or later
- Visual Studio Code with the GitHub Copilot extension installed
Setup and Installation
-
Clone the repository:
git clone <repository-url> cd mcp-fiar -
Build the project using Maven:
./mvnw clean installThis will create the JAR file at
target/mcp-fiar-0.0.1-SNAPSHOT.jar
Starting the MCP Server
The project includes a VS Code MCP configuration file (mcp.json in the .vscode folder) that makes it easy to start the server:
- Open the project in Visual Studio Code
- Make sure the GitHub Copilot Chat extension is installed and enabled
- Open the command palette (Cmd+Shift+P or Ctrl+Shift+P)
- Type and select: "Copilot: Open Chat"
- The MCP server should start automatically when you interact with Copilot Chat
If the server doesn't start automatically, ensure the MCP configuration is correctly set up in the .vscode/mcp.json file:
{
"servers": {
"fiar-game-mcp-weather": {
"command": "java",
"args": [
"-Dspring.ai.mcp.server.stdio=true",
"-Dspring.main.web-application-type=none",
"-Dlogging.pattern.console=",
"-jar",
"${workspaceFolder}/target/mcp-fiar-0.0.1-SNAPSHOT.jar"
]
}
}
}
Hover with the mouse over the server entry and click the "Start Server" button that appears. This will launch the MCP server for GitHub Copilot to interact with.
Playing the Game
Once the server is running, you can interact with GitHub Copilot to play the game:
-
In the GitHub Copilot Chat panel, type a prompt like:
- "Let's play Four in a Row"
- "Start a Four in a Row game with a 6×6 grid"
- "Can we play Connect Four with a 5×5 board?"
-
Copilot will create a new game and act as your opponent
-
To make a move, simply respond with the column number (1-7 for standard boards) where you want to place your piece
-
Copilot will make its move and show the updated board after each turn
Game Commands
Here are some useful prompts you can use during gameplay:
1to7- Drop your piece in the specified column- "Show me the board" - Display the current board state
- "Reset all games" - Clear all stored games
- "Get all games" - List all active and completed games
Project Structure
The project is organized as follows:
src/main/java/com/microsoft/germany/csu/mcp_fiar/- Core application codeMcpFiarApplication.java- Spring Boot application entry pointservice/api/- API interfaces and model classesFiarService.java- Game service interfaceGame.java- Game state modelGameStatus.java- Enum for game status (IN_PROGRESS, PLAYER_ONE_WON, etc.)
service/impl/- Service implementationsFiarServiceImpl.java- Implementation of the game logic
Game Rules
- Players take turns dropping their pieces into one of the columns
- Pieces fall to the lowest available position in the selected column
- The first player to connect four of their pieces in a row (horizontally, vertically, or diagonally) wins
- If all positions are filled without a winner, the game is a draw
Development Notes
This project uses:
- Spring Boot for the application framework
- Spring AI Model Context Protocol (MCP) for communication with GitHub Copilot
- JUnit for testing
To extend or modify the game, the main classes to look at are:
FiarServiceImpl.java- contains the core game logicGame.java- represents the game state
Resources
- Spring AI MCP Documentation - Official documentation for Spring AI Model Context Protocol
- Spring Boot Documentation - Reference for Spring Boot framework
- GitHub Copilot Documentation - Information about GitHub Copilot features and capabilities
Quick Start
Clone the repository
git clone https://github.com/jeffreygroneberg/mcp-fiarInstall dependencies
cd mcp-fiar
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.