Blocksworld Simulation MCP Server

Blocksworld Simulation MCP Server

Enables LLMs to interact with the Blocksworld Simulation to perform block manipulation actions, query real-time state, and verify multi-step plans. It bridges the Model Context Protocol with the simulation's REST API for AI planning research and agent development.

Category
访问服务器

README

🤖 Blocksworld Simulation MCP Server

A Model Context Protocol (MCP) server that enables Large Language Models (LLMs) to interact with the Blocksworld Simulation through tool calls. This allows AI agents or LLMs in general like Claude, ChatGPT, and other MCP-compatible systems to solve planning problems by directly controlling the simulation.

🎯 What is This?

This MCP server exposes the Blocksworld Simulation's REST API as a set of tools that LLMs can use. Instead of just talking about block manipulation, LLMs can actually:

  • Execute actions: Pick up, put down, stack, and unstack blocks
  • Query state: Get real-time information about block positions and robot status
  • Verify plans: Test multi-step plans before execution
  • Learn rules: Retrieve the complete set of constraints and preconditions

Perfect for:

  • 🔬 AI Planning Research: Test LLM reasoning and planning capabilities
  • 🎓 Educational Projects: Demonstrate AI problem-solving in action
  • 🧪 Agent Development: Build and test autonomous AI agents
  • 📊 Benchmarking: Evaluate LLM performance on classic planning problems

✨ Features

  • 7 MCP Tools: Complete set of blocksworld operations exposed as LLM tools
  • Rich Descriptions: Each tool includes detailed preconditions and effects
  • Plan Verifciation: LLMs can verify plans without executing them
  • State Inspection: Query current simulation state at any time
  • Rule Discovery: LLMs can learn the rules dynamically
  • Type Safety: Pydantic models ensure correct tool usage

🚀 Quick Start

Prerequisites

  1. Python 3.10+ installed
  2. Blocksworld Simulation running on localhost:5001

Installation

# Clone the repository
git clone https://github.com/hsu-aut/llmstudy_mcp-server.git
cd llmstudy_mcp-server

# Install dependencies
poetry install

# Run the MCP server
poetry run blocksworld-mcp-server

Using with Claude Desktop

Add this to your Claude Desktop configuration file:

MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "blocksworld": {
      "command": "poetry",
      "args": [
        "--directory",
        "/path/to/llmstudy_mcp-server",
        "run",
        "blocksworld-mcp-server"
      ]
    }
  }
}

Restart Claude Desktop, and the blocksworld tools will be available!

🛠️ Available Tools

The MCP server provides the following tools to LLMs:

1. pick_up

Pick up a block from the ground.

Parameters:

  • block (str): The name of the block to pick up

Preconditions:

  • Block must be on the ground (not stacked)
  • Block must be clear (nothing on top)
  • Robot must be idle (not holding anything)

2. unstack

Remove a block from the top of another block.

Parameters:

  • block_x (str): The block to remove
  • block_y (str): The block underneath

Preconditions:

  • Block x must be directly on top of block y
  • Block x must be clear
  • Robot must be idle

3. put_down

Place the held block on the ground.

Parameters:

  • block (str): The name of the block to put down

Preconditions:

  • Robot must be holding the specified block
  • A free ground position must be available

4. stack

Place the held block on top of another block.

Parameters:

  • block_x (str): The block to place (currently held)
  • block_y (str): The block to stack on

Preconditions:

  • Robot must be holding block x
  • Block y must be clear

5. status

Get the current state of the simulation.

Returns:

  • Complete JSON object with all block positions, stack configurations, and robot state

6. rules

Get the complete description of blocksworld rules and constraints.

Returns:

  • Markdown-formatted text describing the environment, rules, and available actions

7. verify_plan

Verify a multi-step plan without executing it.

Parameters:

  • plan (PlanRequest): A sequence of actions to verify

Returns:

  • Success message if the plan is verified, or detailed error message indicating which step fails

Note: execute_plan is disabled by default to encourage LLMs to execute actions step-by-step for better reasoning.

📋 Example Usage

Here's how an LLM might use these tools to solve a simple problem:

User: "Stack block A on top of block B"

LLM thought process:
1. Call status() to see current state
2. Call rules() to understand constraints
3. Determine plan: pick_up(A) → stack(A, B)
4. Call verify_plan([pick_up(A), stack(A, B)]) to verify
5. Execute: pick_up(A)
6. Execute: stack(A, B)
7. Confirm success

🔧 Configuration

Changing the Simulation API URL

By default, the MCP server connects to http://localhost:5001. To change this, edit src/blocksworld_simulation_mcp_server/mcp_server.py:

SIM_API = "http://localhost:5001"  # Change this line

📚 Architecture

┌─────────────────────┐           MCP Protocol            ┌──────────────────┐
│   LLM (Claude)      │◄────────────────────────────────►│   MCP Server     │
│                     │      Tool Calls & Responses       │   (This Repo)    │
└─────────────────────┘                                   └──────────────────┘
                                                                    │
                                                           HTTP REST API
                                                                    │
                                                                    ▼
                                                          ┌──────────────────┐
                                                          │  Blocksworld     │
                                                          │  Simulation      │
                                                          │  (localhost:5001)│
                                                          └──────────────────┘

The MCP server acts as a bridge between:

  • LLMs that speak the Model Context Protocol
  • Blocksworld Simulation that exposes a REST API

🔗 Related Projects

推荐服务器

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

官方
精选