9707f7ae93f95e4f84a0ba5ec2f47626c3927a37
Same json.lua empty-table → [] gotcha that bit `ping` in v1.0.0-rc1
(project_json_empty_table_gotcha memory) bit again — this time on
tool inputSchemas with `properties = {}`. Symptom: spec-strict MCP
clients (Zod et al.) reject tools/list with:
expected: record, code: invalid_type,
path: [tools, N, inputSchema, properties],
message: "Invalid input: expected record, received array"
Fix: in `lmcp:tool()`, normalise the registered inputSchema —
when `properties` is an empty Lua table, drop the key entirely.
JSON Schema permits omitting `properties` on `type: "object"`
(means "any object, no constraints" — exactly what a no-arg tool
wants).
Clone-before-mutate so the caller's table isn't trampled (matters
when a server author shares one schema across multiple
registrations).
Smoke tested locally with 3 tools (empty, default-nil, populated):
- `properties = {}` → emitted as `{"type":"object"}`
- nil schema → same default, same output
- populated properties → emitted intact with full shape
Discovered against hertz-tools live (lxc_list, network_status had
`properties = {}` — hertz hotfixed by hand before this commit;
this protects every future tool author from the same trap).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
lmcp — Lua MCP server
Lightweight Model Context Protocol (MCP) server in pure Lua.
Runtime dependencies
- Lua 5.1+
- luasocket — needed for the TCP
listener. Packaged as
lua-socketon Arch/ALARM,lua-socketon Debian.
Files
| File | Role |
|---|---|
lmcp.lua |
library: protocol handling, tool registration |
server.lua |
HTTP server loop |
json.lua |
vendored JSON encoder/decoder |
example_server.lua |
sample server with a couple of tools |
Install
Packaged as lmcp in the marfrit overlay repo:
# Arch / ALARM
sudo pacman -S lmcp
# Debian
sudo apt install lmcp
Files land under /usr/share/lua/5.4/ (Lua LUA_PATH).
The example server installs as /usr/bin/lmcp-example.
Description
Releases
1
Languages
Lua
93.1%
Shell
6.2%
Batchfile
0.7%