# skilld MCP server for the skill library, written in C99/POSIX. Ten tools over the standard MCP surface: search, load, create, update, clone, list and delete `SKILL.md` files in the skill library, plus history, diff and sync through git. Built on `libmcp` (header-only). `skilld-http` is a CGI web UI on top of it. Code: https://git.kropa.tech/hiddenbox/skilld ```sh make make test ``` The binary speaks MCP over stdio, so it is registered as an MCP server, not started by hand. ## Tools | tool | arguments | what it does | |---|---|---| | `skill_search` | `query`, `limit` | ranked search by describing the job | | `skill_load` | `name` | one skill in full | | `skill_create` | `name`, `description`, `body`, `tags` | write a new skill | | `skill_update` | `name`, `description`, `body`, `append` | replace the trigger line or body, or append a section | | `skill_clone` | `name`, `new_name` | copy a skill with its references and scripts | | `skill_list` | (none) | every skill: name, description, tags | | `skill_history` | `name`, `limit` | commits for one skill or the whole library | | `skill_diff` | `name` | what is changed but not committed | | `skill_sync` | `push` | `pull --rebase` from the remote; `push: true` sends instead | | `skill_delete` | `name` | remove the skill's directory | ## Where the library lives ``` $SKILLD_HOME if set $SKILLLIB old name, still accepted $XDG_DATA_HOME/skilld otherwise ~/.local/share/skilld if XDG_DATA_HOME is unset ``` Each skill is a directory `/` with a `SKILL.md` (YAML frontmatter and a markdown body) and whatever references, scripts or templates belong to it. skilld prints at start which library it uses and in which git mode. ## Git is the substrate `skill_create`, `skill_update` and `skill_delete` end with a commit under the skill's own message (`skilld: create `, `skilld: update `, `skilld: delete `), authored as `skilld `. A skill written by one agent and corrected by another keeps both, and `git log` answers who changed what and when. A commit takes everything that is changed in the skill's directory (for a delete: in the library), including edits made by hand. `skill_clone` copies the files but does not commit; the clone is committed with its first update, or shows up in `skill_diff`. The library becomes a repository on the first write if git is installed; an existing repository, also a parent one, is left as it is. skilld never pushes on its own. To share the library, give it a remote and use `skill_sync`: ```sh git -C "$SKILLD_HOME" remote add origin ``` Without git nothing breaks: the git tools say the library is not a repository instead of pretending, and the start message says changes are not versioned. Version control that silently does nothing is worse than none. ## HTTP ```sh skilld # MCP over stdin/stdout skilld --http 8790 # same tools over Streamable HTTP ``` `--http` takes `8790`, `:8790` or `0.0.0.0:8790`; only the port is used, and the server listens on every IPv4 address. There is no authentication, so keep the port off untrusted networks. The HTTP server lives in libmcp (`mcp_serve_http`), so tasksd and skilld share one implementation instead of two copies. ## Dependency: libmcp `vendor/libmcp/mcp.h` is a copy of the header from the `libmcp` repository, so this repository builds and tests on its own. Refresh it after a libmcp change: ```sh cp ../libmcp/mcp.h vendor/libmcp/mcp.h ``` `make` uses `LIBDIR=vendor/libmcp` by default; override it to build against a checkout elsewhere: `make LIBDIR=../libmcp`. ## Web UI (CGI) `skilld-http` is a C99 CGI program: HTML 4.01, no JavaScript, no auth. It reads and writes only through skilld's MCP server (`SKILLD_URL`, default `http://127.0.0.1:8790/mcp`), so edits from the browser are committed by skilld the same way an agent's edits are. skilld therefore has to run with `--http`. Addresses are relative to the CGI, e.g. `/cgi-bin/skilld-http/search?q=…`: | Address | Effect | |---|---| | `/` | all skills | | `/search?q=…` | ranked search | | `/s/` | read SKILL.md | | `/s//edit` | description, body, append | | `/s//clone` | clone to a new name | | `/s//delete` | POST only | | `/new` | create a skill (name, description, tags, body) | | `/history?name=…` | git history; without `name` the whole library | | `/diff` | uncommitted changes | | `/sync` | pull/push buttons (POST to `/sync/pull`, `/sync/push`) | ```sh make # skilld and skilld-http sudo make install # /usr/local/bin/skilld, /usr/local/lib/cgi-bin/skilld-http ``` `PREFIX`, `CGIDIR` and `DESTDIR` change the install paths. With busybox httpd: ```sh skilld --http 8790 & install -d /srv/www/cgi-bin install -m 0755 skilld-http /srv/www/cgi-bin/ SKILLD_URL=http://127.0.0.1:8790/mcp \ busybox httpd -f -p 0.0.0.0:8798 -h /srv/www ``` The UI is then at `http://:8798/cgi-bin/skilld-http/`. `vendor/cgi/cgi.h` is the shared CGI helper (one copy each in wikid, memoryd, skilld and tasksd). ## Tests `make test` runs the MCP surface test (`tests/run.sh`), the git test (`tests/git.py`) and the CGI test (`tests/test-http.sh`), each against a temporary library. They need `python3`; the CGI test also needs `curl`.