Skip to main content
Glama

✨ Features

  • πŸ—ΊοΈ 35 MCP tools to create maps up to 256x256, paint tiles, generate rooms and corridors, and place doors, chests, traps, levers, stairs and spawns.

  • 🏘️ Buildings you can enter: put houses, taverns, temples, towers or castles on an outdoor map; each gets its own interior map, linked both ways, ready to load in a game (guide with a Godot loader).

  • 🏰 3 layout presets: a crypt, a castle floor and a werewolf den, each built in one call.

  • 🎨 20 themes, 12 of them with bundled isometric sprites ready to use.

  • πŸ›‘οΈ Guard rails for agents: placing a chest on a wall, outside a room or on another object fails with a message that says how to fix it, and validate_map checks the map before export, including that the player can walk to every room, chest and doorway.

  • πŸ“ Correct Tiled output: object positions follow Tiled's isometric convention, and saved files point at their sprites with relative paths, so they open directly in Tiled.

  • 🧠 Agent skill and MCP prompt (map_builder): a step-by-step workflow with an ASCII sketch confirmation, theme heuristics and tactical rules.

  • πŸ–ŒοΈ Optional sprite generation with FLUX.1-dev through Hugging Face. It is paid, opt-in, and never runs by accident.

  • πŸ”Œ Works with any MCP client: Claude Code, Claude Desktop, Cursor, VS Code, Zed, OpenCode, and agents running NVIDIA Nemotron.

  • πŸ€— Hosted on Hugging Face: a web page where an open AI model builds a map from your description, and a remote MCP endpoint. Paid calls always run on the visitor's own Hugging Face account.

Related MCP server: material-workbench

πŸ€— Try it online

No install: open the Tiled Map Builder Space, sign in with Hugging Face, describe a map in any language and download a .zip that opens in Tiled. The AI model (default openai/gpt-oss-120b) runs on your Hugging Face inference credits, usually a few cents per map; the Space owner pays nothing for your use and never sees your token.

New: try the Village (enter buildings) example. The model builds an outdoor map with houses, a tavern, a chapel, a tower and a castle; each building gets its own interior map, and the .zip holds them all, linked both ways.

AI agents can use the same Space as a remote MCP server with their own token:

claude mcp add --transport http tiled-map-builder https://4math-tiled-map-builder.hf.space/mcp \
  --header "Authorization: Bearer hf_YOUR_TOKEN"

How it works, costs, other clients, and running your own copy: docs/hugging-face.md.

πŸ–ΌοΈ Preview

🧱 Tech stack

Technology

Role in this project

Model Context Protocol

How agents discover and call the map tools (stdio locally, Streamable HTTP when hosted)

TypeScript

Server source in tiled-mcp/src

Node.js 20.9+

Runtime for the server and the scripts

Zod

Validates every tool input and generates the JSON schemas agents see

πŸ—ΊοΈ

Tiled

Map editor that opens the generated .tmj files

Hugging Face Inference Providers

The hosted page's AI model (open LLMs with tool calling) and optional FLUX.1-dev sprites, billed to each user

Hugging Face Spaces

Hosts the web page and remote MCP endpoint (Docker Space with "Sign in with Hugging Face")

Docker

Image of the hosted mode, used by the Space and for self-hosting

πŸ–ΌοΈ

sharp

Background removal and resizing of generated sprites, PNG previews

NVIDIA Nemotron

One of the agent models this server was designed and tested with

πŸš€ Quick start

Requirements: Node.js 20.9 or newer and git. Tiled is optional, to view and edit the maps.

git clone https://github.com/4math2379/Tiled-MCP-Server.git
cd Tiled-MCP-Server
npm install        # installs the server workspace
npm run build      # compiles tiled-mcp/src to tiled-mcp/dist
npm test           # optional: every offline test suite (96 + 96 + 39 checks)

Then register the server with your MCP client. With Claude Code, from the repository folder:

claude mcp add tiled-map-builder -- node "$(pwd)/tiled-mcp/dist/index.js"

Most other clients take the same JSON block (replace the path with your absolute path):

{
  "mcpServers": {
    "tiled-map-builder": {
      "command": "node",
      "args": ["/absolute/path/to/Tiled-MCP-Server/tiled-mcp/dist/index.js"]
    }
  }
}

πŸ‘‰ Per-client instructions for Claude Desktop, Cursor, VS Code, Zed, OpenCode, Windsurf and the MCP Inspector are in docs/client-setup.md.

Now ask your agent:

Build a 28x18 crypt under an abandoned chapel with two skeletons in the nave, a locked chest in the north chamber and a dart trap before the deep crypt. Save it as crypt-chapel.tmj.

The map lands in maps/crypt-chapel.tmj. Open it in Tiled, or render a preview without Tiled:

npm run preview -- maps/crypt-chapel.tmj

🧭 How it works

flowchart LR
    A["AI agent<br/>(Claude, Nemotron, ...)"] -- MCP tools --> S["tiled-map-builder<br/>server"]
    S --> M[("Maps in memory<br/>ground Β· walls Β· decorations<br/>objects Β· spawns")]
    M --> V{"validate_map"}
    V --> F["save_to_disk<br/>maps/*.tmj"]
    F --> T["Tiled editor<br/>or a game engine"]
  1. create_map makes an empty map in a theme and returns a mapId.

  2. Tiles are painted by role (walkable_floor, wall, hazard_primary, obstacle_decor, ...) and the theme picks the sprite.

  3. Each map has three tile layers, ground, walls and decorations, and two object layers, objects (doors, chests, traps, levers, stairs) and spawns (player, enemy, NPC).

  4. Coordinates are grid cells: x is the column and y the row; (0,0) is the top corner of an isometric map.

  5. Maps live in server memory until you call save_to_disk or export_json.

Details, properties and importer formulas: docs/map-format.md.

🧰 Tools

Group

Tools

Map lifecycle

list_themes Β· create_map Β· list_maps Β· describe_map Β· discard_map

Painting

paint_tile Β· paint_rect Β· paint_wall_border Β· erase_tile Β· get_tile_info

Rooms and corridors

generate_room Β· generate_corridor

Layout presets

generate_crypt_layout (27x18+) Β· generate_castle_floor (27x20+) Β· generate_werewolf_den (22x16+)

Objects

place_door Β· place_chest Β· place_stairs_object Β· place_trap Β· place_lever

Spawns

place_spawn_player Β· place_spawn_enemy Β· place_spawn_npc

Buildings and linked maps

place_building Β· link_maps Β· validate_world Β· save_world

Validation and export

validate_map Β· export_json Β· save_to_disk

Sprites

preview_sprite_prompt (free) Β· generate_tile_sprite πŸ’Έ Β· generate_theme_sprite_set πŸ’Έ Β· generate_building_sprite πŸ’Έ Β· override_tile_image

Full parameters, generated from the server itself: docs/tools.md.

🎨 Themes

Theme key

Display name

Setting

Sprites

CRYPT

Mournevald Crypt

Burial vaults, cracked flagstones, poison vents

βœ…

CASTLE

Castle Von Drak

Black marble halls, throne room, grand stairs

βœ…

WEREWOLF_DEN

Werewolf Den

Damp caves, bones, blood pools

βœ…

TAVERN_BLOOD_PRINCE

Blood Prince Inn

Tavern interior, oak tables, hearth

βœ…

VILLAGE

Mournevald Village

Wet cobblestones, half-timbered houses, well

βœ…

HAUNTED_FOREST

Drakenmark Forest

Dark undergrowth, brambles, parasitic mist

βœ…

MAUSOLEUM

Mausoleum

Veined marble, fallen-angel statues, urns

βœ…

BLOOD_TOMB

Blood Tomb

Ritual sanctuary, bleeding runes, altar

βœ…

AQUATIC

Stagnant Waters

Stagnant water, water lilies, sunken ruins

βœ…

GLACIER

Frozen Tundra

Black ice, frozen statues, thin ice

βœ…

FLOODED

Flooded Coast

Drowned city, kelp, deep currents

βœ…

ELECTRONIC

Electronic Network

Circuit boards, cables, mainframe cores

βœ…

VOLCANO

Volcanic Slope

Lava flows, obsidian, ash

βž–

DARK_FOREST

Dark Forest

Twisted woods, quicksand, standing stones

βž–

WINTER

Snowy Plain

Snowfields, frozen lakes, cairns

βž–

SPRING

Spring Meadow

Flowering meadows, streams, maypole

βž–

SUMMER

Summer Plain

Golden wheat, cracked earth, scarecrows

βž–

AUTUMN

Autumn Forest

Russet leaves, bog mire, mushrooms

βž–

DESOLATION

Desolate Land

Ash pits, charred trees, ruins

βž–

FUTURISTIC

Futuristic City

Chrome, neon, plasma leaks, server racks

βž–

βœ… sprites bundled in assets/ Β· βž– no sprites yet: the maps are valid and Tiled shows placeholders until you generate the sprites.

More about each theme's roles and hazards: docs/themes.md.

πŸ€– Agent skill and prompt

skills/map-builder/SKILL.md teaches an agent the whole workflow: infer the theme, sketch the layout in ASCII and ask for confirmation, build, validate, save.

  • Claude Code: copy the folder to ~/.claude/skills/map-builder/ (all projects) or .claude/skills/map-builder/ (one project), then type /map-builder crypt 28x18 ....

  • Any MCP client: the server exposes the same workflow as the prompt map_builder, which takes a free-form description.

βš™οΈ Configuration

Nothing is required for map building. Optional settings go in tiled-mcp/.env (copy tiled-mcp/.env.example) or in the env block of your MCP client:

Variable

Default

Purpose

TILED_MAPS_DIR

maps/

Where save_to_disk writes relative paths

TILED_ASSETS_DIR

assets/

Sprite folder (<theme>/<role>.png)

TILED_OBJECT_COORDS

tiled

screen restores the legacy object encoding for older importers

HUGGINGFACE_API_KEY or HF_TOKEN

none

Only for paid sprite generation

All variables, the hosted-mode settings, the .env lookup order and security notes: docs/configuration.md.

πŸ’Έ Sprite generation (optional, paid)

Map building is free and offline. Generating new sprites calls FLUX.1-dev through Hugging Face Inference Providers and costs money per sprite. The tools never overwrite an existing sprite unless you pass force, and the batch script asks for --yes:

node scripts/gen-theme-set.mjs VOLCANO --dry-run   # free: shows what would be generated
node scripts/gen-theme-set.mjs VOLCANO --yes       # paid: about 10 sprites

Read docs/sprite-generation.md before you start.

🟩 Using it with NVIDIA Nemotron

The server works with any model that supports tool calling. It was built alongside agents running Nemotron 3.5 Super-VL on the NVIDIA API free tier, for example through OpenCode. The NVIDIA key belongs to your agent, not to this server. Setup: docs/nemotron.md.

πŸ—‚οΈ Repository layout

tiled-mcp/          MCP server (TypeScript): src/, package.json, tsconfig.json, .env.example
  src/tools/        tool groups: lifecycle, paint, procedural, layout-presets, objects, export, generation
  src/themes/       20 theme definitions and the FLUX prompt catalog
  src/http.ts       hosted mode: web page, web AI agent, MCP over HTTP, Hugging Face sign-in
  web/              the hosted web page (HTML, CSS, JS)
huggingface/        Space card and the script that publishes this repository to the Space
Dockerfile          image of the hosted mode (used by the Space)
skills/map-builder/ agent skill, also served as the map_builder MCP prompt
maps/               sample .tmj maps (default output folder of save_to_disk)
assets/             isometric sprites per theme: <theme>/<role>.png
scripts/            example map scripts, preview renderer, sprite batch, docs generator, smoke test
docs/               documentation, banner and preview images

πŸ› οΈ Scripts

Command

What it does

npm run build

Compile the server

npm test

Run every offline test suite once; npm run test:loop runs them 5 times in a row

npm run smoke

Start the server and run 96 offline end-to-end checks, including one loop over all 20 themes

npm run start:web

Start the hosted mode (web page and MCP over HTTP) on port 7860

npm run smoke:http

Test the hosted mode offline, with a stand-in for the AI model

npm run inspect

Open the server in the MCP Inspector

npm run preview -- <map.tmj>

Render a map to PNG without Tiled

npm run examples

Rebuild the scripted sample maps and the sample world in maps/

npm run docs

Regenerate docs/tools.md and docs/themes.md from the server

node scripts/gen-theme-set.mjs <THEME> --yes

Generate a theme's missing sprites (paid)

node scripts/gen-building-sprites.mjs --yes

Generate missing building sprites (paid); --clean re-cuts existing ones for free

🀝 Contributing

Issues and pull requests are welcome. See CONTRIBUTING.md for the development loop and CHANGELOG.md for what changed.

πŸ“„ License

MIT. Tiled is an independent project by ThorbjΓΈrn Lindeijer. Some theme names evoke classic gothic-horror settings; this project is not affiliated with or endorsed by their rights holders.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      D
      maintenance
      Enables AI models to develop and automate RPG Maker MZ projects by creating maps, events, and plugins through natural language commands. It provides comprehensive tools for database management, asset integrity checks, and direct map tile manipulation.
      28
      17 npm
      1
      ISC
    • A
      license
      B
      quality
      D
      maintenance
      Exposes procedural material and isometric terrain generation as MCP tools, allowing agents to create deterministic PBR textures and 2:1 isometric tiles from JSON recipes.
      12
      1
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables AI agents to procedurally design and render stylized 2:1 dimetric isometric game assets in Blender, including NPR cel-shaded scenes, modular tilesets, 8-angle avatar turnarounds, and mathematically exact subpixel collision diamonds, with turnkey engine manifests for Phaser, Godot 4, and retro web games.
      10
      Apache 2.0