Spaces:
Running
Running
File size: 4,583 Bytes
6ed91fb 950662b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | # Connect an MCP client
The server speaks MCP over **stdio**: the client starts `node tiled-mcp/dist/index.js` and
talks to it through stdin and stdout. Build it once first:
```bash
npm install
npm run build
```
Every example below uses the name **`tiled-map-builder`** and a placeholder path. Replace
`/absolute/path/to/Tiled-MCP-Server` with the folder you cloned. On Windows, write paths with
forward slashes (`C:/Users/me/Tiled-MCP-Server/...`) or doubled backslashes in JSON.
Optional settings go in an `env` block or in `tiled-mcp/.env`; see
[configuration.md](configuration.md). Restart the client after changing its configuration.
> **No install?** The same tools run as a remote MCP server on Hugging Face. Give your client
> the URL `https://4math-tiled-map-builder.hf.space/mcp` and the header
> `Authorization: Bearer hf_YOUR_TOKEN` instead of a command; see
> [hugging-face.md](hugging-face.md#connect-an-ai-agent-to-the-mcp-endpoint).
## Claude Code
From the repository folder:
```bash
claude mcp add tiled-map-builder -- node "$(pwd)/tiled-mcp/dist/index.js"
```
Add `--scope project` to write a shareable `.mcp.json` in the current project, or
`--scope user` to make it available everywhere. The equivalent `.mcp.json`:
```json
{
"mcpServers": {
"tiled-map-builder": {
"command": "node",
"args": ["/absolute/path/to/Tiled-MCP-Server/tiled-mcp/dist/index.js"]
}
}
}
```
Install the skill so `/map-builder` is available:
```bash
mkdir -p ~/.claude/skills
cp -r skills/map-builder ~/.claude/skills/
```
The tools appear as `mcp__tiled-map-builder__<tool>`. Check the connection with `/mcp`.
## Claude Desktop
Edit `claude_desktop_config.json` (Settings, Developer, Edit Config):
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
```json
{
"mcpServers": {
"tiled-map-builder": {
"command": "node",
"args": ["/absolute/path/to/Tiled-MCP-Server/tiled-mcp/dist/index.js"]
}
}
}
```
Use the `map_builder` prompt from the attachment menu to load the workflow.
## Cursor
`~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (one project):
```json
{
"mcpServers": {
"tiled-map-builder": {
"command": "node",
"args": ["/absolute/path/to/Tiled-MCP-Server/tiled-mcp/dist/index.js"]
}
}
}
```
## VS Code (GitHub Copilot agent mode)
`.vscode/mcp.json` in your workspace:
```json
{
"servers": {
"tiled-map-builder": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/Tiled-MCP-Server/tiled-mcp/dist/index.js"]
}
}
}
```
## Windsurf
`~/.codeium/windsurf/mcp_config.json`:
```json
{
"mcpServers": {
"tiled-map-builder": {
"command": "node",
"args": ["/absolute/path/to/Tiled-MCP-Server/tiled-mcp/dist/index.js"]
}
}
}
```
## Zed
In Zed's `settings.json`:
```json
{
"context_servers": {
"tiled-map-builder": {
"command": "node",
"args": ["/absolute/path/to/Tiled-MCP-Server/tiled-mcp/dist/index.js"],
"env": {}
}
}
}
```
### Windows with the server inside WSL
If Node is installed in WSL rather than on Windows, let `wsl.exe` start it. Environment
variables can be passed through `env`:
```json
{
"context_servers": {
"tiled-map-builder": {
"command": "wsl.exe",
"args": ["-e", "env", "TILED_MAPS_DIR=D:/maps", "node", "/mnt/d/Tiled-MCP-Server/tiled-mcp/dist/index.js"]
}
}
}
```
Windows-style paths such as `D:/maps` are translated to `/mnt/d/maps` by the server.
## OpenCode
In `opencode.json`:
```json
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"tiled-map-builder": {
"type": "local",
"command": ["node", "/absolute/path/to/Tiled-MCP-Server/tiled-mcp/dist/index.js"],
"enabled": true
}
}
}
```
To run it with NVIDIA Nemotron, see [nemotron.md](nemotron.md).
## Any other client
Any MCP client that can start a stdio server works. It needs:
| Field | Value |
|---|---|
| command | `node` |
| args | `<repo>/tiled-mcp/dist/index.js` |
| env | optional, see [configuration.md](configuration.md) |
## Test without an agent: MCP Inspector
```bash
npm run inspect
```
This opens the official [MCP Inspector](https://github.com/modelcontextprotocol/inspector) in
your browser, connected to the server. You can list the tools, call `create_map`, then
`generate_crypt_layout`, then `save_to_disk`, and open the file in Tiled.
For an automated check, `npm run smoke` runs 96 end-to-end checks without any network access.
|