bb-gnubg-mcp

bb-gnubg-mcp

MCP server wrapping the GNU Backgammon neural network evaluation engine. Provides 18 tools for position analysis, move evaluation, rollouts, and board conversion.

Category
访问服务器

README

bb-gnubg-mcp

MCP server wrapping the GNU Backgammon neural network evaluation engine. Exposes 18 tools for position analysis, move evaluation, rollouts, and board conversion via the Model Context Protocol.

Requirements

  • Python 3.13+
  • uv

Installation

git clone <repo-url>
cd bb-gnubg-mcp
uv sync

Running Locally (stdio)

The default transport is stdio, suitable for use with Claude Code and other MCP clients:

uv run python -m bb_gnubg_mcp

Or via the installed script:

uv run bb-gnubg-mcp

Claude Code Configuration

Add to your Claude Code MCP settings:

{
  "mcpServers": {
    "bb-gnubg-mcp": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/bb-gnubg-mcp", "python", "-m", "bb_gnubg_mcp"]
    }
  }
}

Running Locally (HTTP)

For HTTP transport with API key authentication:

export MCP_TRANSPORT=http
export API_KEY=your-secret-key
export PORT=8000  # optional, defaults to 8000
uv run python -m bb_gnubg_mcp

The server starts on http://0.0.0.0:8000 with:

  • Streamable HTTP MCP transport
  • Bearer token auth on all tool calls (pass Authorization: Bearer <API_KEY>)
  • Health check at GET /health

Docker

Build

docker build -t bb-gnubg-mcp .

Run

docker run -p 10000:10000 \
  -e API_KEY=your-secret-key \
  bb-gnubg-mcp

The Dockerfile uses a multi-stage build with uv. The image defaults to HTTP transport on port 10000.

Override settings

docker run -p 8080:8080 \
  -e API_KEY=your-secret-key \
  -e PORT=8080 \
  -e MAX_ROLLOUT_GAMES=5000 \
  bb-gnubg-mcp

Deploy to Render

  1. Push this repo to GitHub.

  2. In the Render dashboard, click New > Blueprint and connect your GitHub repo.

  3. Render detects render.yaml and creates the service automatically.

  4. Set the API_KEY environment variable in the Render dashboard (it's marked sync: false in the Blueprint so it won't be committed to source).

  5. Deploy. The health check at /health confirms the service is running.

Alternatively, create the service manually:

  1. New > Web Service in Render.
  2. Connect your GitHub repo.
  3. Set Environment to Docker.
  4. Add environment variables:
    • MCP_TRANSPORT = http
    • PORT = 10000
    • API_KEY = your secret key
  5. Set Health Check Path to /health.
  6. Deploy.

Auto-deploy is enabled — pushing to the connected branch triggers a new deployment.

Tools

Board Conversion

Tool Description
board_from_position_id Position ID string to 2x25 board
board_from_position_key Position key string to 2x25 board
position_id Board (any format) to Position ID
key_of_board Board (any format) to position key

Position Analysis

Tool Description
classify Classify position type (contact, race, bearoff, etc.)
probabilities Win/gammon/backgammon probabilities via neural net
pub_eval_score Fast heuristic evaluation score

Move Evaluation

Tool Description
best_move Best move with alternatives, probabilities, and equity
pub_best_move Best move via fast public evaluation
moves All legal moves for a position and dice roll

Simulation

Tool Description
rollout Cubeless Monte Carlo rollout
cubeful_rollout Cubeful Monte Carlo rollout

Bearoff

Tool Description
bearoff_id_2_pos Bearoff ID to 6-point position
bearoff_probabilities Probability distribution for bearing off in N moves
one_checker_race Win probability for single-checker bearoff

Utility

Tool Description
roll Roll two dice
equities_value Match equity table lookup
get_constants List all GNUBG constant names and values

Board Input Formats

All tools that accept a board position support three formats:

JSON boardState (matching the bb-plays-mcp convention):

{
  "board": {
    "x": {"24": 2, "13": 5, "8": 3, "6": 5},
    "o": {"24": 2, "13": 5, "8": 3, "6": 5}
  },
  "player": "x"
}

Position ID (14-character GNUBG string):

"4HPwATDgc/ABMA"

Raw 2x25 array (as returned by gnubg):

[[0,0,0,0,0,5,0,3,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,2,0],
 [0,0,0,0,0,5,0,3,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,2,0]]

Environment Variables

Variable Default Description
MCP_TRANSPORT stdio Transport mode: stdio or http
API_KEY — Required for HTTP mode. Bearer token for auth.
PORT 8000 HTTP listen port
MAX_ROLLOUT_GAMES 10000 Maximum games per rollout call

Tests

uv run pytest                    # all tests (rollouts are slow)
uv run pytest -m "not slow"      # skip rollout tests

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选