Skip to content

[MCP] Serialize state-mutating tool calls with an in-process lock #550

Description

@manoahLinks

Summary

saveState() is called from several async tool handlers. Concurrent calls (for example setup_wallet and register) can interleave read-modify-write on the module-level wallet and API key state and lose an update.

Scope

  • Keep the implementation aligned with the existing MindVault architecture.
  • Add or update automated tests.
  • Update docs when the change affects contributors, deployers, or agent users.

Acceptance criteria

  • State-mutating tools run under a single in-process async lock so reads and writes cannot interleave.
  • A test drives two concurrent mutating calls and asserts both results are persisted.
  • Failure cases are deterministic and safe to show in issue-driven contributor work.
  • Relevant local tests pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: mcpMCP server for AI agents (mcp/)difficulty: mediumModerate effort; touches a couple of areas or needs some contexttype: featureNew functionality or capability

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions