You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: Add documentation for auto-start nREPL CLI and config options (#101)
- Update README.md CLI options to document :start-nrepl-cmd and :parse-nrepl-port
- Update CONFIG.md with new configuration options for auto-starting nREPL
- Add example configuration file for auto-start feature
- Clarify that auto-start requires launching from project directory
- Emphasize usefulness for Claude Code and other CLI-based LLM tools
Co-authored-by: Bruce Hauman <[email protected]>
Copy file name to clipboardExpand all lines: CONFIG.md
+28Lines changed: 28 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,34 @@ Controls the file timestamp tracking behavior (default: `:partial-read`). This s
39
39
40
40
The timestamp tracking system prevents accidental overwrites when files are modified by external processes (other developers, editors, git operations, etc.).
41
41
42
+
### `:start-nrepl-cmd`
43
+
**Optional** - A command to automatically start an nREPL server if one is not already running. Must be specified as a vector of strings. The MCP server will start this process and manage its lifecycle.
44
+
45
+
**Important**: This feature requires the MCP server to be launched from your project directory (where your `deps.edn` or `project.clj` is located). The nREPL server will be started in the current working directory. This makes it ideal for use with Claude Code and other command-line LLM clients where you want automatic nREPL startup - you can simply start Claude Code in your project directory and the nREPL will launch automatically.
46
+
47
+
**Available values:**
48
+
-`["lein" "repl" ":headless"]` - Start Leiningen REPL in headless mode
49
+
-`["clojure" "-M:nrepl"]` - Start Clojure with nREPL alias
50
+
-`["bb" "nrepl-server"]` - Start Babashka nREPL server
51
+
52
+
**When to use:**
53
+
- With Claude Code or other CLI-based LLM tools launched from your project directory
54
+
- When you want automatic nREPL server management without separate terminal windows
55
+
- In CI/CD environments where automatic startup is beneficial
56
+
57
+
### `:parse-nrepl-port`
58
+
**Optional** - When `true` and used with `:start-nrepl-cmd`, automatically discovers the nREPL port from the command's stdout output. Defaults to `true` when `:start-nrepl-cmd` is provided. The parser recognizes common nREPL port announcement formats.
59
+
60
+
**Available values:**
61
+
-`true` (default when `:start-nrepl-cmd` is provided) - Parse port from nREPL output
62
+
-`false` - Don't parse port; requires `:port` to be explicitly provided
63
+
64
+
**When to use:**
65
+
-`true` - When the nREPL server announces its port in stdout (most common case)
66
+
-`false` - When using a fixed port configuration or when port is known in advance
67
+
68
+
**Note:** When `:parse-nrepl-port` is `false`, you must provide the `:port` configuration.
69
+
42
70
### `:emacs-notify`
43
71
Boolean flag to enable Emacs integration notifications.
Copy file name to clipboardExpand all lines: README.md
+26-1Lines changed: 26 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -933,7 +933,7 @@ For a quick start: **[Creating Your Own Custom MCP Server](doc/custom-mcp-server
933
933
Using the -X invocation requires EDN values.
934
934
935
935
#### `:port`
936
-
**Required** - The nREPL server port to connect to.
936
+
**Optional** - The nREPL server port to connect to. Required unless using `:start-nrepl-cmd` with `:parse-nrepl-port` or relying on an existing `.nrepl-port` file.
937
937
938
938
`:port 7888`
939
939
@@ -942,6 +942,18 @@ Using the -X invocation requires EDN values.
942
942
943
943
`:host "localhost"` or `:host "0.0.0.0"`
944
944
945
+
#### `:start-nrepl-cmd`
946
+
**Optional** - A command to automatically start an nREPL server if one is not already running. Must be specified as a vector of strings. The MCP server will start this process and manage its lifecycle.
947
+
948
+
**Important**: This option requires launching `clojure-mcp` from your project directory (where your `deps.edn` or `project.clj` is located). The nREPL server will be started in the current working directory. This is particularly useful for Claude Code and other command-line LLM clients where you want automatic nREPL startup without manual process management.
949
+
950
+
`:start-nrepl-cmd ["lein" "repl" ":headless"]` or `:start-nrepl-cmd ["clojure" "-M:nrepl"]`
951
+
952
+
#### `:parse-nrepl-port`
953
+
**Optional** - When `true` and used with `:start-nrepl-cmd`, automatically discovers the nREPL port from the command's stdout output. Defaults to `false`. The parser recognizes common nREPL port announcement formats.
954
+
955
+
`:parse-nrepl-port true`
956
+
945
957
#### `:config-file`
946
958
**Optional** - Specify the location of a configuration file. Must be a path to an existing file.
947
959
@@ -968,12 +980,25 @@ Using the -X invocation requires EDN values.
968
980
# Basic usage with just port
969
981
clojure -X:mcp :port 7888
970
982
983
+
# With automatic nREPL server startup and port discovery
984
+
# Perfect for Claude Code - run this from your project directory
0 commit comments