Skip to content

Bug: secfoo mcp sync --agent agent crashes on a non-object ~/.cursor/mcp.json and drops its other keys #170

Closed

Description

@vsn411

Problem: sync_cursor() handles ~/.cursor/mcp.json badly in two ways:

  1. It reads the file with json.loads(...).get("mcpServers", {}). If the top level isn't a JSON object (for example []), that raises AttributeError and the user sees a traceback.
  2. It writes back {"mcpServers": existing}, which drops every other top-level key the user had in that file.

Build:

  • Load the whole file. If the top level isn't an object, return a failed SyncResult that names the file (as the invalid-JSON branch does today).
  • Treat a mcpServers value that isn't an object the same way.
  • When writing, update only root["mcpServers"] and keep every other key.

Where to look: src/secfoo/mcp.py (sync_cursor), tests/test_mcp.py (test_sync_cursor_*).

Done when: there are new tests for (a) a top-level [], (b) "mcpServers": [], and (c) an extra top-level key kept after a sync, and the existing cursor tests still pass.

Activity

  1. added
    bug
    good first issue
    help wanted
    hackathon
    difficulty: low
    on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdifficulty: lowgood first issuehackathonhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions