shadow-cljs

Giu 2025-12-15T08:39:00.003429Z

Hi all. I put this because maybe is more related to this channel than ai-assited. How can I connect to the JS browser nrepl? I'm trying to connect from clojure MCP, and I'm don't know if I'm missing something, I think it's ok.

● clojure-mcp-clj - clojure_eval (MCP)(code: "(shadow/repl :app)")
  ⎿  To quit, type: :cljs/quit
     => [:selected :app]

● clojure-mcp-clj - clojure_eval (MCP)(code: ":repl/runtime-info")
  ⎿  No available JS runtime.
     See 
     => nil
I have the project running with npx shadow-cljs watch app and browser (firefox) opened at project:8000

thheller 2025-12-16T08:48:23.726049Z

the runtime is the browser, so if you close the tab or whatever it is gone. just opening it again should make the runtime available again.

thheller 2025-12-16T08:48:48.840269Z

maybe firefox puts the tab to sleep of some sort of disconnects the websocket? no clue

Giu 2025-12-16T08:52:44.297269Z

Yeah, maybe is something related to firefox, no idea, but should reconnect if I refresh right? but I have to stop "watch" server and start it again. Could be possible some change done on a file crash the reuntime with hot reloading?

thheller 2025-12-16T08:56:07.351649Z

I have no clue what you are doing, so anything is possible I guess. I'm not aware of any hard crashes in the code, but without knowing what you (or the LLM stuff) is doing I can't guess an answer.

thheller 2025-12-16T08:56:31.424579Z

yes, the runtime should reconnect if the refresh. again everything shadow-cljs does is logged to the browser console, so check that

thheller 2025-12-16T08:57:12.257019Z

and the UI at http://localhost:9630/runtimes should also always reflect the current state

thheller 2025-12-15T09:01:44.564669Z

no clue, need more information. how was clojure-mcp-clj started? how was shadow-cljs started? like the log? could be that there are just two different instances of shadow-cljs running? what does the browser log say? it should say shadow-cljs ready or so?

Giu 2025-12-15T09:25:44.663849Z

Hi @thheller well, good question. Mcp is started in the standard way I guess:

{
  "mcpServers": {
    "mcp-clojure": {
      "type": "stdio",
      "command": "clojure",
      "args": [
        "-X:mcp",
        ":port",
        "7888"
      ],
      "env": {}
    }
  }
}
shadow is started with npx shadow-cljs watch app
shadow-cljs - HTTP server available at 
shadow-cljs - server version: 3.3.2 running at 
shadow-cljs - nREPL server started on port 7888
shadow-cljs - watching build :app
[:app] Configuring build.
[:app] Compiling ...
It shouldn't be 2 instances. I only started one and don't see any claude background process. In browser, maybe related to this, I only see this when loading the project:
Installing CLJS DevTools 1.0.7 and enabling features :formatters :hints :async

shadow-cljs: #3 ready!    browser.cljs:20:8
browser is firefox BTW.

thheller 2025-12-15T09:27:44.691349Z

ok so it is connected. that confirms my theory that the mcp thing likely is running it its own JVM instance and not the one used by shadow-cljs

Giu 2025-12-15T12:05:10.222209Z

something I'm doing wrong?

thheller 2025-12-15T12:41:13.981909Z

can't say. I know absolutely nothing about mcp-clojure. can't figure it out without much more info or better an actual repo I can look at.

thheller 2025-12-15T12:42:27.386499Z

and that seems to be fine, but no clue what that actually does

Giu 2025-12-15T12:42:36.812569Z

Well, I noticed if I open :9630 dashboard page looks like now works. No idea if it's coincidence.

thheller 2025-12-15T12:43:16.590119Z

check if localhost:9631 is maybe also running

thheller 2025-12-15T12:43:31.884299Z

that would confirm there is a secondary instance somewhere

Giu 2025-12-15T12:43:49.991499Z

no, only 9630 showing to active runtimes

Giu 2025-12-15T12:44:16.066119Z

Will investigate and come back if I notice what could be the issue

Giu 2025-12-15T12:44:20.661689Z

but now is working

Giu 2025-12-15T20:32:10.196089Z

I noticed thath for some reason, no idea why or when, JS runtime disappars, and you have to stop adn start again the server to recover and be able to use it again