AtlatestRepositorysigil-mcp
1
# sigil-mcp3
Library for building Model Context Protocol clients and servers in4
[Sigil](https://codeberg.org/sigil/sigil). Provides the server loop,5
JSON-RPC 2.0 framing, and channel-based message routing primitives so6
any Sigil project can expose tools and resources to MCP clients.8
sigil-cli ships a built-in dev-tools server on top of this library,9
invoked via `sigil mcp serve`, which exposes documentation, lint,10
format, test execution, and nREPL-backed evaluation so AI agents can11
work idiomatically against a live Sigil project.13
## Modules15
| Module | Purpose |16
|------------------------|--------------------------------------------------------|17
| `(sigil mcp)` | Top-level re-exports plus package-tool discovery |18
| `(sigil mcp server)` | Server loop, message routing, handler registration |19
| `(sigil mcp client)` | Client lifecycle, correlation, cancellation, events |20
| `(sigil mcp protocol)` | JSON-RPC 2.0 framing and MCP message shapes |21
| `(sigil mcp channel)` | Helpers for channel-based server transports |23
## Building your own MCP server25
```scheme26
(import (sigil mcp))28
(define server29
(mcp-server name: "my-server" version: "1.0"))31
(mcp-server-register-tool! server32
name: "echo"33
description: "Echoes its input back."34
handler: (lambda (args) ...))36
(mcp-server-run server)37
```39
For a complete example, see sigil-cli's `(sigil cli mcp)` module or40
projects like bureau, courier, folio, and minder.42
## Build and test44
```45
sigil deps install46
sigil build47
sigil test --report48
```50
The `sigil` executable bundles the released MCP modules. When testing local51
changes to a module that is also built in, add `-L src` before the command so52
the checkout takes precedence:54
```55
sigil -L src test test/test-protocol.sgl test/test-client.sgl --report56
```58
Run unchanged server integration suites through the normal package test path;59
the current toolchain's source-path override does not expose every private60
server binding used by those tests:62
```63
sigil test test/test-server.sgl test/test-nrepl-tools.sgl test/test-channel.sgl --report64
```66
Local development against an unreleased sigil monorepo:68
```69
sigil deps install --redirects ./dev-redirects.sgl70
sigil build --redirects ./dev-redirects.sgl71
```73
## License75
BSD-3-Clause. See `LICENSE` in the sigil monorepo for the canonical copy.