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:8000the 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.
maybe firefox puts the tab to sleep of some sort of disconnects the websocket? no clue
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?
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.
yes, the runtime should reconnect if the refresh. again everything shadow-cljs does is logged to the browser console, so check that
and the UI at http://localhost:9630/runtimes should also always reflect the current state
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?
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.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
something I'm doing wrong?
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.
https://github.com/bhauman/clojure-mcp?tab=readme-ov-file#working-with-clojurescript-shadow-cljs is all I can look at
and that seems to be fine, but no clue what that actually does
Well, I noticed if I open :9630 dashboard page looks like now works. No idea if it's coincidence.
check if localhost:9631 is maybe also running
that would confirm there is a secondary instance somewhere
no, only 9630 showing to active runtimes
Will investigate and come back if I notice what could be the issue
but now is working
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