6 ms·
Show HN: We made an MCP server so Cursor can debug Node.js on its own
- arthurgousset 2y agoCursor 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 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/solutions_for_dead_loop_problem_in_cursor_vs_code/ https://www.reddit.com/r/ChatGPTCoding/comments/1gz8fxb/solu...
- kilroy123 2y agoThat's what console ninja's new thing is supposed to do. I haven't used it yet as you have to pay.
- arthurgousset 2y agoNot 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 2y agoI haven't seen console ninja yet, thanks for mentioning it. It’s amazing!
- arthurgousset 2y agoOh good point, I didn't realise Console Ninja [1] is a product. Thanks for sharing! [1]: https://console-ninja.com https://console-ninja.com
- bulatb 2y ago> 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 2y agoYes! 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.
- laacz 2y agoCursor does not want anything. Eseesntially it adds tons of console.log because it's the thing training material says it should do next.
- pkkkzip 2y agothis 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 2y agoIt 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.
- quectophoton 2y agoMCP = Model Context Protocol (I didn't know what MCP was.)
- mdaniel 2y agoAnd 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
- drusepth 2y agoUDDI = Universal Description, Discovery and Integration (I didn't know what UDDI was.)
- spiritplumber 2y agoI instantly thought Master Computer Program, ngl.
- breckenedge 2y agoI suspect that was intentional.
- abrookewood 2y agoMe neither: MCP Servers are systems that provide context, tools, and prompts to AI clients. They can expose data sources like files, documents, databases, and APIs (https://mcp.so/ https://mcp.so/)
- wordofx 2y agoI 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 2y agoThat'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-alexandria.html https://updates.priyank.ch/projects/2024/03/01/introducing-a...
- arthurgousset 2y agoThanks for sharing! > Asking it to focus on 1 error at a time massively improves the success rate. Out of curiosity, how do you tell Cursor about the bug? Do you copy/paste console messages from the terminal into the prompt?
- wordofx 2y agoIn cursor you can whitelist commands. So I white list npm run. Then tell cursor to upgrade a dependency and run npm run build and if there’s errors. Fix the first error and repeat. Once the build is successful, run npm test and fix 1 test at a time. Takes some learning but once you figure it out it’s insanely powerful.
- flowerthoughts 2y agoThere's a facinating number of posts mentioning MCP in the last week or two. Many of them from young accounts, or accounts with a post years ago, then nothing, and suddenly MCP. MCP itself just seems to be JSON-RPC with a schema to be self-describing, so it's not really that interesting that it warrants one post per day. The web page touts it as the magic needed to ensure you don't have to write API adapters for your LLM uses. Well, except you need to write or use an MCP server to do the translation. So unless you're using one that already exists (though hundreds have been advertised on HN recently,) you're just shifting the problem by adding a layer of indirection. They also specifically say that authentication is something we'll work out later, so it seems none of these will have access to the data that actually has value. I have no idea about this account specifically, but I'm starting to suspect there's a bot ring somewhere.
- danielbln 2y agoMCP is a handy way to announce tools to the LLM it can use to interface with a service, usually remote. I use local mcp servers to pull on (authed) slack, notion, grafana and a few more into an agent like Cline. I don't think the HN post frequency is some bot thing, just seems to be something that's sticking with people as more and more mcp servers pop up. Makes wiring stuff together for agents to use easy to reason about.
- _pdp_ 2y agoI've been aware of MCP for a long time but recently I started hearing about it a lot more, even from customers - it is clearly a hype.
- mellosouls 2y agoA long time - are you confusing it with something else? It was only published 3 months ago, which would be why it has recently become a thing. https://www.anthropic.com/news/model-context-protocol https://www.anthropic.com/news/model-context-protocol
- fragmede 2y ago
- mdaniel 2y agoUp 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/v0.2.1/src/mcp-server.js#L73 https://github.com/hyperdrive-eng/mcp-nodejs-debugger/blob/v... 1: https://spec.modelcontextprotocol.io/specification/2024-11-05/server/utilities/logging/ 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
- arthurgousset 2y agoOh neat, thanks so much for sharing. I was getting MCP client errors when simply using `console.error`. Sending log message from the MCP server to the MCP client via the logging capability makes a ton of sense! ``` { "capabilities": { "logging": {} } } ```
- mkw5053 2y agoI’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 2y agoCo-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.
- arthurgousset 2y agoThanks for sharing! > 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. Out of curiosity, how do you tell Cursor about the bug? Do you copy/paste console messages from the terminal into the prompt?
- banana_dick_11 2y ago[flagged]
- jasonjmcghee 2y agoExciting 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 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!
- arthurgousset 2y agoOh cool, thanks for sharing! I like how your VS Code extension also adds the usual debugging cues like the red dot, the yellow line, and the call stack.
- jasonjmcghee 2y agoI didn't build any of that! I'm just interfacing with vs code debugger. It comes at no additional cost - it also means you are guaranteed all the other features of the standard vs code debugger as well, and can interrupt / collaborate / modify the debugging process alongside the llm.
- bofadeez 2y agoThis is really useful. LLMs need external feedback to self-correct reasoning. https://arxiv.org/pdf/2310.01798 https://arxiv.org/pdf/2310.01798
- pcwelder 2y agoWe'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?
- arthurgousset 2y ago> LLMs can not only add tons of log statements fast but parse the large output from a program faster. Absolutely valid point, LLMs probably have an easier time adding log statements to the source code and parsing output from the console. The debugger connection is "better" in certain cases because: 1. It avoids unnecessary diffs related to log statements. Currently, LLMs seem good at adding code, but forget to or struggle to delete code. 2. It avoids making logs noisy, although, admittedly, this can be managed with appropriate severity levels. 3. It provides more precise control over the program execution flow by stepping into, stepping over, and stepping out of lines.
- vunderba 2y agoRelated 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.
- anon7000 2y agoCursor does have a loop with Claude which fixes lint & type issues which is nice
- arthurgousset 2y agoOh 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 2y agoSo 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.
- jadbox 2y agoDoes it work with bun?
- arthurgousset 2y agoOh great question, we should look into other runtimes like bun, deno, etc. Would you like to use it in a bun project?
- jadbox 2y agoYes please :)
- kmaxwell 2y ago[flagged]
- smcleod 2y agoUnless 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?
- arthurgousset 2y agoGood point, I haven't used Cline yet. It looks like it can access console logs [1] > 4. Browser Integration > * Test web pages > * Capture screenshots > * Inspect console logs [1]: https://docs.cline.bot/exploring-clines-tools/cline-tools-guide#what-can-cline-do https://docs.cline.bot/exploring-clines-tools/cline-tools-gu...