TexasSolver MCP Server

TexasSolver MCP Server

Enables interaction with the TexasSolver poker solver to run game theory optimal (GTO) poker calculations, load preflop ranges, and build game trees with structured parameters for analyzing poker hands and strategies.

Category
访问服务器

README

TexasSolver MCP Server

A Model Context Protocol (MCP) server that enables Claude and other LLMs to interact with the TexasSolver console poker solver through structured parameters.

Features

  • Run Solver: Execute the TexasSolver with custom game parameters (pot, stack, ranges, board, bet sizes)
  • Load Ranges: List and load preflop range files from the TexasSolver ranges directory
  • Build Game Trees: Generate game tree configurations without running the solver (for inspection/editing)
  • List Outputs: Query previously generated solver outputs
  • Structured Input: LLM provides structured parameters - no natural language parsing needed

Installation

1. Prerequisites

  • Node.js 18.0.0 or higher
  • TexasSolver binary (v0.2.0 or compatible)

2. Install Dependencies

cd /Users/bensimmons/Desktop/TexasSolverMCP
npm install

3. Configure Environment

Copy .env.example to .env and update the TEXAS_SOLVER_PATH:

cp .env.example .env
# Edit .env and set TEXAS_SOLVER_PATH to your solver location

Example:

TEXAS_SOLVER_PATH=/Users/bensimmons/Desktop/TexasSolverMCP/TexasSolver-v0.2.0-MacOs/console_solver

Usage

Running the MCP Server

npm start

The server will start and listen for MCP requests via stdio.

Claude Desktop Integration

Add the following to your Claude Desktop configuration file at: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "texassolver": {
      "command": "node",
      "args": ["/Users/bensimmons/Desktop/TexasSolverMCP/src/index.js"],
      "env": {
        "TEXAS_SOLVER_PATH": "/Users/bensimmons/Desktop/TexasSolverMCP/TexasSolver-v0.2.0-MacOs/console_solver"
      }
    }
  }
}

MCP Tools

run_solver

Execute the TexasSolver with game parameters.

Parameters:

  • pot (number): Starting pot size
  • effective_stack (number): Player stack size
  • board (string): Board cards (e.g., "Qs,8d,7h" for flop, empty for preflop)
  • range_ip (string): In-position player range (e.g., "AA-22,AK-AJ")
  • range_oop (string): Out-of-position player range
  • bet_sizes (object, optional): Custom bet sizes by position, street, and action
  • solver_config (object, optional): Solver settings (thread_num, accuracy, max_iteration, etc.)
  • output_name (string, optional): Custom output filename

Example:

Run AcQc vs 22+ on Ac7h2h board, 10bb pot, 100bb stacks

Returns:

{
  success: true,
  output_file: "/absolute/path/to/result_2025-01-15T10-35-22-abc123.json",
  command_file: "/absolute/path/to/cmd_2025-01-15T10-30-45-abc123.txt",
  execution_time_ms: 45000,
  solver_log: "..."
}

list_ranges

Discover available preflop range files.

Parameters:

  • filter (string, optional): Filter by position or scenario
  • range_set (string, optional): "6max", "qb", or all (default)

Returns:

{
  ranges: [
    {
      path: "6max_range/BTN",
      full_path: "/absolute/path/to/BTN",
      name: "BTN Opening Range",
      scenario: "Open",
      position: "BTN"
    },
    ...
  ]
}

load_range

Load and parse a specific range file.

Parameters:

  • range_path (string): Path from list_ranges or absolute path

Returns:

{
  range_string: "AA:1.0,KK:1.0,QQ:0.5,...",
  parsed_hands: [
    { hand: "AA", weight: 1.0 },
    { hand: "KK", weight: 1.0 },
    ...
  ],
  hand_count: 150,
  total_combos: 1325.5
}

build_game_tree_config

Generate a game tree configuration without running the solver.

