agentleFS
giantswarmgiantswarm/muster/.cursor/rules/mcp-debugging.mdc

muster / rules

Cursor rule34 starsChanged 10 months agoApache-2.0View on GitHub

- Core Testing Loop - Whenever you change Go code and want to test the new functionality, you MUST follow these steps: 1. Restart the Service: Run the development restart script to rebuild and restart the muster service with your changes. 2. Initial Log Check: Verify that the service started correctly by checking the logs. Look for any startup errors or unexpected messages. - Debugging Examples - 1. Verify All Services Are Running: Start by checking the overall health of…

The file

Show its rules and text

We split this mcp-debugging.mdc into the rules it gives an agent

28 rules. About 0 are common, 21 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈21

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run the development restart script to rebuild and restart the muster service with your changes.

    line 9
  2. Distinctive:

    Verify that the service started correctly by checking the logs.

    line 14
  3. Distinctive:

    Look for any startup errors or unexpected messages.

    line 18
  4. Very specific:

    Use the mcp-debug tools to interact with the running service and test your new functionality.

    line 21
  5. Distinctive:

    Start by listing the available tools to ensure your new features are registered.

    line 22
  6. Very specific:

    Always use --no-pager: When using journalctl or systemctl, you MUST include the --no-pager flag.

    line 38
  7. Distinctive:

    Use mcp-debug tools as the primary debugging interface rather than manual inspection

    line 43
  8. Distinctive:

    Start by checking the overall health of the system:

    line 58
  9. Distinctive:

    Verify that all expected MCP servers are properly registered with the aggregator:

    line 63
  10. Very specific:

    Check its detailed status: core_service_status

    line 68
  11. Distinctive:

    Check if its MCP client is attached in the service list

    line 70
  12. Very specific:

    Use core_workflow_validate to check syntax

    line 72
  13. Very specific:

    Ensure tool names exist (check with mcp_mcp-debug_list_tools)

    line 73
  14. Distinctive:

    Verify argument schemas match the tool requirements

    line 74
  15. Very specific:

    All MCP servers services show "health": "Healthy" and "state": "Running"

    line 89
  16. Distinctive:

    Action: Check MCP server health, restart if needed

    line 128
  17. Distinctive:

    ✅ DO: Always clean up test ServiceClasses, Workflows, MCP servers and Services after debugging

    line 132
  18. Distinctive:

    ✅ DO: Use unique, identifiable labels for test instances (e.g., "debug-test-<timestamp>")

    line 133
  19. Distinctive:

    ❌ DON'T: Leave test ServiceClasses, Workflows, MCP servers and Services

    line 134
  20. Distinctive:

    Document the issue in the debugging session

    line 137
  21. Distinctive:

    Update the debugging workflow if new issues are discovered

    line 138
  22. Distinctive:

    Add specific examples to the common issues section

    line 139
  23. Distinctive:

    Create reproduction steps for any bugs found

    line 140
  24. Distinctive:

    NEVER skip health verification when debugging

    line 143
  25. Distinctive:

    ALWAYS clean up test instances after debugging sessions

    line 144
  26. Distinctive:

    DOCUMENT new issues in the documentation

    line 145
  27. Distinctive:

    USE mcp-debug tools as the primary debugging interface

    line 146
  28. Distinctive:

    FOLLOW a systematic approach rather than ad-hoc investigation

    line 147

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
mcp-debugging.mdc
---
description:
globs:
alwaysApply: false
---
- **Core Testing Loop**
  - Whenever you change Go code and want to test the new functionality, you **MUST** follow these steps:
    1. **Restart the Service:**
       Run the development restart script to rebuild and restart the `muster` service with your changes.
       ```bash
       ./scripts/dev-restart.sh
       ```
    2. **Initial Log Check:**
       Verify that the service started correctly by checking the logs.
       ```bash
       journalctl --user -u muster.service --no-pager |tail -n 50
       ```
    Look for any startup errors or unexpected messages.

  - **Test with `mcp-debug`:**
    - Use the `mcp-debug` tools to interact with the running service and test your new functionality.
    - Start by listing the available tools to ensure your new features are registered.
      ```
      # Example: List all tools from the mcp-debug server
      mcp_mcp-debug_call_tool(name="core_mcpserver_list_tools", arguments={ "serverName": "mcp-debug" })
      ```
    - Then, call the specific tools related to your changes to validate their behavior.
      ```
      # Example: Call a specific tool
      mcp_mcp-debug_call_tool(name="your_new_tool", arguments={...})
      ```
  - **Final Log Check:**
    - Inspect the logs again to see the output and any errors generated during your testing.
      ```bash
      journalctl --user -u muster.service --no-pager |tail -n 50
      ```
  - **Important Note**
    - **Always use `--no-pager`:** When using `journalctl` or `systemctl`, you **MUST** include the `--no-pager` flag. Without it, the output will be piped to a pager program, and you will not receive a response in the terminal.


- **Debugging muster via mcp-debug**
  - mcp-debug provides core debugging tools to test and explore the functionality of muster exposed in its aggregated MCP server.
  - Use mcp-debug tools as the primary debugging interface rather than manual inspection

- **mcp-debug Tools**
  - mcp_mcp-debug_list_tools: list all the tools exposed by the aggregated mcp server
  - mcp_mcp-debug_describe_tool: describe a tool exposed by the aggregated mcp server
  - mcp_mcp-debugcall_tool: execute a tool exposed by the aggregated mcp server

- **Aggregated MCP server**
  - The aggregated MCP server is exposed by muster. This is the main subject of development and debugging here.
  - The aggregated MCP server exposes tools via the model-context-protocol that you can explore via mcp-debug
  - The main functionality of muster is exposed through the tools that are prefixed with `core_*`
  - The aggregated MCP server can be compiled and restarted via `./scripts/dev-restart.sh`

- **Debugging Examples**
  - 1. Verify All Services Are Running:
    Start by checking the overall health of the system:
    ```
    mcp_mcp-debug_call_tool(name="core_service_list", arguments={})
    ```
  - 2. Check MCP Server Registration:
    Verify that all expected MCP servers are properly registered with the aggregator:
    ```
    mcp_mcp-debug_call_tool(name="core_mcpserver_list", arguments={})
    ```
  - 3. If a service shows as unhealthy:
      1. Check its detailed status: `core_service_status`
      2. Try restarting it: `core_service_restart`
      3. Check if its MCP client is attached in the service list
  - 4. Workflow validation fails:
    - Use `core_workflow_validate` to check syntax
    - Ensure tool names exist (check with `mcp_mcp-debug_list_tools`)
    - Verify argument schemas match the tool requirements

- **Important Notes**
  - The tools with the prefix `x_` are coming from the MCP servers that are managed by muster and then aggregated in its own MCP server. Please don't try to fix them. They are separate projects.
  - Tool names from individual MCP servers get prefixed like this `x_kubernetes_*` for the kubernetes MCP server and `x_prometheus_*`  for the prometheus MCP server

- **Debugging Approach**
  - Phase 1: System Health Verification
    ```
    mcp_mcp-debug_call_tool(name="core_mcpserver_list", arguments={})
    mcp_mcp-debug_call_tool(name="core_serviceclass_list", arguments={})
    mcp_mcp-debug_call_tool(name="core_workflow_list", arguments={})
    mcp_mcp-debug_call_tool(name="core_service_list", arguments={})
    ```
    Key Checks:
    - All MCP servers services show `"health": "Healthy"` and `"state": "Running"`
    - ServiceClasses show `"available": true`
    - No `missingTools` in ServiceClass definitions
  - ServiceClass-Specific Testing
    ```
    # Test specific ServiceClass availability
    mcp_mcp-debug_call_tool(name="core_serviceclass_available", arguments={"name": "<serviceclass-name>"})

    # Test instantiation with safe parameters
    mcp_mcp-debug_call_tool(name="core_service_create", arguments={
    "serviceClassName": "<name>",
    "label": "debug-test",
    "parameters": {...}
    })
    ```
  - Dependency Verification
    ```
    # Test underlying tools directly
    mcp_mcp-debug_call_tool(name="<required-tool>", arguments={...})

    # Verify connectivity to external systems
    ```
  - Service Recovery
    ```
    # Restart failed services
    mcp_mcp-debug_call_tool(name="core_service_restart", arguments={"label": "<service-name>"})

    # Check detailed status
    mcp_mcp-debug_call_tool(name="core_service_status", arguments={"label": "<service-name>"})
    ```
  - Service Instance Management
    ```
    # List and clean up test instances
    mcp_mcp-debug_call_tool(name="core_service_list", arguments={})
    mcp_mcp-debug_call_tool(name="core_service_delete", arguments={"instanceId": "debug-test"})
    ```

- **Tool Missing Errors**
  - **Pattern:** `missingTools` array not empty in ServiceClass list
  - **Action:** Check MCP server health, restart if needed
  - **Root Cause:** Usually failed MCP server initialization

- **Cleanup Protocol**
  - **✅ DO:** Always clean up test ServiceClasses, Workflows, MCP servers and Services after debugging
  - **✅ DO:** Use unique, identifiable labels for test instances (e.g., "debug-test-<timestamp>")
  - **❌ DON'T:** Leave test ServiceClasses, Workflows, MCP servers and Services

- **When Debugging ServiceClasses, Workflows, MCP servers and Services**
  - Document the issue in the debugging session
  - Update the debugging workflow if new issues are discovered
  - Add specific examples to the common issues section
  - Create reproduction steps for any bugs found

- **Mandatory Workflow Adherence**
  - NEVER skip health verification when debugging
  - ALWAYS clean up test instances after debugging sessions
  - DOCUMENT new issues in the documentation
  - USE mcp-debug tools as the primary debugging interface
  - FOLLOW a systematic approach rather than ad-hoc investigation

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.