算24点

tvrcopgg/mcp-server-solve24
0 Stars 22 次浏览 更新于 2026-08-23

一个模型上下文协议(MCP)服务器,用于解决24点纸牌游戏。给定四个数字,它会找到计算结果为24的算术表达式。

MCP 服务配置

复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用

{
  "mcpServers": {
    "solve24": {
      "args": [
        "solve24-mcp-server"
      ],
      "command": "uvx"
    }
  }
}

Streamable HTTP 传输配置

{
  "mcpServers": {
    "solve24": {
      "url": "http://localhost:8000/mcp"
    }
  }
}

服务介绍

solve24-mcp-server

一个用于解决24点纸牌游戏模型上下文协议 (MCP) 服务器。

给定四个数字,它会找到计算结果为24的算术表达式。

工具

工具 描述
solve 为给定的4个数字找到一个解
solve_all 为给定的4个数字找到所有不同的解
verify 验证一个表达式是否等于24

安装


pip install solve24-mcp-server

或者从源码安装:


git clone https://github.com/xuan-wei/solve24-mcp-server.git

cd solve24-mcp-server

pip install -e .

使用

作为 MCP 服务器

将以下内容添加到您的 MCP 客户端配置中:


{

  "mcpServers": {

    "solve24": {

      "command": "solve24-mcp-server"

    }

  }

}

或者使用 uvx(无需安装):


{

  "mcpServers": {

    "solve24": {

      "command": "uvx",

      "args": ["solve24-mcp-server"]

    }

  }

}

可流式 HTTP(适用于云部署)


MCP_TRANSPORT=streamable-http MCP_PORT=8000 solve24-mcp-server

或者使用 Docker:


docker build -t solve24-mcp-server .

docker run -p 8000:8000 solve24-mcp-server

环境变量:

  • MCP_TRANSPORT: stdio(默认),streamable-httpsse
  • MCP_HOST: 绑定地址(默认 0.0.0.0
  • MCP_PORT: 端口(默认 8000

直接运行(标准输入输出)


solve24-mcp-server

# or

python -m solve24_mcp_server

示例

solve [3, 8, 8, 9]8/(9-8/3)(或类似表达式)

solve_all [1, 2, 3, 4] → 所有等于24的不同表达式

verify (1+2+3)*4正确!(1+2+3)*4 = 24

许可证

Apache-2.0

相关 MCP 服务