Parameters: Same as run_solver (without solver_config)

Returns:

{
  command_file: "/path/to/cmd_...txt",
  commands: [
    "set_pot 10",
    "set_effective_stack 100",
    ...
  ],
  preview: "Full command file content as string"
}

list_outputs

List previously generated solver outputs.

Parameters:

  • limit (number, optional): Maximum results (default: 20)
  • sort_by (string, optional): "date" (default) or "size"

Returns:

{
  outputs: [
    {
      filename: "result_2025-01-15T10-35-22-abc123.json",
      path: "/absolute/path/to/result_...json",
      size_mb: "26.5",
      created_at: "2025-01-15T10:35:22.000Z",
      associated_command: "/path/to/cmd_...txt"
    },
    ...
  ]
}

Project Structure

texassolver-mcp/
├── package.json
├── .gitignore
├── .env.example
├── .env
├── README.md
├── src/
│   ├── index.js                 # Entry point and initialization
│   ├── server.js                # MCP server setup
│   ├── tools/                   # MCP tool implementations
│   │   ├── run-solver.js
│   │   ├── load-range.js
│   │   ├── configure-tree.js
│   │   └── list-outputs.js
│   ├── solver/                  # Solver integration
│   │   ├── command-builder.js
│   │   ├── executor.js
│   │   └── validator.js
│   ├── ranges/                  # Range file handling
│   │   ├── loader.js
│   │   ├── parser.js
│   │   └── index.js
│   ├── storage/
│   │   └── manager.js           # File management
│   └── utils/
│       └── constants.js         # Constants
└── data/                        # Server data (generated)
    ├── commands/                # Generated command files
    ├── outputs/                 # Solver JSON outputs
    └── temp/                    # Temporary files

How It Works

Solver Execution Flow

  1. Input Validation: Validates all parameters (ranges, board, bet sizes)
  2. Command Generation: Builds a command file with solver settings
  3. Process Spawning: Spawns the console_solver binary
  4. Command Piping: Pipes the command file to solver stdin
  5. Output Capture: Captures solver stdout/stderr for logging
  6. Completion: Waits for solver to finish (timeout: 10 minutes)
  7. Result Return: Returns paths to output JSON and command file

Range File Format

Ranges are stored as comma-separated hands with optional weights:

AA:1.0,KK:1.0,QQ:0.5,AKs:1.0,AKo:0.75,...
  • AA:1.0 - Always include AA
  • AKo:0.75 - Include AKo 75% of the time
  • JJ - Implicit weight of 1.0 if not specified

Error Handling

The server provides detailed error messages for:

  • Invalid solver path or missing binary
  • Invalid game parameters (pot, stack, ranges, board)
  • Invalid bet sizes
  • Solver process failures
  • Output file not created
  • Timeout (10 minutes)

All errors include:

  • Human-readable message
  • Error type (VALIDATION_ERROR, EXECUTION_ERROR, OUTPUT_ERROR)
  • Detailed context (command file, solver log, exit code)

Development

Running Tests

npm test

Testing with Sample Data

The TexasSolver includes sample command files in:

TexasSolver-v0.2.0-MacOs/resources/text/commandline_sample_input.txt

Troubleshooting

"Solver binary not found"

  • Verify TEXAS_SOLVER_PATH in .env points to the actual binary
  • Check file permissions: ls -la /path/to/console_solver

"Permission denied"

  • Make sure the binary is executable: chmod +x /path/to/console_solver

"Solver timed out"

  • Complex game trees can take time to solve
  • Reduce accuracy or max_iteration in solver_config
  • Increase SOLVER_TIMEOUT_MS in .env if needed

"Output file not created"

  • Check available disk space
  • Verify the data/outputs/ directory is writable
  • Check solver_log in error response for solver-specific errors

License

MIT

Support

For issues or feature requests, please refer to the documentation or check the MCP server logs.

推荐服务器

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

官方
精选