1<!--
2SPDX-FileCopyrightText: Amolith <amolith@secluded.site>
3
4SPDX-License-Identifier: CC0-1.0
5-->
6
7# sb-mcp
8
9[](https://goreportcard.com/report/git.secluded.site/sb-mcp)
10[](https://codeberg.org/Mutualism/Mutualist-License)
11[](https://scratchanitch.dev)
12[](https://api.reuse.software/info/git.secluded.site/sb-mcp)
13[](https://liberapay.com/Amolith/)
14
15_A three-tool MCP server for [SilverBullet]_
16
17[SilverBullet]: https://silverbullet.md
18
19## Contents
20
21- [Why?](#why)
22- [Tools](#tools)
23- [Installation](#installation)
24- [Configuration](#configuration)
25- [Usage](#usage)
26- [Contributing](#contributing)
27
28## Why?
29
30SilverBullet is a note-taking/knowledge-management tool with a powerful Runtime
31API that can execute [Space Lua], take screenshots, and surface console logs.
32
33sb-mcp wraps the Runtime API in a [Model Context Protocol] server so coding
34agents can read and write notes, run queries, debug plug failures, and generally
35treat your SilverBullet space as a first-class workspace.
36
37[Space Lua]: https://silverbullet.md/Space%20Lua
38[Model Context Protocol]: https://modelcontextprotocol.io
39
40## Tools
41
42| Tool | Description |
43| -------------- | -------------------------------------------------------------------- |
44| `execute_lua` | Run a Space Lua script on the SilverBullet instance. |
45| `screenshot` | Capture the current SilverBullet viewport as a PNG image. |
46| `console_logs` | Retrieve recent console log entries from SilverBullet for debugging. |
47
48### `execute_lua` parameters
49
50| Parameter | Type | Description |
51| --------- | ------ | --------------------------------------------------------- |
52| `script` | string | The script to execute. |
53| `timeout` | int | Maximum execution time in seconds (1–21600, default 120). |
54
55### `console_logs` parameters
56
57| Parameter | Type | Description |
58| --------- | ---- | --------------------------------------------------------------- |
59| `limit` | int | Maximum number of log entries to return (1–1000, default 100). |
60| `since` | int | Only return entries newer than this unix millisecond timestamp. |
61
62## Installation
63
64Pre-built binaries are available at
65[releases.secluded.site/sb-mcp/latest][bin-latest].
66
67[bin-latest]: https://releases.secluded.site/sb-mcp/latest
68
69- Using [mise](https://mise.jdx.dev/) (recommended), copy the snippet from the
70 releases page into your `mise.toml` or global `~/.config/mise/config.toml` to
71 automate updates.
72- Without mise, or a similar tool, download the binary for your platform from
73 the releases page and place it somewhere in your `$PATH`.
74
75## Configuration
76
77All configuration is through environment variables and command-line flags.
78
79| Variable | Required | Description |
80| ------------ | -------- | -------------------------------------------------------------------------- |
81| `SB_URL` | **yes** | Base URL of your SilverBullet instance (e.g. `https://notes.example.com`). |
82| `SB_TOKEN` | no | Bearer token for `Authorization` header. |
83| `SB_USER` | no | Username for cookie-based session auth (used with `SB_PASS`). |
84| `SB_PASS` | no | Password for cookie-based session auth (used with `SB_USER`). |
85| `SB_TIMEOUT` | no | Default Lua execution timeout in seconds (default 120). |
86
87`SB_TOKEN` and `SB_USER`/`SB_PASS` don't override each other and can be set
88simultaneously. This is helpful if your instance is behind some kind of
89authenticating proxy: the token can get you through the proxy and user/pass get
90you into the instance.
91
92## Usage
93
94```bash
95# stdio
96SB_URL=https://notes.example.com sb-mcp serve
97
98# http
99SB_URL=https://notes.example.com sb-mcp serve --http :3001
100```
101
102## Contributing
103
104Patch requests are in
105[amolith/llm-projects](https://pr.pico.sh/r/amolith/llm-projects) on
106[pr.pico.sh](https://pr.pico.sh). You don't need a new account to contribute,
107you don't need to fork this repo, you don't need to fiddle with `git
108send-email`, you don't need to faff with your email client to get `git
109request-pull` working...
110
111You just need:
112
113- Git
114- SSH
115- An SSH key
116
117```bash
118# Clone this repo, make your changes, and commit them
119# Create a new patch request with
120git format-patch origin/main --stdout | ssh pr.pico.sh pr create amolith/llm-projects
121# After potential feedback, submit a revision to an existing patch request with
122git format-patch origin/main --stdout | ssh pr.pico.sh pr add {prID}
123# List patch requests
124ssh pr.pico.sh pr ls amolith/llm-projects
125```
126
127See "How do Patch Requests work?" on [pr.pico.sh](https://pr.pico.sh)'s home
128page for a more complete example workflow.