Skip to content

Commit 0ff77b7

Browse files
committed
Document ldk-server-mcp in the workspace
Describe the MCP bridge as a first-class workspace member and document how to build, test, and sanity-check it alongside the rest of ldk-server. Co-Authored-By: HAL 9000
1 parent e372688 commit 0ff77b7

3 files changed

Lines changed: 45 additions & 68 deletions

File tree

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ The primary goal of LDK Server is to provide an efficient, stable, and API-first
99
a Lightning Network node. With its streamlined setup, LDK Server enables users to easily set up, configure, and run
1010
a Lightning node while exposing a robust, language-agnostic API via [Protocol Buffers (Protobuf)](https://protobuf.dev/).
1111

12+
## Workspace Crates
13+
14+
- `ldk-server`: daemon that runs the Lightning node and exposes the API
15+
- `ldk-server-cli`: CLI client for the server API
16+
- `ldk-server-client`: Rust client library for authenticated TLS gRPC calls
17+
- `ldk-server-grpc`: generated protobuf and shared gRPC types
18+
- `ldk-server-mcp`: stdio MCP bridge exposing unary `ldk-server` RPCs as MCP tools
19+
1220
### Features
1321

1422
- **Out-of-the-Box Lightning Node**:
@@ -58,6 +66,18 @@ See [Getting Started](docs/getting-started.md) for a full walkthrough.
5866
The canonical API definitions are in [`ldk-server-grpc/src/proto/`](ldk-server-grpc/src/proto/). A ready-made
5967
Rust client library is provided in [`ldk-server-client/`](ldk-server-client/).
6068

69+
### MCP Bridge
70+
71+
The workspace also includes `ldk-server-mcp`, a stdio [Model Context Protocol](https://spec.modelcontextprotocol.io/) server
72+
that lets MCP-compatible clients call the unary `ldk-server` RPC surface as tools.
73+
74+
Run it directly from the workspace:
75+
```bash
76+
cargo run -p ldk-server-mcp -- --config /path/to/config.toml
77+
```
78+
79+
It is covered by both crate-local tests and an `e2e-tests` sanity suite against a live `ldk-server` instance.
80+
6181
### Contributing
6282

6383
Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on building, testing, code style, and development workflow.

ldk-server-mcp/CLAUDE.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,18 @@
22

33
MCP (Model Context Protocol) server that exposes LDK Server operations as tools for AI agents.
44

5+
This crate is a member of the `ldk-server` workspace and should be kept green under the workspace-wide checks.
6+
57
## Build / Test Commands
68

79
```bash
810
cargo fmt --all
911
cargo check
10-
cargo test
11-
cargo clippy
12+
cargo test -p ldk-server-mcp
13+
cargo clippy -p ldk-server-mcp --all-targets -- -D warnings
14+
15+
# MCP sanity checks against a live ldk-server instance
16+
cargo test --manifest-path e2e-tests/Cargo.toml mcp -- --nocapture
1217
```
1318

1419
## Architecture
@@ -41,6 +46,9 @@ The server reads configuration in this precedence order (highest first):
4146
2. **CLI argument**: `--config <path>` pointing to a TOML file
4247
3. **Default paths**: `~/.ldk-server/config.toml`, `~/.ldk-server/tls.crt`, `~/.ldk-server/{network}/api_key`
4348

49+
If no config path is provided explicitly, the crate uses the default `ldk-server` config location at
50+
`~/.ldk-server/config.toml`.
51+
4452
TOML config format (same as ldk-server-cli):
4553
```toml
4654
[node]
@@ -59,3 +67,5 @@ When a new endpoint is added to `ldk-server-client`:
5967
2. Add a handler function in `src/tools/handlers.rs`
6068
3. Register in `build_tool_registry()` in `src/tools/mod.rs`
6169
4. Update the expected tool surface in `tests/integration.rs`
70+
5. Add or update helper-level coverage in `src/tools/handlers.rs` when parsing or validation changes
71+
6. If the tool is suitable for live validation, extend `e2e-tests/tests/mcp.rs`

ldk-server-mcp/README.md

Lines changed: 13 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
An [MCP (Model Context Protocol)](https://spec.modelcontextprotocol.io/) server that exposes [LDK Server](https://github.com/lightningdevkit/ldk-server) operations as tools for AI agents. It communicates over JSON-RPC 2.0 via stdio and connects to an LDK Server instance over TLS using the [`ldk-server-client`](https://github.com/lightningdevkit/ldk-server/tree/main/ldk-server-client) library.
44

5+
This crate lives inside the `ldk-server` workspace.
6+
57
## Building
68

79
```bash
8-
cargo build --release
10+
cargo build -p ldk-server-mcp --release
911
```
1012

1113
## Configuration
@@ -35,15 +37,18 @@ cert_path = "/path/to/tls.crt"
3537
export LDK_BASE_URL="localhost:3000"
3638
export LDK_API_KEY="your_hex_encoded_api_key"
3739
export LDK_TLS_CERT_PATH="/path/to/tls.crt"
38-
./target/release/ldk-server-mcp
40+
cargo run -p ldk-server-mcp --release
3941
```
4042

4143
Or using a config file:
4244

4345
```bash
44-
./target/release/ldk-server-mcp --config /path/to/config.toml
46+
cargo run -p ldk-server-mcp -- --config /path/to/config.toml
4547
```
4648

49+
If `--config` is omitted, `ldk-server-mcp` falls back to the same default config path as
50+
`ldk-server` and `ldk-server-cli`: `~/.ldk-server/config.toml`.
51+
4752
### With Claude Desktop
4853

4954
Add the following to your Claude Desktop MCP configuration (`claude_desktop_config.json`):
@@ -84,71 +89,10 @@ Add to your Claude Code MCP settings (`.claude/settings.json`):
8489

8590
## Available Tools
8691

87-
The server exposes 37 unary LDK Server RPCs as MCP tools.
92+
All unary LDK Server RPCs are exposed as MCP tools. Use `tools/list` to discover the current set.
8893

8994
Streaming RPCs such as `subscribe_events` and non-RPC HTTP endpoints such as `metrics` are not exposed as tools.
9095

91-
### Node
92-
| Tool | Description |
93-
|------|-------------|
94-
| `get_node_info` | Retrieve node info including node_id, sync status, and best block |
95-
| `get_balances` | Retrieve an overview of all known balances (on-chain and Lightning) |
96-
97-
### On-chain
98-
| Tool | Description |
99-
|------|-------------|
100-
| `onchain_receive` | Generate a new on-chain Bitcoin funding address |
101-
| `onchain_send` | Send an on-chain Bitcoin payment to an address |
102-
103-
### Payments
104-
| Tool | Description |
105-
|------|-------------|
106-
| `bolt11_receive` | Create a BOLT11 Lightning invoice to receive a payment |
107-
| `bolt11_receive_for_hash` | Create a BOLT11 Lightning invoice for a specific payment hash |
108-
| `bolt11_claim_for_hash` | Manually claim a BOLT11 payment for a specific payment hash |
109-
| `bolt11_fail_for_hash` | Manually fail a BOLT11 payment for a specific payment hash |
110-
| `bolt11_receive_via_jit_channel` | Create a BOLT11 Lightning invoice to receive via an LSPS2 JIT channel |
111-
| `bolt11_receive_variable_amount_via_jit_channel` | Create a variable-amount BOLT11 Lightning invoice to receive via an LSPS2 JIT channel |
112-
| `bolt11_send` | Pay a BOLT11 Lightning invoice |
113-
| `bolt12_receive` | Create a BOLT12 offer for receiving Lightning payments |
114-
| `bolt12_send` | Pay a BOLT12 Lightning offer |
115-
| `spontaneous_send` | Send a spontaneous (keysend) payment to a Lightning node |
116-
| `unified_send` | Send a payment given a BIP 21 URI or BIP 353 Human-Readable Name |
117-
118-
### Channels
119-
| Tool | Description |
120-
|------|-------------|
121-
| `open_channel` | Open a new Lightning channel with a remote node |
122-
| `close_channel` | Cooperatively close a Lightning channel |
123-
| `force_close_channel` | Force close a Lightning channel unilaterally |
124-
| `list_channels` | List all known Lightning channels |
125-
| `update_channel_config` | Update forwarding fees and CLTV delta for a channel |
126-
| `splice_in` | Increase a channel's balance by splicing in on-chain funds |
127-
| `splice_out` | Decrease a channel's balance by splicing out to on-chain |
128-
129-
### Payment History
130-
| Tool | Description |
131-
|------|-------------|
132-
| `list_payments` | List all payments (supports pagination via page_token) |
133-
| `get_payment_details` | Get details of a specific payment by its ID |
134-
| `list_forwarded_payments` | List all forwarded payments (supports pagination via page_token) |
135-
136-
### Peers
137-
| Tool | Description |
138-
|------|-------------|
139-
| `connect_peer` | Connect to a Lightning peer without opening a channel |
140-
| `disconnect_peer` | Disconnect from a Lightning peer |
141-
| `list_peers` | List all known Lightning peers |
142-
143-
### Utilities
144-
| Tool | Description |
145-
|------|-------------|
146-
| `decode_invoice` | Decode a BOLT11 invoice and return its parsed fields |
147-
| `decode_offer` | Decode a BOLT12 offer and return its parsed fields |
148-
| `sign_message` | Sign a message with the node's secret key |
149-
| `verify_signature` | Verify a signature against a message and public key |
150-
| `export_pathfinding_scores` | Export the pathfinding scores used by the Lightning router |
151-
15296
## MCP Protocol
15397

15498
- **Protocol version**: `2025-11-25`
@@ -158,7 +102,10 @@ Streaming RPCs such as `subscribe_events` and non-RPC HTTP endpoints such as `me
158102
## Testing
159103

160104
```bash
161-
cargo test
105+
cargo test -p ldk-server-mcp
106+
107+
# MCP end-to-end sanity checks against a live ldk-server
108+
cargo test --manifest-path e2e-tests/Cargo.toml mcp -- --nocapture
162109
```
163110

164111
## License

0 commit comments

Comments
 (0)