Summary
The MCP JSON-RPC endpoint in mcp-memory-service treats all authenticated requests with only OAuth read scope as fully authorized to invoke tools, including mutating ones.
As a result, clients with read-only tokens can store and delete semantic memory entries through MCP, even though equivalent REST APIs correctly require write scope, enabling unauthorized data modification.
Affected context
This vulnerability appears in deployments of mcp-memory-service that expose the HTTP MCP JSON-RPC endpoint at /mcp and rely on OAuth scopes to distinguish read-only from write-capable clients.
It manifests when the service dispatches tools/call requests without re-checking whether the caller holds the write scope for tools that persist or delete data.
Environments where the REST API is correctly locked down by scope but MCP is enabled may unknowingly provide a parallel path for state-changing operations to read-only clients.
Exploit preconditions
- Attack surface: The HTTP MCP JSON-RPC endpoint at
/mcp, reachable over the network where the service is deployed. - Required access: A valid OAuth token with at least
readscope; nowritescope is required. - Trigger point: Sending
tools/callJSON-RPC requests via MCP to handlers such asstore_memoryordelete_memory. - Why exploitation is possible: The MCP dispatcher treats all authenticated callers as authorized for all tools and ignores the distinction between
readandwritescopes that is enforced on the REST endpoints.
Why this happens
The underlying issue is a missing authorization check on a specific interface: the MCP JSON-RPC endpoint applies a coarse-grained "is authenticated" check but does not enforce fine-grained, operation-level authorization based on OAuth scopes.
While the REST API methods for storing and deleting memory explicitly require write scope, the MCP layer routes tools/call directly to the same mutating handlers without verifying that the caller has equivalent permissions.
This mismatch between authorization policies across interfaces exemplifies CWE-862: Missing Authorization, where a code path performs sensitive actions without validating whether the requester is permitted to execute them.
Conceptually, the design assumes that MCP requests are read-only or already authorized, but the implementation fails to encode this assumption as explicit checks before executing state-changing operations.
Potential impact
- Read-only OAuth clients may create new memory entries, altering the semantic state used by AI applications.
- Read-only OAuth clients may delete or overwrite existing memory, causing data loss or corruption.
- Application behavior can be influenced by injecting misleading or malicious semantic memory content.
- Audit trails and access-control expectations can be undermined if write actions are attributed to tokens believed to be read-only.
- In multi-tenant or shared environments, one tenant's read-only client could potentially affect another tenant's data if isolation controls are weak.
General mitigation guidance
Effective mitigation centers on ensuring consistent, least-privilege authorization across all access paths to mutating operations.
Recommended defensive patterns include:
- Enforcing operation-level authorization in the MCP dispatcher so that each
tools/callis checked against the caller's scopes or roles before invoking handlers. - Aligning authorization policies between REST and MCP by centralizing scope checks in a common service that both interfaces must call.
- Designing tools and handlers with explicit metadata describing required permissions (e.g., "read", "write", "admin") and validating these at runtime.
- Applying the principle of least privilege to OAuth clients, issuing
writescope only to clients that genuinely need it and segregating credentials by use case. - Implementing defense-in-depth with server-side configuration that treats all new tools as requiring explicit permission mapping before they can be exposed via MCP.
How teams detect issues like this
Organizations can detect this class of issue by examining both configuration and code for authorization consistency:
- Use static analysis or code search to locate endpoints that perform state-changing operations and verify they all invoke a common authorization layer.
- Review MCP dispatcher logic and tool registration code for the presence (or absence) of scope and role checks before invoking handlers.
- Implement policy-as-code (e.g., via Open Policy Agent or similar engines) to define required scopes per operation and enforce that all interfaces consult these policies.
- Monitor logs for anomalies, such as tokens marked as
readperforming operations that correspond to writes, and configure alerts when read-scoped clients trigger mutating behavior. - Integrate automated security tests that attempt to perform write operations using read-only credentials over each exposed protocol (REST, MCP, gRPC, etc.) in CI pipelines.

