calva

2025-06-18T08:37:57.883309Z

Hello, I'm encountering the following error from calva when try to start the lsp:

Segfault detected, aborting process. Use '-XX:-InstallSegfaultHandler' to disable the segfault handler at run time and create a core dump instead. Rebuild with '-R:-InstallSegfaultHandler' to disable the handler permanently at build time.

[Error - 11:34:16] Connection to server got closed. Server will not be restarted.
[Error - 11:34:16] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 11:34:16] Clojure Language Client client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
the origin might be the lsp itself but I figured I'd start here to see if anyone is familiar with it :)

pez 2025-06-18T12:08:09.682179Z

Not encountered. There’s a recent issue filed on Calva that may (probably not) be related: https://github.com/BetterThanTomorrow/calva/issues/2865

chromalchemy 2025-06-18T15:28:03.856829Z

I keep getting this warning when I jack in

The nREPL server does not support cider-nrepl `info` op, which indicates troubles ahead. You need to start the REPL with cider-nrepl dependencies met.
Here is my jack in output
Starting Jack-in: (cd /Users/ryan/dev/gbo; clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"1.3.1"},cider/cider-nrepl {:mvn/version,"0.52.1"}}}' -M:dev:clojurestorm:nrepl)
Using host:port localhost:7888 ...
Hooking up nREPL sessions ...
Connected session: clj
Evaluating code from settings: 'calva.autoEvaluateCode.onConnect.clj'
to support clojure-mcp, the :nrepl alias has this:
:nrepl {:extra-paths ["test"]
          :extra-deps {nrepl/nrepl {:mvn/version "1.3.1"}
                       cider/cider-nrepl {:mvn/version "0.56.0"}}
          :jvm-opts ["-Djdk.attach.allowAttachSelf"]
          :main-opts ["-m" "nrepl.cmdline" "--port" "7888"]}
Relevant docs doesnt speak on error.. https://calva.io/connect/ Is the alias deps redundant if Calva injects it? I noticed the cider-nrepl in the alias is a different version, is that a problem?

seancorfield 2025-06-18T15:30:45.732039Z

The -Sdeps versions will override (since they're considered explicit top-level deps and your other deps are under an alias).

seancorfield 2025-06-18T15:31:24.482239Z

You can edit the jack in dependencies in the settings JSON. I have:

"calva.jackInDependencyVersions": {
      "nrepl": "1.3.1",
      "cider-nrepl": "0.55.7",
      "cider/piggieback": "0.6.0"
    },

seancorfield 2025-06-18T15:32:10.772729Z

I would have expected 0.52.1 to support info just fine tho' -- it's not that old.

pez 2025-06-18T15:35:22.713899Z

Yes, info is probably from 0.0.1 or so. This is a bit strange…

pez 2025-06-18T15:38:17.225589Z

Can you hack clojure-mcp to use the nrepl port file?

dpsutton 2025-06-18T15:42:17.700729Z

:main-opts ["-m" "nrepl.cmdline" "--port" "7888"] you are explicitly not including middleware

dpsutton 2025-06-18T15:42:40.702429Z

i’ve found manually starting a separate nrepl server for mcp is far easier than juggling all the stuff and finding out which dynamic port was used, etc

seancorfield 2025-06-18T15:42:44.779069Z

Oh, good catch!

dpsutton 2025-06-18T15:44:07.513859Z

(ns nocommit.nrepl
  (:require
   [nrepl.server :as server]))

(defonce server nil)

(defn start!
  []
  (alter-var-root #'server
                  (fn [_] (server/start-server :port 7888))))

(defn stop!
  []
  (when server
    (server/stop-server server))
  (alter-var-root #'server (constantly nil)))

(comment
  (start!)
  server
  )
if you do this, you can just jack in as normal adn then run this code. even better you can put it at some stable location, and whichever project you want to expose to mcp you can run form a repl (load-file "location/nrepl.com") and then (nocommit.nrepl/start!) and that repl will be findable from claude

chromalchemy 2025-06-19T16:36:34.468909Z

@dpsutton @seancorfield Thanks for the specifics! 💡 Let me see if i understand this: My working project folder that is to be edited does not necessarily need to expose an nrepl. I jack into that with normal clojure command (existing calva jack in command). It does not need need any dependencies on, or knowledge of clojure-mcp (aliases). In a separate helper project, I start an nrepl server on port 7888 (with above code). It also does not need need any dependencies on, or knowledge of clojure-mcp (aliases). Claude is configured to run a clojure command that, in the default case, uses the :mcp alias from the clojure-mcp project deps.edn to run a main function that starts an nrepl client/server to talk to the nrepl on port 7888. This clojure-mcp-server command can be tested from the command line and ran from anywhere. So if this is accurate, I’m inferring that the nrepl that Claude talks to, does not need dependencies and other config from my working project. Because it can use clojure and the mcp tools to read files and load up stuff dynamically, via repl on 7888 (which is generic and reusable and doesn’t inherently know anything about my project)? What about the notion of a project path? If Claude is talking to reusable nrepl in a “stable” folder, how does it focus context and edits on the working project folder?

chromalchemy 2025-06-19T16:52:13.652659Z

ps. I think I have done something similar when trying to use babashka.nrepl.client for clojure-mcp to talk to a browser repl started by scittle. But I’m running all that out of the same project folder (maybe foolishly). Borkdude helped me out with that.

seancorfield 2025-06-19T17:03:11.882589Z

My understanding of @dpsutton suggestion was that you jack-in to your project as usual (and get a random port assigned) and then in that running REPL you eval the code he provided to start an additional nREPL Server (on port 7888) in the same runtime as your project's REPL that you just started via jack-in. MCP then talks to that second nREPL Server running in the same JVM process. Now you have two nREPL servers running in the same JVM in your project folder: the one you jacked-in from your editor and the one you started manually inside that first nREPL. Make sense?

💯 1
💡 1