Skip to content(if available)orjump to list(if available)

Show HN: We made an MCP server so Cursor can debug Node.js on its own

arthurgousset

Cursor often gets into "dead loops" trying to fix code [1][2]. But, Cursor also seems to get out of dead loops when it adds `console.log` statements everywhere.

We thought: "What if Cursor could access Node.js at runtime?". That would save it from adding `console.log` everywhere, and still get out of dead loops.

We looked into it and got Cursor to debug Node.js on its own.

It's a prototype, but if you're interested in trying it out, we'd love some feedback!

Github: github.com/hyperdrive-eng/mcp-nodejs-debugger

---

References:

[1]: "At this point I feel like giving up on Cursor and just accept that WE'RE NOT THERE YET." ~Source: https://forum.cursor.com/t/cursor-for-complex-projects/38911

[2]: "We've all had the issue. You're trying to build a complex project with your AI companion. It runs into a dead loop, coding in circles, making suggestions it already tried that didn't work." ~Source: https://www.reddit.com/r/ChatGPTCoding/comments/1gz8fxb/solu...

bulatb

> Cursor often gets into "dead loops" trying to fix code [1][2]. But, Cursor also seems to get out of dead loops when it adds `console.log` statements everywhere.

Hah. That sounds like just... debugging.

arthurgousset

Yes! Cursor really wants to debug. Personally, I don't love when Cursor adds 100s of `console.log` diffs to my project. I like debuggers for that.

kilroy123

That's what console ninja's new thing is supposed to do. I haven't used it yet as you have to pay.

arthurgousset

Not affiliated with Cursor, but I think there is a free plan to try Cursor out. It's still a bit janky in my opinion, but it's an interesting new dev experience.

dsabanin

I haven't seen console ninja yet, thanks for mentioning it. It’s amazing!

mkw5053

I’ve been using Cursor extensively on TS projects and noticed a big improvement in speed and code quality by enforcing clear guardrails (strict types, linting, formatting) combined with rigorous TDD. When I hit an error or exception, I explicitly tell the agent to pause and first figure out the best way to debug and quickly pinpoint the root cause. This approach generally works well, provided I’ve decomposed the problem enough that we’re debugging just one thing at a time (though that’s not always trivial).

I’m interested to try this out to see if or how much it speeds things up further.

30minAdayHN

Co-author here. We found it pretty useful in our personal projects. Would love to hear your feedback on how it went.

If you come across any issues specific to your stack, happy to look into them.

wordofx

I used to run into dead loops until I changed the way I prompt cursor. Asking it to focus on 1 error at a time massively improves the success rate. Had an old project in node 10 project that hadn’t been touched since ~2017 and after several attempts with cursor. Asked if to fix 1 issue at a time until it moved from node 10>12>14…>22 and after about 15 minutes it succeeded. That included updating all the dependencies and removing deprecated/dead/dropped packages and getting them to latest and updating Vue from 1 to 3.5

30minAdayHN

That's a great tip. Similarly, when implementing features, breaking down into simpler things and making it focus on each step works really well.

We (co-author here) even tried to build a design doc tool that can fed to Cursor in that effect.[1]

[1] https://updates.priyank.ch/projects/2024/03/01/introducing-a...

vunderba

Related but I decided to try out Claude Code and one of the first things I noticed is that it didn't seem to be checking for basic transpilation errors (this was in a Typescript project). I added the following bit to the CLAUDE.md file (which is the equivalent of the assistant's LLM guidelines):

   - `npm run build` - Run TypeScript compilation + Vite build. You should periodically run this to check for errors.
 
And it made a pretty significant difference when "autotake suggestions" was on.

arthurgousset

Oh interesting, thanks for sharing! First time I hear about the `CLAUDE.md` file. Catching transpilation errors seems like a great use of custom instructions.

Do you have any other custom instructions in there?

vunderba

So my basic approach is:

1. Create the project folder

2. Initialize everything using a template scaffolding system (vite, nextjs, etc.)

3. Create a simple README.md which contains a list of the desired tech stack (for reinforcement purposes) and goal of the project.

4. Start up Claude

5. Use the `/init` command which creates the vanilla CLAUDE.md file

Interestingly, Claude captures all the NPM commands from the package json into the instructional file but the issue with this is that in my particular test case it kept trying to run `npm run dev` which spins up the app itself. That's... not ideal since I'm running it myself so it can hot-reload and I can see the changes applied immediately. I usually delete that line.

But I should note that I've never used any "agentic coding assistants" before (Aider.chat, Cursor, etc.) - so I'm sort of learning as I go.

One thing I'd be curious about is if there is a "clientside browser" MCP that Claude (or other assistants) can monitor - because ideally you'd really want Claude to be doing the following periodically:

- Taking a screenshot of the browser and using some multimodal system to sanity check

- Monitor the Dev Tools console for errors/warnings/etc.

- Read through the DOM to sanity check

So I have "npm run dev" already running and I could theoretically instruct Claude (or another system) to attach itself to the Chromium/Firefox browser window.

This MCP server seems to be focused on Node/serverside debugging.

anon7000

Cursor does have a loop with Claude which fixes lint & type issues which is nice

mdaniel

Up to you, but there's actually a formal logging pathway[1] in MCP that has the potential to put this message somewhere that either of the two consumers[2] of your service could see it https://github.com/hyperdrive-eng/mcp-nodejs-debugger/blob/v...

1: https://spec.modelcontextprotocol.io/specification/2024-11-0...

2: the person, and (while I don't have evidence of it) I also can't think why the LLM couldn't see the message, either

pcwelder

We'll have to look with fresh eyes on the print debugging vs debugger debate for LLMs.

LLMs can not only add tons of log statements fast but parse the large output from a program faster.

How exactly is debugger connection better for LLMs compared to log statements?

quectophoton

MCP = Model Context Protocol

(I didn't know what MCP was.)

mdaniel

And even that acronym expansion doesn't help, IMHO, whereas "a standard that's a cross between Language Server Protocol and OpenAPI, targeting LLM consumers" (emphasis on the API not AI) is hopefully a little better -- depending on whether the reader is already familiar with the problems that LSP and OpenAPI are solving

As far as I know there's still missing the UDDI-ish "discoverability" piece, although maybe one of the upcoming MCP standard releases will include /.well-known/mcp-servers type thing, or a SRV record, or both

spiritplumber

I instantly thought Master Computer Program, ngl.

breckenedge

I suspect that was intentional.

jasonjmcghee

Exciting to see more development in this direction!

I've been using a VS Code extension that I built to enable Claude / Cursor / Continue to automatically debug.

It's language agnostic and also uses MCP.

https://github.com/jasonjmcghee/claude-debugs-for-you

LSP and debugging support are incredibly useful for LLMs, and I'm hoping to see general support for these capabilities in the existing tools soon!

smcleod

Unless I'm misunderstanding this - Cline can do this off the shelf (no need to install & subscribe to cursor), I'm surprised you can't do this in cursor actually?

jadbox

Does it work with bun?

arthurgousset

Oh great question, we should look into other runtimes like bun, deno, etc.

Would you like to use it in a bun project?

jadbox

Yes please :)

bofadeez

This is really useful. LLMs need external feedback to self-correct reasoning.

https://arxiv.org/pdf/2310.01798

pkkkzip

this doesnt really help get out of loops in my experience

none of these agents or ide can fix the underlying issue with the blackbox

until the blackbox is capable of genuine reasoning and awareness

calculated brute force is our only path forward

30minAdayHN

It doesnt help with all death loops, but we were able to better guide LLMs towards the core of the problem. In some cases like RPCs, it helped LLM investigate state and fix the issue better.