Spaces:
Running
Running
Sync from GitHub 82ed13d
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- .dockerignoreAdded+8
- .gitattributes+4
- .gitignoreAdded+10
- CHANGELOG.mdAdded+94
- CONTRIBUTING.mdAdded+46
- DockerfileAdded+20
- LICENSEAdded+21
- README.md+302-4
- assets/aquatic/decoration_minor.pngAdded
- assets/aquatic/difficult_terrain.pngAdded
- assets/aquatic/door_closed.pngAdded
- assets/aquatic/hazard_primary.pngAdded
- assets/aquatic/obstacle_decor.pngAdded
- assets/aquatic/stairs.pngAdded
- assets/aquatic/walkable_floor.pngAdded
- assets/aquatic/walkable_floor_alt.pngAdded
- assets/aquatic/wall.pngAdded
- assets/aquatic/wall_corner.pngAdded
- assets/blood_tomb/decoration_minor.pngAdded
- assets/blood_tomb/difficult_terrain.pngAdded
- assets/blood_tomb/door_closed.pngAdded
- assets/blood_tomb/hazard_primary.pngAdded
- assets/blood_tomb/obstacle_decor.pngAdded
- assets/blood_tomb/walkable_floor.pngAdded
- assets/blood_tomb/walkable_floor_alt.pngAdded
- assets/blood_tomb/wall.pngAdded
- assets/castle/decoration_minor.pngAdded
- assets/castle/decoration_minor__fine_china.pngAdded
- assets/castle/difficult_terrain.pngAdded
- assets/castle/door_closed.pngAdded
- assets/castle/obstacle_decor.pngAdded
- assets/castle/obstacle_decor__banquet_table.pngAdded
- assets/castle/stairs.pngAdded
- assets/castle/walkable_floor.pngAdded
- assets/castle/walkable_floor_alt.pngAdded
- assets/castle/wall.pngAdded
- assets/castle/wall_corner.pngAdded
- assets/crypt/decoration_minor.pngAdded
- assets/crypt/difficult_terrain.pngAdded
- assets/crypt/door_closed.pngAdded
- assets/crypt/hazard_primary.pngAdded
- assets/crypt/obstacle_decor.pngAdded
- assets/crypt/stairs.pngAdded
- assets/crypt/walkable_floor.pngAdded
- assets/crypt/walkable_floor_alt.pngAdded
- assets/crypt/wall.pngAdded
- assets/crypt/wall_corner.pngAdded
- assets/electronique/decoration_minor.pngAdded
- assets/electronique/difficult_terrain.pngAdded
- assets/electronique/door_closed.pngAdded
12345678.gitnode_modulestiled-mcp/node_modulestiled-mcp/dist**/.env**/.env.local*.logmaps/*.png32 unmodified lines33343532 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text32 unmodified lines3334353637383932 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textdocs/images/preview-aquatic-cavern.png filter=lfs diff=lfs merge=lfs -textdocs/images/preview-crypt-preset.png filter=lfs diff=lfs merge=lfs -textdocs/images/preview-hacker-lair.png filter=lfs diff=lfs merge=lfs -textdocs/images/preview-ice-fortress.png filter=lfs diff=lfs merge=lfs -text
12345678910node_modules/dist/*.tsbuildinfo.env.env.local*.log.DS_Store
# PNG previews rendered next to maps by scripts/render-map-preview.mjsmaps/*.png12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394# Changelog
## 0.3.0
A hosted mode, published as a Hugging Face Space.
### Added
- Hosted mode (`npm run start:web`, `tiled-mcp/dist/http.js`), on one port: - a web page where an open AI model on Hugging Face Inference Providers builds a map from a description, with live progress, a PNG preview and a Tiled-ready `.zip`; - every MCP tool over Streamable HTTP at `/mcp`, one isolated workspace per session; - "Sign in with Hugging Face" when it runs on a Space.
Paid calls only ever use the caller's own token. See [docs/hugging-face.md](docs/hugging-face.md).- `Dockerfile` and the `huggingface/` folder (Space card and publishing script).- `npm run smoke:http`: offline end-to-end test of the hosted mode with a stand-in AI model.- Map previews draw grey placeholder tiles where a theme has no sprite yet.
### Changed
- The preview renderer moved to `tiled-mcp/src/render.ts`, shared by `npm run preview` and the web page. `npm run preview` now needs `npm run build` first.- In hosted mode `save_to_disk` returns download links, and generated sprites stay in the caller's session instead of the server's disk.
## 0.2.0
Usable by anyone from a fresh clone, with English documentation.
### Breaking
- **Object and spawn coordinates now follow Tiled's isometric convention** (`x = col * tileheight`, `y = row * tileheight`). Objects are one-tile rectangles and spawns are point objects at the tile centre, so everything opens on the right tiles in Tiled. The previous encoding added a half-map origin offset that neither Tiled nor existing importers decoded correctly. Importers that expect the older screen-space encoding can set `TILED_OBJECT_COORDS=screen`. See [docs/map-format.md](docs/map-format.md#object-coordinates).- Node.js 20.9 or newer is required (sharp 0.35).- The server identifies itself as `tiled-map-builder`, and the package is `tiled-map-builder-mcp`.- Layout presets enforce the sizes they need to avoid overlapping rooms: crypt 27x18, castle 27x20, werewolf den 22x16.- Tool titles, descriptions and errors are in English.- Three theme keys and their sprite folders were renamed to generic names: `CASTLE` (`assets/castle`), `VILLAGE` (`assets/village`) and `HAUNTED_FOREST` (`assets/haunted_forest`).- The map properties holding the theme key and display name are now `theme` and `mapName`.
### Fixed
- The `map_builder` prompt loads `skills/map-builder/SKILL.md`, which is now in the repository.- Sprite tools accept all 20 themes instead of 8.- Default folders and the `.env` file are resolved inside the repository instead of the author's machine.- Example scripts import the server and write maps with repository-relative paths.- `save_to_disk` writes sprite paths relative to the saved file, so maps open in Tiled with their images; the sample maps were updated accordingly.- The castle preset opens the wall under its locked main door.- `paint_rect` and `paint_wall_border` reject rectangles outside the grid instead of painting part of them.- `generate_room` rejects an exit offset beyond the wall.- Declared dependency ranges match the APIs used (MCP SDK 1.23+, zod 4, sharp 0.35); a fresh install reports no known vulnerabilities.
### Added
- Placement checks: spawns, chests, traps, levers and zone stairs cannot go on a wall, outside the ground, on an obstacle prop or on an occupied cell. `get_tile_info` reports occupants.- `validate_map` warns about objects on walls or outside the ground and doors left inside a wall.- `list_themes` reports which sprites are present.- `generate_tile_sprite` no longer overwrites an existing sprite unless `force: true`.- MCP tool annotations (read-only, destructive, idempotent, network).- Configuration: `TILED_MAPS_DIR`, `TILED_OBJECT_COORDS`, `TILED_HF_PROVIDER`, automatic `tiled-mcp/.env` loading.- Scripts: `npm run smoke` (end-to-end checks), `npm run preview` (PNG renderer), `npm run docs` (generated tool and theme references), `gen-theme-set.mjs` with `--dry-run` and a required `--yes`.- Documentation: client setup for seven clients and the MCP Inspector, tool reference, map format, themes, configuration, sprite generation, Nemotron, troubleshooting, contributing. MIT `LICENSE` file.- The map-builder skill rewritten in English for any user, keeping the original workflow and design heuristics.
### Removed
- Superseded script drafts: the first aquatic script and glacier drafts 1 to 3 were removed, and the versions that produced the sample maps (aquatic v2, glacier v4) became `create-aquatic-map.mjs` and `create-glacier-map.mjs`.- `gen-assets.mjs`, covered by `gen-theme-set.mjs`.- The `upload_to_dungeon` tool and its environment variables. It only served one private web app; save maps with `save_to_disk` instead.
## 0.1.0
Initial public version.12345678910111213141516171819202122232425262728293031323334353637383940414243444546# Contributing
Thanks for helping. Bug reports, new themes, better presets and documentation fixes are allwelcome.
## Development loop
```bashnpm installnpm run build # compile tiled-mcp/src to tiled-mcp/distnpm run smoke # 38 offline end-to-end checks; must stay greennpm run smoke:http # hosted mode checks; must stay greennpm run docs # regenerate docs/tools.md and docs/themes.md after changing tools or themesnpm run inspect # try tools by hand in the MCP Inspectornpm run preview -- maps/<file>.tmj # look at a map without Tiled```
Node.js 20.9 or newer is required.
## Guidelines
- **Tool descriptions are documentation for agents.** Write them in English and say what the tool needs first (for example "call create_map first"), units, and what happens on failure. Add MCP annotations (`readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`).- **Fail with a useful message.** Throw an `Error` that tells the caller how to fix the call; the SDK returns it as a tool error.- **Never write to stdout** from the server: stdout carries the MCP protocol. Use stderr.- **Keep the output Tiled-correct.** Object positions follow [docs/map-format.md](docs/map-format.md#object-coordinates); check new output in Tiled or with `npm run preview`.- **No machine-specific paths.** Resolve paths through `tiled-mcp/src/paths.ts`.- **Paid calls stay opt-in.** Anything that spends money must be explicit and must not repeat work that already exists on disk.- **Do not rename theme keys**: they name the asset folders and appear in existing maps.
## Adding a theme
See [docs/themes.md](docs/themes.md#adding-a-theme).
## Pull requests
1. One topic per pull request.2. `npm run build && npm run smoke && npm run smoke:http` passes, and `npm run docs` shows no unexpected diff.3. Update the README or `docs/` when behaviour changes, and add a line to `CHANGELOG.md`.
By contributing you agree that your contribution is licensed under the [MIT license](LICENSE).1234567891011121314151617181920# Hosted mode of Tiled Map Builder: the web page and the MCP tools over HTTP on one port.# This is what runs on the Hugging Face Space (docs/hugging-face.md); it also runs anywhere:# docker build -t tiled-map-builder .# docker run -p 7860:7860 tiled-map-builder # then open http://localhost:7860# The image holds no token: every paid call uses the caller's own Hugging Face token.FROM node:22-bookworm-slim
WORKDIR /appCOPY package.json package-lock.json ./COPY tiled-mcp/package.json tiled-mcp/RUN npm ci --no-audit --no-fund
COPY . .RUN npm run build && npm prune --omit=dev --no-audit --no-fund
ENV NODE_ENV=production HOST=0.0.0.0 PORT=7860# Spaces run containers as uid 1000, which is the image's "node" user.USER nodeEXPOSE 7860CMD ["node", "tiled-mcp/dist/http.js"]123456789101112131415161718192021MIT License
Copyright (c) 2026 Sinien Rahma
Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.12345678910---title: Tiled Map Builderemoji: 👁colorFrom: pinkcolorTo: purplesdk: dockerpinned: false---Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308---title: Tiled Map Builderemoji: 🗺️colorFrom: indigocolorTo: graysdk: dockerapp_port: 7860pinned: falselicense: mitshort_description: Describe a dungeon, get an isometric Tiled maphf_oauth: truehf_oauth_expiration_minutes: 480hf_oauth_scopes:- inference-apitags:- mcp-server- tiled- map-generator- isometric- procedural-generation---<p align="center"><img src="docs/assets/banner.svg" alt="Tiled Map Builder MCP: an isometric crypt room built from the project's sprites" width="100%"></p><p align="center"><a href="https://nodejs.org"><img alt="Node.js 20.9+" src="https://img.shields.io/badge/Node.js-%E2%89%A520.9-5FA04E?logo=nodedotjs&logoColor=white"></a><a href="https://www.typescriptlang.org"><img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-5-3178C6?logo=typescript&logoColor=white"></a><a href="https://modelcontextprotocol.io"><img alt="Model Context Protocol" src="https://img.shields.io/badge/MCP-stdio%20%2B%20HTTP-8B5CF6?logo=modelcontextprotocol&logoColor=white"></a><a href="https://www.mapeditor.org"><img alt="Tiled 1.10+" src="https://img.shields.io/badge/Tiled-.tmj%20maps-5DA9E9"></a><a href="https://zod.dev"><img alt="Zod 4" src="https://img.shields.io/badge/Zod-4-3E67B1?logo=zod&logoColor=white"></a><a href="docs/sprite-generation.md"><img alt="Hugging Face FLUX (optional)" src="https://img.shields.io/badge/Hugging%20Face-FLUX%20(optional)-FFD21E?logo=huggingface&logoColor=black"></a><a href="docs/nemotron.md"><img alt="Works with NVIDIA Nemotron" src="https://img.shields.io/badge/NVIDIA-Nemotron%20ready-76B900?logo=nvidia&logoColor=white"></a><a href="LICENSE"><img alt="MIT license" src="https://img.shields.io/badge/license-MIT-blue"></a></p><p align="center"><b>An MCP server that lets AI agents build isometric <a href="https://www.mapeditor.org">Tiled</a> maps</b><br>rooms, corridors, doors, traps, chests and spawns, validated and saved as <code>.tmj</code> files you open in Tiled.</p><p align="center"><a href="https://huggingface.co/spaces/4math/tiled-map-builder"><img alt="Open in Hugging Face Spaces" src="https://huggingface.co/datasets/huggingface/badges/resolve/main/open-in-hf-spaces-md.svg"></a></p><p align="center"><a href="#-try-it-online">Try it online</a> ·<a href="#-quick-start">Quick start</a> ·<a href="docs/client-setup.md">Connect a client</a> ·<a href="docs/tools.md">Tool reference</a> ·<a href="docs/map-format.md">Map format</a> ·<a href="docs/themes.md">Themes</a> ·<a href="docs/troubleshooting.md">Troubleshooting</a></p>---## ✨ Features- 🗺️ **30 MCP tools** to create maps, paint tiles, generate rooms and corridors, and place doors, chests, traps, levers, stairs and spawns.- 🏰 **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.- 📐 **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.## 🤗 Try it onlineNo install: open the **[Tiled Map Builder Space](https://huggingface.co/spaces/4math/tiled-map-builder)**,sign in with Hugging Face, describe a map in any language and download a `.zip` that opens inTiled. The AI model (default `openai/gpt-oss-120b`) runs on **your** Hugging Face inferencecredits, usually a few cents per map; the Space owner pays nothing for your use and never seesyour token.AI agents can use the same Space as a remote MCP server with their own token:```bashclaude 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](docs/hugging-face.md)**.## 🖼️ Preview<p align="center"><img src="docs/images/preview-crypt-preset.png" alt="Crypt built with generate_crypt_layout: entrance, nave, two side chambers and a deep crypt, with player, enemy, chest and trap markers" width="85%"><br><sub>A 28x18 crypt from <code>generate_crypt_layout</code> plus a few <code>place_*</code> calls.Markers: <b>P</b> player, <b>E</b> enemy, <b>D</b> door, <b>C</b> chest, <b>T</b> trap. Rendered with <code>npm run preview</code>.</sub></p><p align="center"><img src="docs/images/preview-ice-fortress.png" alt="64x64 ice fortress sample map" width="49%"><img src="docs/images/preview-aquatic-cavern.png" alt="64x64 flooded cavern sample map" width="49%"><br><sub>Sample maps in <a href="maps/"><code>maps/</code></a>: an ice fortress and a flooded cavern, both 64x64.</sub></p>## 🧱 Tech stack| | Technology | Role in this project ||---|---|---|| <img src="https://cdn.simpleicons.org/modelcontextprotocol/8B5CF6" width="22" alt=""> | [Model Context Protocol](https://modelcontextprotocol.io) | How agents discover and call the map tools (stdio locally, Streamable HTTP when hosted) || <img src="https://cdn.simpleicons.org/typescript/3178C6" width="22" alt=""> | [TypeScript](https://www.typescriptlang.org) | Server source in `tiled-mcp/src` || <img src="https://cdn.simpleicons.org/nodedotjs/5FA04E" width="22" alt=""> | [Node.js](https://nodejs.org) 20.9+ | Runtime for the server and the scripts || <img src="https://cdn.simpleicons.org/zod/3E67B1" width="22" alt=""> | [Zod](https://zod.dev) | Validates every tool input and generates the JSON schemas agents see || 🗺️ | [Tiled](https://www.mapeditor.org) | Map editor that opens the generated `.tmj` files || <img src="https://cdn.simpleicons.org/huggingface/FFD21E" width="22" alt=""> | [Hugging Face Inference Providers](https://huggingface.co/docs/inference-providers) | The hosted page's AI model (open LLMs with tool calling) and optional FLUX.1-dev sprites, billed to each user || <img src="https://cdn.simpleicons.org/huggingface/FFD21E" width="22" alt=""> | [Hugging Face Spaces](https://huggingface.co/docs/hub/spaces) | Hosts the web page and remote MCP endpoint (Docker Space with "Sign in with Hugging Face") || <img src="https://cdn.simpleicons.org/docker/2496ED" width="22" alt=""> | [Docker](https://www.docker.com) | Image of the hosted mode, used by the Space and for self-hosting || 🖼️ | [sharp](https://sharp.pixelplumbing.com) | Background removal and resizing of generated sprites, PNG previews || <img src="https://cdn.simpleicons.org/nvidia/76B900" width="22" alt=""> | [NVIDIA Nemotron](https://build.nvidia.com) | One of the agent models this server was designed and tested with |## 🚀 Quick start**Requirements**: [Node.js](https://nodejs.org) 20.9 or newer and git. [Tiled](https://www.mapeditor.org) is optional, to view and edit the maps.```bashgit clone https://github.com/4math2379/Tiled-MCP-Server.gitcd Tiled-MCP-Servernpm install # installs the server workspacenpm run build # compiles tiled-mcp/src to tiled-mcp/distnpm run smoke # optional: 38 offline end-to-end checks```Then register the server with your MCP client. With **Claude Code**, from the repository folder:```bashclaude 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):```json{"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](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:```bashnpm run preview -- maps/crypt-chapel.tmj```## 🧭 How it works```mermaidflowchart LRA["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](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` || Validation and export | `validate_map` · `export_json` · `save_to_disk` || Sprites | `preview_sprite_prompt` (free) · `generate_tile_sprite` 💸 · `generate_theme_sprite_set` 💸 · `override_tile_image` |Full parameters, generated from the server itself: **[docs/tools.md](docs/tools.md)**.## 🎨 Themes| Theme key | Display name | Setting | Sprites ||---|---|---|---|| `CRYPT` | Crypte mournevaldienne | Burial vaults, cracked flagstones, poison vents | ✅ || `CASTLE` | Castel Von Drak | Black marble halls, throne room, grand stairs | ✅ || `WEREWOLF_DEN` | Tanière de loups-garous | Damp caves, bones, blood pools | ✅ || `TAVERN_BLOOD_PRINCE` | Auberge du Prince Sanglant | Tavern interior, oak tables, hearth | ✅ || `VILLAGE` | Village mournevaldien | Wet cobblestones, half-timbered houses, well | ✅ || `HAUNTED_FOREST` | Forêt de Drakenmark | Dark undergrowth, brambles, parasitic mist | ✅ || `MAUSOLEUM` | Mausolée | Veined marble, fallen-angel statues, urns | ✅ || `BLOOD_TOMB` | Tombeau de sang | Ritual sanctuary, bleeding runes, altar | ✅ || `AQUATIC` | Eaux Croupies | Stagnant water, water lilies, sunken ruins | ✅ || `GLACIAIRE` | Toundra Glacée | Black ice, frozen statues, thin ice | ✅ || `INONDE` | Cote Inondee | Drowned city, kelp, deep currents | ✅ || `ELECTRONIQUE` | Reseau Electronique | Circuit boards, cables, mainframe cores | ✅ || `VOLCAN` | Pente Volcanique | Lava flows, obsidian, ash | ➖ || `FORET` | Foret Sombre | Twisted woods, quicksand, standing stones | ➖ || `HIVER` | Plaine Enneigee | Snowfields, frozen lakes, cairns | ➖ || `PRINTEMPS` | Prairie Printaniere | Flowering meadows, streams, maypole | ➖ || `ETE` | Plaine Estivale | Golden wheat, cracked earth, scarecrows | ➖ || `AUTOMNE` | Foret d'Automne | Russet leaves, bog mire, mushrooms | ➖ || `DESOLATION` | Terre Desolee | Ash pits, charred trees, ruins | ➖ || `FUTURISTE` | Cite Futuriste | 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](docs/sprite-generation.md).<p align="center"><img src="assets/crypt/walkable_floor.png" alt="crypt floor" height="40"><img src="assets/crypt/wall.png" alt="crypt wall" height="64"><img src="assets/crypt/obstacle_decor.png" alt="sarcophagus" height="64"><img src="assets/castle/obstacle_decor.png" alt="throne" height="64"><img src="assets/castle/stairs.png" alt="castle stairs" height="64"><img src="assets/werewolf_den/obstacle_decor.png" alt="boulder" height="64"><img src="assets/aquatic/hazard_primary.png" alt="deep water" height="64"><img src="assets/glaciaire/obstacle_decor.png" alt="frozen statue" height="64"><img src="assets/electronique/obstacle_decor.png" alt="mainframe core" height="64"><img src="assets/mausoleum/obstacle_decor.png" alt="fallen angel statue" height="64"></p>More about each theme's roles and hazards: **[docs/themes.md](docs/themes.md)**.## 🤖 Agent skill and prompt[`skills/map-builder/SKILL.md`](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`.## ⚙️ ConfigurationNothing is required for map building. Optional settings go in `tiled-mcp/.env` (copy [`tiled-mcp/.env.example`](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](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`:```bashnode scripts/gen-theme-set.mjs VOLCAN --dry-run # free: shows what would be generatednode scripts/gen-theme-set.mjs VOLCAN --yes # paid: about 10 sprites```Read **[docs/sprite-generation.md](docs/sprite-generation.md)** before you start.## 🟩 Using it with NVIDIA NemotronThe 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](docs/nemotron.md)**.## 🗂️ Repository layout```tiled-mcp/ MCP server (TypeScript): src/, package.json, tsconfig.json, .env.examplesrc/tools/ tool groups: lifecycle, paint, procedural, layout-presets, objects, export, generationsrc/themes/ 20 theme definitions and the FLUX prompt catalogsrc/http.ts hosted mode: web page, web AI agent, MCP over HTTP, Hugging Face sign-inweb/ the hosted web page (HTML, CSS, JS)huggingface/ Space card and the script that publishes this repository to the SpaceDockerfile image of the hosted mode (used by the Space)skills/map-builder/ agent skill, also served as the map_builder MCP promptmaps/ sample .tmj maps (default output folder of save_to_disk)assets/ isometric sprites per theme: <theme>/<role>.pngscripts/ example map scripts, preview renderer, sprite batch, docs generator, smoke testdocs/ documentation, banner and preview images```## 🛠️ Scripts| Command | What it does ||---|---|| `npm run build` | Compile the server || `npm run smoke` | Start the server and run 38 offline end-to-end checks || `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](https://github.com/modelcontextprotocol/inspector) || `npm run preview -- <map.tmj>` | Render a map to PNG without Tiled || `npm run examples` | Rebuild the three scripted sample maps 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) |## 🤝 ContributingIssues and pull requests are welcome. See **[CONTRIBUTING.md](CONTRIBUTING.md)** for the development loop and **[CHANGELOG.md](CHANGELOG.md)** for what changed.## 📄 License[MIT](LICENSE). 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.
.dockerignoreAdded+8
.gitattributes+4
.gitignoreAdded+10
CHANGELOG.mdAdded+94
CONTRIBUTING.mdAdded+46
DockerfileAdded+20
LICENSEAdded+21
README.md+302-4
assets/aquatic/decoration_minor.pngAdded

assets/aquatic/difficult_terrain.pngAdded

assets/aquatic/door_closed.pngAdded

assets/aquatic/hazard_primary.pngAdded

assets/aquatic/obstacle_decor.pngAdded

assets/aquatic/stairs.pngAdded

assets/aquatic/walkable_floor.pngAdded

assets/aquatic/walkable_floor_alt.pngAdded

assets/aquatic/wall.pngAdded

assets/aquatic/wall_corner.pngAdded

assets/blood_tomb/decoration_minor.pngAdded

assets/blood_tomb/difficult_terrain.pngAdded

assets/blood_tomb/door_closed.pngAdded

assets/blood_tomb/hazard_primary.pngAdded

assets/blood_tomb/obstacle_decor.pngAdded

assets/blood_tomb/walkable_floor.pngAdded

assets/blood_tomb/walkable_floor_alt.pngAdded

assets/blood_tomb/wall.pngAdded

assets/castle/decoration_minor.pngAdded

assets/castle/decoration_minor__fine_china.pngAdded

assets/castle/difficult_terrain.pngAdded

assets/castle/door_closed.pngAdded

assets/castle/obstacle_decor.pngAdded

assets/castle/obstacle_decor__banquet_table.pngAdded

assets/castle/stairs.pngAdded

assets/castle/walkable_floor.pngAdded

assets/castle/walkable_floor_alt.pngAdded

assets/castle/wall.pngAdded

assets/castle/wall_corner.pngAdded

assets/crypt/decoration_minor.pngAdded

assets/crypt/difficult_terrain.pngAdded

assets/crypt/door_closed.pngAdded

assets/crypt/hazard_primary.pngAdded

assets/crypt/obstacle_decor.pngAdded

assets/crypt/stairs.pngAdded

assets/crypt/walkable_floor.pngAdded

assets/crypt/walkable_floor_alt.pngAdded

assets/crypt/wall.pngAdded

assets/crypt/wall_corner.pngAdded

assets/electronique/decoration_minor.pngAdded

assets/electronique/difficult_terrain.pngAdded

assets/electronique/door_closed.pngAdded
