Sweet Home 3D MCP Server

MCP server plugin for Sweet Home 3D that lets AI assistants create walls, place furniture, apply textures, and render 3D interior designs — 42 tools, zero external dependencies.

Sweet Home 3D MCP Plugin

License: GPL v2 Java 11+ Sweet Home 3D 6.0+

A plugin for Sweet Home 3D that embeds an MCP (Model Context Protocol) server directly inside the application. Lets Claude and other AI assistants control Sweet Home 3D over HTTP — create walls, place furniture, render photos, and more — without any external proxy or separate server process.

Claude Desktop / Claude Code
         │  HTTP (JSON-RPC 2.0)
         ▼
┌─────────────────────────────────────┐
│  Sweet Home 3D  +  MCP Plugin       │
│  Built-in HTTP server on port 9877  │
│  http://127.0.0.1:9877/mcp         │
└─────────────────────────────────────┘

Screenshots

3D scene created via MCP

MCP Server Settings dialog

Requirements

RequirementVersion
Sweet Home 3D6.0 or newer
Java (bundled with SH3D or system)11 or newer

Note: Sweet Home 3D ships with a bundled JRE. Make sure it is Java 11+. Very old SH3D builds (32-bit Windows installer with JRE 1.8) will silently fail to load the plugin due to UnsupportedClassVersionError.

Installation

Step 1. Download the latest .sh3p file from Releases.

Step 2. Copy it to your Sweet Home 3D plugins folder:

OSPlugins folder
Windows%APPDATA%\eTeks\Sweet Home 3D\plugins\
macOS~/Library/Application Support/eTeks/Sweet Home 3D/plugins/
Linux~/.sweethome3d/plugins/

Step 3. (Re)start Sweet Home 3D. The MCP server starts automatically on port 9877.

You can verify it is running: Tools → MCP Server... shows the server status.

Claude Configuration

Add to your Claude Desktop claude_desktop_config.json:

{
  "mcpServers": {
    "sweethome3d": {
      "type": "http",
      "url": "http://localhost:9877/mcp"
    }
  }
}

For Claude Code, create .mcp.json in your project directory:

{
  "mcpServers": {
    "sweethome3d": {
      "type": "http",
      "url": "http://localhost:9877/mcp"
    }
  }
}

The plugin also has a built-in "Auto-configure Claude Desktop" button in Tools → MCP Server... that writes this config automatically.

Available Commands

42 commands across 12 categories.

Scene

CommandDescription
get_stateFull scene state: walls, furniture, rooms, camera, labels, levels
clear_sceneRemove all objects from the scene

Walls

CommandDescription
create_wallSingle wall between two points
create_wallsRectangular room (4 connected walls)
modify_wallChange height, thickness, color, arc, coordinates
delete_wallDelete wall by ID
connect_wallsConnect two walls for correct corner rendering

Rooms

CommandDescription
create_room_polygonRoom from an array of polygon points
modify_roomChange name, floor/ceiling color, visibility
delete_roomDelete room by ID

Furniture

CommandDescription
list_categoriesAll furniture catalog categories with item counts
list_furniture_catalogBrowse catalog; filter by name, category, or type
place_furniturePlace a catalog item in the scene
modify_furnitureMove, rotate, resize, recolor furniture by ID
delete_furnitureDelete furniture by ID
duplicate_objectsDuplicate one or more objects by ID
group_furnitureGroup multiple pieces into one object
ungroup_furnitureSplit a group back into individual pieces

Doors & Windows

CommandDescription
place_door_or_windowPlace from catalog into a wall (auto-computes position and angle)

Textures & Appearance

CommandDescription
list_textures_catalogBrowse texture catalog; filter by name or category
apply_textureApply catalog texture to wall side or room surface
set_environmentGround/sky colors, lighting, wall transparency, drawing mode

3D Shapes

CommandDescription
generate_shapeCreate custom 3D geometry: primitives (box, sphere, cylinder, cone, wedge, arch, stairs, torus, hemisphere, pipe), extrude, mesh, and CSG boolean operations (union, subtract, intersect)

Annotations

