Skip to content

Commit 48862f4

Browse files
author
Bruce Hauman
committed
add section on shadow cljs to readme
1 parent e643de8 commit 48862f4

File tree

3 files changed

+62
-6
lines changed

3 files changed

+62
-6
lines changed

PROJECT_SUMMARY.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
# Clojure MCP Project Summary
22

3-
## Project Status
4-
5-
**⚠️ Alpha Software** - This project is in early development and rapidly evolving. While invaluable for Clojure development workflows, expect breaking changes, rough edges, and incomplete documentation. Community contributions are actively welcomed for bug reports, feature suggestions, documentation improvements, and code contributions.
6-
73
## Project Overview
84

95
Clojure MCP is a Model Context Protocol (MCP) server that enables AI assistants (like Claude) to interact directly with a Clojure REPL. It provides a collaborative, REPL-driven development workflow between humans and LLMs. The core philosophy is "tiny steps with high quality rich feedback" for effective development.
106

11-
**Recent Major Refactoring**: The project has been refactored to separate the core MCP API from its consumption, enabling easier customization and reuse. The new pattern uses factory functions (`make-tools`, `make-prompts`, `make-resources`) and a single entry point (`core/build-and-start-mcp-server`) for creating custom MCP servers.
12-
137
The project allows AI assistants to:
148
- Evaluate Clojure code and see immediate results
159
- Incrementally develop solutions with step-by-step verification

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,67 @@ If you continue to have issues, consider consulting with AI assistants (Claude,
371371
See the [Wiki](https://github.com/bhauman/clojure-mcp/wiki) for
372372
information on setting up other MCP clients.
373373

374+
## Working with ClojureScript (shadow-cljs)
375+
376+
ClojureMCP works seamlessly with [shadow-cljs](https://github.com/thheller/shadow-cljs) for ClojureScript development. Here's how to set it up:
377+
378+
### Quick Start
379+
380+
1. **Start your shadow-cljs server** with an nREPL port:
381+
```bash
382+
# Start shadow-cljs (it will use port 9000 by default, or configure in shadow-cljs.edn)
383+
npx shadow-cljs watch app
384+
```
385+
386+
2. **Configure Claude Desktop or other client** to connect to the the shadow-cljs nREPL port:
387+
388+
```
389+
{
390+
"mcpServers": {
391+
"clojure-mcp": {
392+
"command": "/bin/sh",
393+
"args": [
394+
"-c",
395+
"PATH=/opt/homebrew/bin:$PATH && clojure -X:mcp :port 9000"
396+
]
397+
}
398+
}
399+
}
400+
```
401+
402+
OR change the shadow port to 7888 (or whatever port you have configured) and leave your client config as is.
403+
404+
405+
3. **Switch to ClojureScript REPL** in Claude Desktop:
406+
407+
Once Claude Desktop is connected, prompt Claude to evaluate:
408+
```clojure
409+
(shadow/repl :app)
410+
```
411+
412+
Replace `:app` with your actual build ID from `shadow-cljs.edn`.
413+
414+
4. **All set!** Now all `clojure_eval` calls will be routed to your ClojureScript REPL, allowing you to:
415+
- Evaluate ClojureScript code
416+
- Interact with your running application
417+
- Use all ClojureMCP tools for ClojureScript development
418+
419+
### Switching Back to Clojure
420+
421+
To exit the ClojureScript REPL and return to Clojure, have Claude evaluate:
422+
```clojure
423+
:cljs/quit
424+
```
425+
426+
### Tips for shadow-cljs Development
427+
428+
- **Build Selection**: Use the appropriate build ID (`:app`, `:main`, `:test`, etc.) based on your `shadow-cljs.edn` configuration
429+
- **Hot Reload**: shadow-cljs hot reload continues to work normally while using ClojureMCP
430+
- **Browser Connection**: Ensure your browser is connected to shadow-cljs for browser-targeted builds
431+
- **Node.js Builds**: Works equally well with Node.js targeted builds
432+
433+
This integration gives you the full power of ClojureMCP's REPL-driven development workflow for ClojureScript projects!
434+
374435
## Starting a new conversation
375436

376437
Once everything is set up I'd suggest starting a new chat in Claude.

src/clojure_mcp/tools/unified_read_file/tool.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
([nrepl-client-atom {:keys [max-lines max-line-length]
2424
:or {max-lines 2000
2525
max-line-length 1000}}]
26+
;; TODO this is naive and is a problem for files that are just one line
2627
{:tool-type :unified-read-file
2728
:nrepl-client-atom nrepl-client-atom
2829
:max-lines max-lines

0 commit comments

Comments
 (0)