@lzimul/minecraft-mcp 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +219 -168
- package/SECURITY.md +38 -21
- package/build/config/server-info.js +3 -2
- package/build/config/world-limits.js +4 -1
- package/build/data/entities.js +1581 -0
- package/build/enums/entity-kind.enum.js +5 -0
- package/build/enums/inventory-section.enum.js +5 -0
- package/build/index.js +4 -3
- package/build/interfaces/entity-inventory.interface.js +1 -0
- package/build/interfaces/entity-type.interface.js +1 -0
- package/build/interfaces/entity.interface.js +1 -0
- package/build/resources/dimension-resources.js +23 -6
- package/build/resources/entity-resources.js +17 -0
- package/build/resources/index.js +2 -0
- package/build/schemas/coordinate-schema.js +5 -0
- package/build/schemas/dimension-schema.js +1 -0
- package/build/schemas/entity-schema.js +95 -0
- package/build/tools/block-tools.js +14 -23
- package/build/tools/entity-tools.js +325 -0
- package/build/tools/index.js +4 -0
- package/build/tools/result.js +3 -5
- package/build/tools/world-tools.js +139 -0
- package/build/utils/logger.js +53 -0
- package/build/world/block-spec.js +6 -6
- package/build/world/block-states.js +23 -4
- package/build/world/entity-inventory.js +84 -0
- package/build/world/item-spec.js +25 -0
- package/build/world/simulated-dimension.js +187 -13
- package/build/world/stores/file-world-store.js +67 -20
- package/build/world/stores/memory-world-store.js +13 -5
- package/build/world/stores/serialized-block.js +9 -14
- package/build/world/stores/serialized-entity.js +74 -0
- package/build/world/world.js +33 -1
- package/lib/config/server-info.d.ts.map +1 -1
- package/lib/config/world-limits.d.ts +3 -0
- package/lib/config/world-limits.d.ts.map +1 -1
- package/lib/data/entities.d.ts +5 -0
- package/lib/data/entities.d.ts.map +1 -0
- package/lib/enums/entity-kind.enum.d.ts +5 -0
- package/lib/enums/entity-kind.enum.d.ts.map +1 -0
- package/lib/enums/inventory-section.enum.d.ts +5 -0
- package/lib/enums/inventory-section.enum.d.ts.map +1 -0
- package/lib/interfaces/entity-inventory.interface.d.ts +9 -0
- package/lib/interfaces/entity-inventory.interface.d.ts.map +1 -0
- package/lib/interfaces/entity-type.interface.d.ts +8 -0
- package/lib/interfaces/entity-type.interface.d.ts.map +1 -0
- package/lib/interfaces/entity.interface.d.ts +17 -0
- package/lib/interfaces/entity.interface.d.ts.map +1 -0
- package/lib/interfaces/world-store.interface.d.ts +7 -2
- package/lib/interfaces/world-store.interface.d.ts.map +1 -1
- package/lib/resources/dimension-resources.d.ts.map +1 -1
- package/lib/resources/entity-resources.d.ts +3 -0
- package/lib/resources/entity-resources.d.ts.map +1 -0
- package/lib/resources/index.d.ts.map +1 -1
- package/lib/schemas/coordinate-schema.d.ts +5 -0
- package/lib/schemas/coordinate-schema.d.ts.map +1 -1
- package/lib/schemas/dimension-schema.d.ts +1 -0
- package/lib/schemas/dimension-schema.d.ts.map +1 -1
- package/lib/schemas/entity-schema.d.ts +134 -0
- package/lib/schemas/entity-schema.d.ts.map +1 -0
- package/lib/tools/block-tools.d.ts.map +1 -1
- package/lib/tools/entity-tools.d.ts +4 -0
- package/lib/tools/entity-tools.d.ts.map +1 -0
- package/lib/tools/index.d.ts.map +1 -1
- package/lib/tools/result.d.ts +2 -6
- package/lib/tools/result.d.ts.map +1 -1
- package/lib/tools/world-tools.d.ts +4 -0
- package/lib/tools/world-tools.d.ts.map +1 -0
- package/lib/utils/logger.d.ts +3 -0
- package/lib/utils/logger.d.ts.map +1 -0
- package/lib/world/block-states.d.ts +2 -0
- package/lib/world/block-states.d.ts.map +1 -1
- package/lib/world/entity-inventory.d.ts +16 -0
- package/lib/world/entity-inventory.d.ts.map +1 -0
- package/lib/world/item-spec.d.ts +10 -0
- package/lib/world/item-spec.d.ts.map +1 -0
- package/lib/world/simulated-dimension.d.ts +29 -0
- package/lib/world/simulated-dimension.d.ts.map +1 -1
- package/lib/world/stores/file-world-store.d.ts +3 -3
- package/lib/world/stores/file-world-store.d.ts.map +1 -1
- package/lib/world/stores/memory-world-store.d.ts +3 -4
- package/lib/world/stores/memory-world-store.d.ts.map +1 -1
- package/lib/world/stores/serialized-block.d.ts.map +1 -1
- package/lib/world/stores/serialized-entity.d.ts +24 -0
- package/lib/world/stores/serialized-entity.d.ts.map +1 -0
- package/lib/world/world.d.ts +3 -0
- package/lib/world/world.d.ts.map +1 -1
- package/package.json +113 -109
package/README.md
CHANGED
|
@@ -1,168 +1,219 @@
|
|
|
1
|
-
# lZiMUl Minecraft MCP
|
|
2
|
-
|
|
3
|
-
Minecraft Model Context Protocol (MCP) server. It exposes the complete Minecraft registry (Java Edition data) as MCP resources and provides tools to read and write blocks in persisted, per-dimension worlds. Requires Node.js 22 or newer.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- All Minecraft blocks and
|
|
8
|
-
- Block lookup and placement tools backed by simulated dimensions (Overworld, The Nether, The End), each with its own isolated world state and height range
|
|
9
|
-
- Block states are supported everywhere: `minecraft:oak_stairs[facing=south,half=bottom]`
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
27
|
-
`setBlock`
|
|
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
|
-
|
|
1
|
+
# lZiMUl Minecraft MCP
|
|
2
|
+
|
|
3
|
+
Minecraft Model Context Protocol (MCP) server. It exposes the complete Minecraft registry (Java Edition data) as MCP resources and provides tools to read and write blocks, inspect dimensions, create entities and players, and manage inventories in persisted, per-dimension worlds. Requires Node.js 22 or newer.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- All Minecraft blocks, items and entity types exposed as MCP resources with full properties (name, hardness, blast resistance, durability, enchantment categories, light level, collision box, entity dimensions, category, and more)
|
|
8
|
+
- Block lookup and placement tools backed by simulated dimensions (Overworld, The Nether, The End), each with its own isolated world state and height range
|
|
9
|
+
- Block states are supported everywhere: `minecraft:oak_stairs[facing=south,half=bottom]`
|
|
10
|
+
- Dimension tools for metadata and paginated access to every placed block
|
|
11
|
+
- Entity and player tools with a 9-slot hotbar and 27-slot backpack per entity, managed through `getInventory` and `setInventory`
|
|
12
|
+
- World state (blocks, entities, players and inventories) is persisted per dimension as JSON and survives restarts
|
|
13
|
+
- log4js logging to stderr with chalk colours (error red, warn yellow, info green); stdout stays clean for the MCP transport
|
|
14
|
+
- Structured tool output (`outputSchema` / `structuredContent`) plus human readable text
|
|
15
|
+
- Every failure path returns a readable message instead of an unhandled exception
|
|
16
|
+
- Tool annotations for safe client automation
|
|
17
|
+
|
|
18
|
+
## Protocol
|
|
19
|
+
|
|
20
|
+
The server implements the MCP `2026-07-28` revision. Modern clients open a session with `server/discover` and carry the per-request envelope in every request's `params._meta` (`io.modelcontextprotocol/protocolVersion`, `io.modelcontextprotocol/clientCapabilities`, and optionally `io.modelcontextprotocol/clientInfo`). Responses use the modern result shape (`resultType`, server identity under `_meta['io.modelcontextprotocol/serverInfo']`). Legacy clients that open with `initialize` are still served through the 2025-era handshake.
|
|
21
|
+
|
|
22
|
+
## Tools
|
|
23
|
+
|
|
24
|
+
| Tool | Description |
|
|
25
|
+
| -------------------- | ----------------------------------------------------------------------------------------- |
|
|
26
|
+
| `getBlock` | Get the block (and its states) at coordinates in a dimension (defaults to `overworld`) |
|
|
27
|
+
| `setBlock` | Place a block with optional states in a dimension and return the replaced block |
|
|
28
|
+
| `getDimension` | Get dimension metadata, block count, entity count and player count |
|
|
29
|
+
| `getDimensionBlocks` | Page through every placed (non-air) block in a dimension, sorted by coordinates |
|
|
30
|
+
| `getItem` | Look up item properties by id (`minecraft:diamond_sword` or `diamond_sword`) |
|
|
31
|
+
| `createEntity` | Create a non-player entity with an empty hotbar and backpack |
|
|
32
|
+
| `getEntity` | Get an entity by UUID, including position, dimension and full inventory |
|
|
33
|
+
| `createPlayer` | Create a uniquely named player with an empty hotbar and backpack |
|
|
34
|
+
| `getPlayer` | Get a player by name (case-insensitive), including position, dimension and full inventory |
|
|
35
|
+
| `getInventory` | Read the 9 hotbar slots and 27 backpack slots of an entity or player |
|
|
36
|
+
| `setInventory` | Set or clear one hotbar/backpack slot of an entity or player |
|
|
37
|
+
|
|
38
|
+
`setBlock` accepts both the full form (`minecraft:oak_stairs[facing=south,half=bottom]`) and the short form (`oak_stairs[facing=south]`). Setting `minecraft:air` removes the block; air cannot carry states.
|
|
39
|
+
|
|
40
|
+
`getDimensionBlocks` is paginated because a dimension can hold up to 250,000 placed blocks. `limit` defaults to 1,000 and is capped at 10,000; `offset` skips rows. Rows are sorted by `x`, `y`, `z` and include the block id, display name and states.
|
|
41
|
+
|
|
42
|
+
### Entities, players and inventories
|
|
43
|
+
|
|
44
|
+
- Entity type ids come from the generated registry (`lzimul://minecraft/entities`), for example `minecraft:zombie` or `zombie`. `createEntity` rejects `minecraft:player`; use `createPlayer` for players.
|
|
45
|
+
- Players are addressed by name, case-insensitively, and names are unique across all dimensions. Entity and player UUIDs come from the creation response.
|
|
46
|
+
- Every entity and player has a 9-slot hotbar plus a 27-slot backpack (36 slots total). Slots are zero-based within their section.
|
|
47
|
+
- `getInventory` and `setInventory` accept either an entity UUID or a player name. `setInventory` requires `section` (`hotbar` or `inventory`, default `inventory`), `slot`, `item` and `count`.
|
|
48
|
+
- `count` must not exceed the item's stack size. Set the item to `minecraft:air` or the count to `0` to clear a slot. Empty slots are returned as `null`.
|
|
49
|
+
- A dimension holds at most 10,000 entities and players combined. Entity names are limited to 64 characters and player names to 32 characters (`A-Z`, `a-z`, `0-9`, `_`).
|
|
50
|
+
|
|
51
|
+
## Persistence
|
|
52
|
+
|
|
53
|
+
World snapshots are stored as one JSON document per dimension, so the dimensions never share a file:
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
world-data/
|
|
57
|
+
overworld.json
|
|
58
|
+
the_nether.json
|
|
59
|
+
the_end.json
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Each snapshot looks like this:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"format": "lzimul:minecraft/dimension",
|
|
67
|
+
"dimension": "minecraft:overworld",
|
|
68
|
+
"updatedAt": "2026-01-01T00:00:00.000Z",
|
|
69
|
+
"modifiedBlockCount": 1,
|
|
70
|
+
"entityCount": 1,
|
|
71
|
+
"blocks": [
|
|
72
|
+
{
|
|
73
|
+
"x": 0,
|
|
74
|
+
"y": 64,
|
|
75
|
+
"z": 0,
|
|
76
|
+
"block": "minecraft:oak_stairs",
|
|
77
|
+
"states": { "facing": "south", "half": "bottom" }
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
"entities": [
|
|
81
|
+
{
|
|
82
|
+
"id": "0f0f2f4e-7d5a-4d8e-9a3b-2f6c1d8e4a10",
|
|
83
|
+
"kind": "player",
|
|
84
|
+
"type": "minecraft:player",
|
|
85
|
+
"name": "Steve",
|
|
86
|
+
"x": 1,
|
|
87
|
+
"y": 64,
|
|
88
|
+
"z": 0,
|
|
89
|
+
"createdAt": "2026-01-01T00:00:00.000Z"
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
- The whole dimension (blocks, entities and players) is loaded once at startup and kept in memory; mutations are written back debounced and atomically (temporary file + rename).
|
|
96
|
+
- `setBlock`, `createEntity`, `createPlayer` and `setInventory` await the write, so a successful response means the change is durably stored. If persisting fails the tool returns an error instead of pretending success.
|
|
97
|
+
- Parallel tool calls share a single in-flight snapshot write instead of writing one full file per call, so building with many simultaneous `setBlock` calls stays fast.
|
|
98
|
+
- Unmodified coordinates are air; only placed blocks are stored. Placing air removes the coordinate from the snapshot.
|
|
99
|
+
- Empty state maps are omitted from the file to keep snapshots small.
|
|
100
|
+
- Entity and player inventories are omitted when they are completely empty. When present, `inventory.hotbar` has 9 entries and `inventory.inventory` has 27 entries; each entry is `{ "item": "minecraft:diamond_sword", "count": 1 }` or `null`.
|
|
101
|
+
- Player names are not stored in a separate index: the player name index is rebuilt from the snapshots when the world loads. If two dimension files contain the same case-insensitive name, the first dimension wins and the duplicate player is dropped with a warning.
|
|
102
|
+
- Snapshots are written as compact JSON (about half the bytes of pretty-printed JSON) with a trailing newline.
|
|
103
|
+
- Files written by format v1 (`lzimul-world/1`, no states) and v2 (`lzimul-world/2`, no entities) still load; new files use `lzimul:minecraft/dimension` and include an `entities` array. A missing `entities` array simply means the dimension has no entities.
|
|
104
|
+
- Malformed block or entity entries are skipped without discarding the rest of the dimension. An entity's dimension always comes from the file it was loaded from, so an entry cannot claim to live in another dimension.
|
|
105
|
+
- A dimension file is created on its first write; untouched dimensions stay empty.
|
|
106
|
+
|
|
107
|
+
### Configuration
|
|
108
|
+
|
|
109
|
+
| Variable | Default | Description |
|
|
110
|
+
| ------------------- | -------------- | ------------------------------------------------------- |
|
|
111
|
+
| `MCP_WORLD_STORAGE` | `file` | `file` for JSON snapshots, `memory` for volatile state |
|
|
112
|
+
| `MCP_WORLD_DIR` | `./world-data` | Directory that holds the per-dimension snapshots |
|
|
113
|
+
| `MCP_LOG_LEVEL` | `info` | log4js level: `trace`, `debug`, `info`, `warn`, `error` |
|
|
114
|
+
|
|
115
|
+
A corrupt or oversized snapshot is moved aside as `<dimension>.json.corrupt-<uuid>` and the dimension starts empty, so a bad file never blocks startup.
|
|
116
|
+
|
|
117
|
+
### Logging
|
|
118
|
+
|
|
119
|
+
Server logs use [log4js](https://log4js-node.github.io/log4js-node/) with a chalk-based layout. `error`/`fatal` are red, `warn` yellow, `info` green, `debug` cyan and `trace` blue. Chalk disables ANSI colours automatically when the output is redirected to a non-colour terminal.
|
|
120
|
+
|
|
121
|
+
Logs are written to **stderr**, never stdout: stdout is the MCP JSON-RPC transport, so mixing log lines into it would corrupt the protocol stream. `MCP_LOG_LEVEL` controls the verbosity (default `info`). Developer scripts use a small stdout logger (`scripts/logger.mjs`) with the same colours, so test output stays readable.
|
|
122
|
+
|
|
123
|
+
### Storage backends
|
|
124
|
+
|
|
125
|
+
State is accessed through `IWorldStore` (`src/interfaces/world-store.interface.ts`):
|
|
126
|
+
|
|
127
|
+
| Backend | Used by | Notes |
|
|
128
|
+
| ------------------ | ------------------- | ----------------------------------------------------- |
|
|
129
|
+
| `FileWorldStore` | stdio (`npm start`) | Atomic per-dimension JSON files under `MCP_WORLD_DIR` |
|
|
130
|
+
| `MemoryWorldStore` | tests, `memory` | Volatile; useful for throwaway sessions |
|
|
131
|
+
|
|
132
|
+
## Resources
|
|
133
|
+
|
|
134
|
+
| URI | Description |
|
|
135
|
+
| -------------------------------------- | ---------------------------------------------------- |
|
|
136
|
+
| `lzimul://minecraft/blocks` | Block index |
|
|
137
|
+
| `lzimul://minecraft/blocks/{name}` | Single block properties |
|
|
138
|
+
| `lzimul://minecraft/items` | Item index |
|
|
139
|
+
| `lzimul://minecraft/items/{name}` | Single item properties |
|
|
140
|
+
| `lzimul://minecraft/entities` | Entity type index (157 types, including `player`) |
|
|
141
|
+
| `lzimul://minecraft/entities/{name}` | Single entity type properties |
|
|
142
|
+
| `lzimul://minecraft/dimensions` | Dimension index with block, entity and player counts |
|
|
143
|
+
| `lzimul://minecraft/dimensions/{type}` | Single dimension state including blocks and entities |
|
|
144
|
+
|
|
145
|
+
Placed blocks in the dimension resources include a `states` object. If a resource read fails, the server returns a JSON document with an `error` field instead of dropping the request. The dimensions index stays small on purpose: it reports per-dimension metadata, `modifiedBlockCount`, `entityCount` and `playerCount`, while `lzimul://minecraft/dimensions/{type}` returns the placed blocks plus the full entity/player list. In total the server registers 2,838 resources: every block, item and entity type, the indexes, and the seven dimension-related resources.
|
|
146
|
+
|
|
147
|
+
## Security
|
|
148
|
+
|
|
149
|
+
- Tool input is validated with Zod: coordinates are bounded, dimensions come from an enum, and ids are limited in length.
|
|
150
|
+
- Block and item ids are resolved against the generated registries; unknown blocks, items and entity types and unknown namespaces are rejected.
|
|
151
|
+
- State names and values are restricted to `[a-z0-9_]` / `[a-z0-9_.-]`, 64 characters each, and reserved keys (`__proto__`, `constructor`, `prototype`) are rejected to rule out prototype pollution.
|
|
152
|
+
- Inventory input is validated too: the section and slot must be in range, the item must exist, and the count must fit the item's stack size. `minecraft:air` or count `0` clears a slot.
|
|
153
|
+
- Each dimension holds at most 250,000 modified blocks and 10,000 entities/players. Entity names are capped at 64 characters, player names at 32 characters, and player names are case-insensitively unique across all dimensions. The file store refuses to load or write a snapshot over 128 MiB, so an oversized world fails the tool call instead of producing a file that would be quarantined on restart.
|
|
154
|
+
- Snapshot writes are atomic, corrupt files are quarantined with a UUID suffix, and malformed block or entity entries are skipped while the rest of the world loads. Entity dimensions are taken from the snapshot file rather than trusted from the entry.
|
|
155
|
+
- Run `npm audit` after dependency changes. The dependency tree currently reports no vulnerabilities; the `katex` override keeps the markdown lint toolchain patched.
|
|
156
|
+
|
|
157
|
+
## Performance
|
|
158
|
+
|
|
159
|
+
Measured on Node.js 26 (results vary by hardware):
|
|
160
|
+
|
|
161
|
+
- Startup, including registry import and 2,838 resource registrations: about 0.4 s.
|
|
162
|
+
- 300 concurrent `setBlock` tool calls: about 70 ms end-to-end, because parallel flushes share in-flight snapshot writes instead of writing the file 300 times.
|
|
163
|
+
- 20,000 persisted blocks: about 1.1 MiB of compact JSON, ~25 ms to save and ~24 ms to load.
|
|
164
|
+
- In-memory block, entity and inventory reads/writes are O(1) map operations; only the debounced snapshot write is proportional to the number of modified blocks and entities.
|
|
165
|
+
- `getDimensionBlocks` pages a cached, coordinate-sorted block array instead of re-sorting the world on every call.
|
|
166
|
+
|
|
167
|
+
## Project Structure
|
|
168
|
+
|
|
169
|
+
```text
|
|
170
|
+
src/
|
|
171
|
+
index.ts Entry point
|
|
172
|
+
app/ Server assembly
|
|
173
|
+
config/ Server metadata, dimensions, storage, world limits
|
|
174
|
+
data/ Generated registry data (blocks, items, entities, version)
|
|
175
|
+
enums/ Enumerations (EBoundingBox, EIconTheme, EDimensionType, EEntityKind, EInventorySection)
|
|
176
|
+
interfaces/ Interfaces (IBlock, IItem, IEntityType, IEntity, IEntityInventory, IDimension, IPlacedBlock, IWorldSnapshot, IWorldStore)
|
|
177
|
+
resources/ Block, item, entity and dimension resource registration
|
|
178
|
+
schemas/ Zod schemas and converters (blocks, entities, inventories)
|
|
179
|
+
tools/ Block, dimension, entity, player and inventory tools
|
|
180
|
+
utils/ Shared helpers (error messages, log4js + chalk logger)
|
|
181
|
+
world/ Simulated dimension state, entity inventory and item specs
|
|
182
|
+
stores/ IWorldStore implementations (file, memory) and serializers
|
|
183
|
+
scripts/
|
|
184
|
+
logger.mjs Coloured stdout logger for developer scripts
|
|
185
|
+
generate-data.mjs Regenerates src/data from minecraft-data
|
|
186
|
+
smoke-test.mjs End-to-end smoke test (blocks, dimensions, entities, inventories)
|
|
187
|
+
persistence-test.mjs Restart test for blocks, entities and inventories
|
|
188
|
+
error-test.mjs Error fallbacks, sanitizing and storage limit tests
|
|
189
|
+
stress-test.mjs Parallel write, coalescing and restart stress test
|
|
190
|
+
clean.mjs Removes build output
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Scripts
|
|
194
|
+
|
|
195
|
+
| Command | Description |
|
|
196
|
+
| ----------------------- | ----------------------------------------------------- |
|
|
197
|
+
| `npm run build` | Lint, compile and generate docs |
|
|
198
|
+
| `npm run dev` | Build then start the server |
|
|
199
|
+
| `npm start` | Start the server (stdio) |
|
|
200
|
+
| `npm test` | Run the smoke, persistence, security and stress tests |
|
|
201
|
+
| `npm run test:stress` | Run only the parallel write stress test |
|
|
202
|
+
| `npm run generate-data` | Regenerate registry data (see below) |
|
|
203
|
+
| `npm run clean` | Remove build output |
|
|
204
|
+
| `npm run lint` | Lint without modifying files |
|
|
205
|
+
| `npm run lint:fix` | Lint and auto-fix |
|
|
206
|
+
|
|
207
|
+
## Data
|
|
208
|
+
|
|
209
|
+
Registry data is generated from [PrismarineJS/minecraft-data](https://github.com/PrismarineJS/minecraft-data). To regenerate for a specific version:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
node scripts/generate-data.mjs <version> [blocks.json] [items.json] [entities.json]
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
When local JSON files are provided they are used directly, otherwise the data is fetched from GitHub. The fourth argument is optional and only needed for a custom entity registry; without it the entity list is fetched from the same minecraft-data release. The data version is exported as `MINECRAFT_DATA_VERSION` and used in all descriptions.
|
|
216
|
+
|
|
217
|
+
## License
|
|
218
|
+
|
|
219
|
+
MIT
|
package/SECURITY.md
CHANGED
|
@@ -1,21 +1,38 @@
|
|
|
1
|
-
# Security Policy
|
|
2
|
-
|
|
3
|
-
## Supported Versions
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
|
9
|
-
|
|
10
|
-
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
Only the latest `1.x` release line receives security fixes.
|
|
6
|
+
|
|
7
|
+
| Version | Supported |
|
|
8
|
+
| ------- | ------------------ |
|
|
9
|
+
| 1.0.x | :white_check_mark: |
|
|
10
|
+
| < 1.0 | :x: |
|
|
11
|
+
|
|
12
|
+
## Reporting a Vulnerability
|
|
13
|
+
|
|
14
|
+
Please do **not** open a public issue for security problems.
|
|
15
|
+
|
|
16
|
+
- Email: lZiMUl@lzimul.com
|
|
17
|
+
- Or use GitHub's private vulnerability reporting on
|
|
18
|
+
<https://github.com/lZiMUl/minecraft-mcp/security/advisories/new>
|
|
19
|
+
|
|
20
|
+
Include the affected version, a minimal reproduction (tool call, resource URI
|
|
21
|
+
or world snapshot), and the impact you observed. You can expect an initial
|
|
22
|
+
response within a few days. Please allow time for a fix and release before
|
|
23
|
+
disclosing the issue publicly.
|
|
24
|
+
|
|
25
|
+
## Scope
|
|
26
|
+
|
|
27
|
+
The server is designed to run locally over stdio. Reports that are in scope
|
|
28
|
+
include, but are not limited to:
|
|
29
|
+
|
|
30
|
+
- Prototype pollution or code execution through block ids, block states or
|
|
31
|
+
snapshot files
|
|
32
|
+
- Path traversal or arbitrary file writes through `MCP_WORLD_DIR`
|
|
33
|
+
- Denial of service through oversized tool input or snapshots
|
|
34
|
+
- Data loss when persisting world state
|
|
35
|
+
|
|
36
|
+
The following are generally out of scope: running the server with an
|
|
37
|
+
untrusted `MCP_WORLD_DIR`, modifying files on disk without restarting the
|
|
38
|
+
server, and issues that require an already-compromised host.
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { MINECRAFT_BLOCK_COUNT } from '../data/blocks.js';
|
|
2
|
+
import { MINECRAFT_ENTITY_COUNT } from '../data/entities.js';
|
|
2
3
|
import { MINECRAFT_ITEM_COUNT } from '../data/items.js';
|
|
3
4
|
import { MINECRAFT_DATA_VERSION } from '../data/version.js';
|
|
4
5
|
import { EIconTheme } from '../enums/icon-theme.enum.js';
|
|
5
6
|
export const SERVER_INFO = {
|
|
6
7
|
name: 'lzimul',
|
|
7
8
|
title: 'lZiMUl Minecraft MCP',
|
|
8
|
-
description: `Minecraft Model Context Protocol server (Java Edition ${MINECRAFT_DATA_VERSION}): exposes all ${MINECRAFT_BLOCK_COUNT} blocks
|
|
9
|
-
version: '1.0.
|
|
9
|
+
description: `Minecraft Model Context Protocol server (Java Edition ${MINECRAFT_DATA_VERSION}): exposes all ${MINECRAFT_BLOCK_COUNT} blocks, ${MINECRAFT_ITEM_COUNT} items and ${MINECRAFT_ENTITY_COUNT} entity types with their properties as resources, plus tools to read and place blocks, inspect dimensions, create entities and players, and manage their hotbar and backpack inventories.`,
|
|
10
|
+
version: '1.0.4',
|
|
10
11
|
websiteUrl: 'https://mcp.lzimul.com/lZiMUl',
|
|
11
12
|
icons: [
|
|
12
13
|
{
|