Is there a config key to set the port file for the nrepl server that is started on Jack-in? Is a custom jack-in command line string the best way to do this? (just making sure it’s not overkill).
I’m looking for the simplest, most idiomatic Calva way to create an nrepl session on 7888 for clojure-mcp to connect to. Currently I am spawing a second nrepl server on the desired port? Why 2 nrepl servers? Is this desireable?
Also, the nrepl server alias reccomended on clojure-mcp repo has
:jvm-opts ["-Djdk.attach.allowAttachSelf"]
;; this allows nrepl to interrupt runaway repl evals
Would i configure that somewhere in the Calva jack-in somewhere? or keep it in a deps.edn alias?
It also has
:main-opts ["-m" "nrepl.cmdline" "--port" "7888"] But I’m assuming I don’t need that If I’ve jacked-in with Calva, is that correct?Asked about this here too https://clojurians.slack.com/archives/C068E9L5M2Q/p1758045218004339 My heads swimming in config options 😵💫 I’m trying to have a simple calva-jack in that will work clojure-mcp with stable config that i can use in different projects.
Not exactly an answer to the question you asked but my recommendation is to start your REPL manually and have Calva connect to it. I was a big fan of jack-in for a while, but I found Calva wanted me to reload the window for extension updates more often than I would otherwise start a REPL -- and reloading kills the jack-in REPL. So I switched to starting my REPL manually -- I have a repl shell script and a bunch of aliases in my user deps.edn file (see my dot-clojure repo on GitHub for that script, those aliases, and the code I use to start a REPL).
That allows me to start a REPL from the command-line -- usually a terminal inside VS Code -- and connect to it and be able to reload Calva's window without losing the REPL process and I have Calva configured to auto-connect if there's a .nrepl-port file (which starting the nREPL server lays down).
This allows you a lot more control over exactly what's on your classpath and what JVM options to use etc.
My VS Code / Calva / Joyride config is all in my vscode-calva-setup repo on GitHub.
Same experience as Sean because I need to choose the JVM version and I couldn’t find a way to set this with VSCode. Calva has a command which will save to your clipboard the exact command they use for the jack-in. So you don’t have to add all the nREPL config in your deps file.
How I start my REPL: https://github.com/seancorfield/dot-clojure/blob/develop/bin/repl#L14
:dev/repl adds my own custom code that adaptively figures out what to do based on what's on the classpath (from the aliases).
@seancorfield thanks for the guidance, and the links. I have been burned by the window reloading all the time. So once you start a project repl, if it includes an nrepl server for Calva to connect to, do you also set the port and use that nrepl server for clojure-mcp to talk to, or do you start a second nrepl server for that?
@pez, if i did want to continue to use jack-in in Calva, is there a way to pre-set the nrepl port? I’m assuming the custom command line string in the repl jack-in config json is the only way?
I'm not using clojure-mcp but, if I was, I would specify the port in my dev/repl code I expect, based on some CLI options...
(I'm using Copilot in VS Code, since we pay for it at work, and then I can use "any" model with it -- but I'm mostly using Claude Sonnet 4, in agent mode)