Compile CLI to .project/toolchain/bin/dew for MCP stdio use
melos run pollutes stdout, breaking the MCP JSON-RPC channel. The compiled binary has clean stdio and can be pointed at directly by MCP clients. - Add melos run compile script (output to .project/toolchain/bin/dew) - Ignore .project/toolchain/ in .gitignore - Update mcp.md with compile + client config instructions - Remove workspace-root bin/ directory Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
a74bd94547
commit
260d291b0f
3 changed files with 58 additions and 4 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,3 +1,6 @@
|
||||||
# https://dart.dev/guides/libraries/private-files
|
# https://dart.dev/guides/libraries/private-files
|
||||||
# Created by `dart pub`
|
# Created by `dart pub`
|
||||||
.dart_tool/
|
.dart_tool/
|
||||||
|
|
||||||
|
# Compiled toolchain binaries
|
||||||
|
.project/toolchain/
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ The Dew Model Context Protocol (MCP) Server is a feature that allows AI agents t
|
||||||
The MCP feature is split across two packages to keep concerns separate:
|
The MCP feature is split across two packages to keep concerns separate:
|
||||||
|
|
||||||
- **`packages/core`** defines the `McpToolProvider` interface. Any feature package that wants to expose tools to AI agents implements this interface — without needing to depend on the MCP server itself.
|
- **`packages/core`** defines the `McpToolProvider` interface. Any feature package that wants to expose tools to AI agents implements this interface — without needing to depend on the MCP server itself.
|
||||||
- **`packages/mcp`** implements the actual server. It collects all registered `McpToolProvider` implementations and serves them over the configured host and port. Only the `cli` package depends on `packages/mcp`; feature packages like `kanban` remain decoupled from the transport layer.
|
- **`packages/mcp`** implements the actual server. It collects all registered `McpToolProvider` implementations and serves them over stdio using the [dart\_mcp](https://pub.dev/packages/dart_mcp) package. Only the `cli` package depends on `packages/mcp`; feature packages like `kanban` remain decoupled from the transport layer.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
|
|
@ -21,3 +21,44 @@ dew:
|
||||||
```
|
```
|
||||||
|
|
||||||
See the [Configuration documentation](../config.md) for full details.
|
See the [Configuration documentation](../config.md) for full details.
|
||||||
|
|
||||||
|
## Running the server
|
||||||
|
|
||||||
|
The MCP server uses **stdio transport** — the MCP client launches it as a child process and communicates over stdin/stdout. Because of this, the process must have clean stdout (no decorative output). `melos run` pollutes stdout with its own log lines, which corrupts the JSON-RPC channel.
|
||||||
|
|
||||||
|
### Step 1 — Compile to a native binary
|
||||||
|
|
||||||
|
```text
|
||||||
|
melos run compile
|
||||||
|
```
|
||||||
|
|
||||||
|
This produces `.project/toolchain/bin/dew` (or `.project/toolchain/bin/dew.exe` on Windows).
|
||||||
|
|
||||||
|
### Step 2 — Configure your MCP client
|
||||||
|
|
||||||
|
Point your MCP client at the compiled binary. For example, in VS Code's MCP configuration:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"mcpServers": {
|
||||||
|
"dew": {
|
||||||
|
"command": "/absolute/path/to/dew/.project/toolchain/bin/dew",
|
||||||
|
"args": ["mcp", "serve"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The server logs its startup message to **stderr** so it never interferes with the JSON-RPC channel on stdout.
|
||||||
|
|
||||||
|
## Available tools
|
||||||
|
|
||||||
|
The following tools are registered by the `kanban` package:
|
||||||
|
|
||||||
|
| Tool | Description |
|
||||||
|
| ------------------------- | -------------------------------------------------------- |
|
||||||
|
| `kanban_create_ticket` | Create a new kanban ticket |
|
||||||
|
| `kanban_list_tickets` | List tickets, optionally filtered by column or type |
|
||||||
|
| `kanban_get_ticket` | Get a ticket by ID |
|
||||||
|
| `kanban_update_ticket` | Update one or more fields on an existing ticket |
|
||||||
|
| `kanban_delete_ticket` | Delete a ticket by ID |
|
||||||
|
|
|
||||||
16
pubspec.yaml
16
pubspec.yaml
|
|
@ -30,7 +30,17 @@ melos:
|
||||||
run: dart format .
|
run: dart format .
|
||||||
dew:
|
dew:
|
||||||
description: >-
|
description: >-
|
||||||
Run the Dew CLI. Pass subcommands and args directly
|
Run the Dew CLI via 'dart run' (for development). Pass subcommands and
|
||||||
(e.g. melos run dew kanban). Use 'help <command>' for usage
|
args directly (e.g. melos run dew kanban). Use 'help <command>' for
|
||||||
(e.g. melos run dew help kanban).
|
usage (e.g. melos run dew help kanban).
|
||||||
|
NOTE: 'mcp serve' must be run via the compiled binary (see compile
|
||||||
|
script) because melos pollutes stdout, which breaks the stdio MCP
|
||||||
|
transport.
|
||||||
run: dart run packages/cli/bin/dew.dart
|
run: dart run packages/cli/bin/dew.dart
|
||||||
|
compile:
|
||||||
|
description: >-
|
||||||
|
Compile the Dew CLI to a native binary at .project/toolchain/bin/dew
|
||||||
|
(.project/toolchain/bin/dew.exe on Windows). Use the compiled binary to
|
||||||
|
run 'dew mcp serve' from your MCP client config — this keeps stdout
|
||||||
|
clean for the JSON-RPC channel.
|
||||||
|
run: dart compile exe packages/cli/bin/dew.dart -o .project/toolchain/bin/dew
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue