MCP NodeJS Debugger

MCP NodeJS Debugger

允许 Claude 通过设置断点、检查变量和单步调试代码来直接调试 NodeJS 服务器。

Category
访问服务器

README

MCP Node.js 调试器

一个 MCP 服务器,允许 Cursor 或 Claude Code 在运行时访问 Node.js,以帮助您进行调试:@hyperdrive-eng/mcp-nodejs-debugger

演示

Cursor

https://github.com/user-attachments/assets/c193a17e-b0e6-4c51-82aa-7f3f0de17e1a

Claude Code

https://github.com/user-attachments/assets/adb7321b-3a6a-459b-a5c9-df365710d4d8

快速开始

Cursor

  1. 添加到 Cursor (~/.cursor/mcp.json)

    image

    + {
    +   "mcpServers": {
    +   "nodejs-debugger": {
    +      "command": "npx",
    +       "args": ["@hyperdrive-eng/mcp-nodejs-debugger"]
    +     }
    +   }
    + }
    
  2. 调试模式下运行 Node.js 服务器(即使用 --inspect 标志)

    node --inspect {file.js}
    
  3. 要求 Cursor 在运行时调试您的 Node.js 服务器

    image

Claude Code

  1. 添加到 Claude Code

    claude mcp add nodejs-debugger npx @hyperdrive-eng/mcp-nodejs-debugger
    
  2. 启动 Claude Code

    claude
    ╭───────────────────────────────────────────────────────╮
    │ ✻ Welcome to Claude Code research preview!            │
    │                                                       │
    │   /help for help                                      │
    │                                                       │
    │   Found 1 MCP server (use /mcp for status)            │
    ╰───────────────────────────────────────────────────────╯
    
  3. 调试模式下运行 Node.js 服务器(即使用 --inspect 标志)

    # 在另一个终端
    node --inspect {file.js}
    
  4. 要求 Claude Code 在运行时调试您的 Node.js 服务器

    > I'm getting a runtime error in Node.js 
    
      {YOUR_RUNTIME_ERROR}
      
      Please help me debug this error at runtime using the nodejs-debugger mcp.
    

用法

Claude Code

  1. 添加到 Claude Code

    claude mcp add nodejs-debugger npx mcp-nodejs-debugger
    
  2. 验证连接

    > /mcp
      ⎿  MCP Server Status
    
         • nodejs-debugger: connected
    
  3. 从 Claude Code 中移除

    claude remove nodejs-debugger
    

Cursor

  1. 添加到 Cursor (~/.cursor/mcp.json)

    + {
    +   "mcpServers": {
    +   "nodejs-debugger": {
    +      "command": "npx",
    +       "args": ["@hyperdrive-eng/mcp-nodejs-debugger"]
    +     }
    +   }
    + }
    
  2. 验证连接:

    image

  3. 从 Cursor 中移除 (~/.cursor/mcp.json):

    - {
    -   "mcpServers": {
    -   "nodejs-debugger": {
    -      "command": "npx",
    -       "args": ["@hyperdrive-eng/mcp-nodejs-debugger"]
    -     }
    -   }
    - }
    

示例

Cursor

  1. 运行这个简单的 Node.js 应用程序: github.com/mdn/express-locallibrary-tutorial:

    node --inspect ./bin/www
    
  2. 要求 Cursor 设置一个断点

    image

    image

  3. localhost:3000/catalog/book/create 创建一本书

    image

  4. 观察 Cursor 捕获运行时状态

    image

Claude Code

  1. 这是一个有 bug 的 Node.js 服务器:

    node --inspect index.js
    
    Debugger listening on ws://127.0.0.1:9229/2862f5a2-8618-4516-8429-1248b397e9b4
    
    #######################
    ## THE RUNTIME ERROR ##
    #######################
    MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://www.mongodb.com/docs/atlas/security-whitelist/
        at _handleConnectionErrors (/Users/arthur/Documents/thirdparties/mdn/express-locallibrary-tutorial/node_modules/mongoose/lib/connection.js:1110:11)
        at NativeConnection.openUri (/Users/arthur/Documents/thirdparties/mdn/express-locallibrary-tutorial/node_modules/mongoose/lib/connection.js:1041:11)
        at async main (/Users/arthur/Documents/thirdparties/mdn/express-locallibrary-tutorial/app.js:35:3) {
      reason: TopologyDescription {
        type: 'ReplicaSetNoPrimary',
        servers: Map(3) {
          'ac-8e6hgk7-shard-00-01.cojoign.mongodb.net:27017' => [ServerDescription],
          'ac-8e6hgk7-shard-00-02.cojoign.mongodb.net:27017' => [ServerDescription],
          'ac-8e6hgk7-shard-00-00.cojoign.mongodb.net:27017' => [ServerDescription]
        },
        stale: false,
        compatible: true,
        heartbeatFrequencyMS: 10000,
        localThresholdMS: 15,
        setName: 'atlas-5syy8t-shard-0',
        maxElectionId: null,
        maxSetVersion: null,
        commonWireVersion: 0,
        logicalSessionTimeoutMinutes: null
      },
      code: undefined
    }
    
  2. Claude Code 在运行时调试 Node.js 服务器:

    > I'm getting a runtime error connecting to mongoose. Please help me debug by checking the value of 
      the mongodb configs at runtime using the nodejs-debugger mcp.
    
      ⏺ I'll help you debug the mongoose connection issue using the Node.js debugger. Let's first understand where the
      MongoDB connection is configured.
    
      ⏺ Search(pattern: "**/*.js")…
        ⎿  Found 100 files
    
      ⏺ Let's set a breakpoint at the mongoose connection point and continue:
    
      ⏺ nodejs-debugger:set_breakpoint (MCP)(file:                                                                         …
            "/Users/arthur/Documents/thirdparties/mdn/express-locallibrary-tutorial/app.js",
             line: 35)
        ⎿  Breakpoint set successfully. ID:
           2:34:0:file:///Users/arthur/Documents/thirdparties/mdn/express-locallibrary-tutorial/app\.js
      
      ⏺ Let's list all our breakpoints:
      
      ⏺ nodejs-debugger:list_breakpoints (MCP)
        ⎿  [
             {
               "file": "/Users/arthur/Documents/thirdparties/mdn/express-locallibrary-tutorial/app.js",
               "line": 35,
               "id": "2:34:0:file:///Users/arthur/Documents/thirdparties/mdn/express-locallibrary-tutorial/app\\.js"
             }
           ]
      
      ⏺ Let's try to execute a specific piece of code to check the connection variables:
    
      ⏺ nodejs-debugger:nodejs_inspect (MCP)(js_code: "// Get the mongoose module and inspect connection\nconst mongoose = …
                                            require('mongoose');\nconsole.log('Current mongoose version:',
                                            mongoose.version);\nconsole.log('Current mongoose connection state:',
                                            mongoose.connection.readyState);\n// Log connection string safely (without
                                            password)\nconst connectionString = process.env.MONGODB_URI || \n
                                            \"mongodb+srv://cooluser:coolpassword@cluster0.cojoign.mongodb.net/local_library?retryWr
                                            ites=true&w=majority&appName=Cluster0\";\nconsole.log('Connection string
                                            (masked):', connectionString.replace(/(?<=mongodb\\+srv:\\/\\/\\w+:)(.+?)(?=@)/,
                                             '*****'));")
      
        ⎿  Console output:
           [log] Current mongoose version: 8.9.5
           [log] Current mongoose connection state: 0
           [log] Connection string (masked): mongodb+srv://cooluser:coolpassword@cluster0.cojoign.mongodb.net/local_library?retryWri
           tes=true&w=majority&appName=Cluster0
    
      ⏺ The runtime error you're seeing in your application is related to MongoDB
        Atlas connection issues. Based on your error message, the problem is:
      
        1. You're using placeholder credentials ("cooluser:coolpassword")
      
        To fix this, you have two options:
      
        1. Use a local MongoDB instance by changing line 29-30 in app.js to:
        const dev_db_url = "mongodb://127.0.0.1:27017/local_library";
        2. Or correctly set up MongoDB Atlas:
          - Log into Atlas at https://cloud.mongodb.com
          - Go to Network Access and add your current IP to whitelist
          - Create proper database credentials
          - Update the connection string with real credentials
      
        Which option would you like to proceed with?
    

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选