CommandDescription
add_labelText annotation on the 2D floor plan
add_dimension_lineMeasurement line with auto-offset

Camera

CommandDescription
set_cameraSwitch to top/observer mode; set position, lookAt point, or target object
store_cameraSave the current viewpoint as a named bookmark
get_camerasList all saved camera viewpoints

Multi-level

CommandDescription
add_levelAdd a new level (floor/storey)
list_levelsList all levels; shows which is currently selected
set_selected_levelSwitch the active level
delete_levelDelete a level and all its objects

Rendering & Export

CommandDescription
render_photoRay-traced 3D render (Sunflow); standard or overhead bird's-eye view; inline JPEG or saved PNG
export_plan_image2D floor plan as PNG
export_svg2D floor plan as SVG
export_to_obj3D scene as Wavefront OBJ (ZIP: OBJ + MTL + textures)

Save / Load

CommandDescription
save_homeSave the scene to a .sh3d file
load_homeLoad a .sh3d file, replacing the current scene

Checkpoints (undo timeline)

CommandDescription
checkpointSave an in-memory snapshot (optional description)
restore_checkpointRestore from a snapshot (supports force mode)
list_checkpointsList all snapshots with the current undo cursor position

Batch

CommandDescription
batch_commandsExecute multiple commands in one request

Coordinate System

  • Units: centimeters (500 = 5 meters)
  • X axis: right, Y axis: down (screen coordinates)
  • All object IDs are stable UUIDs — safe to use across multiple calls

Building from Source

Prerequisites: Java 11+, Maven 3.6+ (or use the included mvnw wrapper).

# 1. Clone
git clone https://github.com/grimashevich/sweethome3d-mcp-server.git
cd sweethome3d-mcp-server

# 2. Obtain SweetHome3D.jar (copies from your SH3D installation or downloads it)
./scripts/setup-dev.sh        # macOS / Linux / Git Bash on Windows
# scripts\setup-dev.bat       # Windows Command Prompt

# 3. Build
./mvnw clean package

# 4. Run tests
./mvnw test

# The plugin artifact is at:
# target/sh3d-mcp-plugin-1.0.0.sh3p

Why the setup script? SweetHome3D.jar is a 46 MB binary excluded from git. The script first checks your local Sweet Home 3D installation (fastest, works offline), then falls back to downloading from SourceForge. The three Java3D JARs (j3dcore, j3dutils, vecmath) are included in lib/ directly.

Architecture

The plugin is a single self-contained component with no external runtime dependencies:

  • plugin — Entry point (SH3DMcpPlugin), settings dialog
  • http — Streamable HTTP MCP server (JSON-RPC 2.0, port 9877)
  • command — 42 command handlers, auto-registered via CommandRegistry
  • bridge — Thread-safe Sweet Home 3D API wrapper (HomeAccessor via EDT, CheckpointManager, ObjectResolver)
  • protocol — Hand-written JSON parser (zero external dependencies)
  • config — Plugin settings, Claude Desktop auto-configurator

See ARCHITECTURE.md for the full design, ADR decisions, and sequence diagrams.

Adding a New Command

One class is all it takes — the registry picks it up automatically:

public class MyCommandHandler implements CommandHandler, CommandDescriptor {

    @Override
    public Response execute(Request request, HomeAccessor accessor) {
        // All Home mutations must run on the Event Dispatch Thread:
        Object result = accessor.runOnEDT(() -> {
            Home home = accessor.getHome();
            // ... do something
            return "done";
        });
        return Response.success(result);
    }

    @Override
    public String getDescription() { return "Does something useful."; }

    @Override
    public Map<String, Object> getSchema() {
        return SchemaBuilder.object()
            .prop("name", "string", "Object name")
            .required("name")
            .build();
    }
}

Then register it in SH3DMcpPlugin.createCommandRegistry():

registry.register("my_command", new MyCommandHandler());

See CONTRIBUTING.md for the full development guide.

License

GNU General Public License v2.0 — see LICENSE for details.

This plugin uses the Sweet Home 3D Plugin API (GPL v2) and Java3D (BSD / JOGL license).

Servidores relacionados