MCP stdio server returns stale data — ignores database changes across sessions

Resolved 💬 5 comments Opened Mar 24, 2026 by gweberpe-lang Closed Apr 26, 2026

Summary

An MCP server configured via stdio in project settings.json returns stale tool results even after:

  • The underlying database has been updated (confirmed via direct SQLite query — 35 documents exist)
  • The MCP config was removed and re-added
  • A full machine reboot
  • Starting a completely new CLI session with the config already in place before MCP spawn
  • The binary (dist/index.js) was modified with a diagnostic writeFileSync at the top — the file was never created, suggesting Claude Code is not executing the binary it was pointed at

Environment

  • macOS (Darwin 25.3.0), Apple M4 Max
  • Claude Code CLI (latest as of 2026-03-24)
  • MCP server: custom Node.js stdio server (TheologAI)

Reproduction

MCP config (~/.claude/projects/<project-path>/settings.json):

{
  "mcpServers": {
    "theologai": {
      "command": "node",
      "args": ["dist/index.js"],
      "cwd": "/Users/gregoryweber/Projects/Personal/TheologAI"
    }
  }
}

Steps:

  1. MCP server has a SQLite database with 35 documents
  2. classic_text_lookup with listWorks=true returns only 17 (the original set before a batch of 18 were added)
  3. A different project (bible-study) with an identical MCP config correctly returns all 35 documents
  4. Removing the config, rebooting, re-adding, and starting a fresh session does NOT fix the stale project

Expected:

classic_text_lookup should return all 35 documents in all projects pointing to the same server.

Actual:

One project is permanently stuck on the old 17-document result. The other project works correctly.

What was ruled out

  • Database issue: Direct SQLite queries confirm 35 docs. The working project confirms 35 docs via the same MCP tool.
  • Code/build issue: Same dist/index.js, same cwd, same database path in both projects.
  • Config format: Tried both absolute and relative paths in args — no difference.
  • Session state: Full machine reboot + fresh session with config pre-loaded — still stale.
  • Binary execution: Injected writeFileSync at top of dist/index.js — file was never created, suggesting the binary may not actually be executing (or a cached/different process is responding).

Hypothesis

Claude Code appears to cache MCP stdio subprocess state at a per-project level in a way that survives config removal, session restarts, and machine reboots. One project's MCP connection is permanently stuck on a snapshot of the server's state from before a database update.

🤖 Generated with Claude Code

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