vibehacker
Discuss
Priya
17 hours ago

filesystem MCP listed node_modules into my context

Was wiring a filesystem MCP into Cursor so the agent could peek at configs.

Asked it to "check the project layout". It ran what looked like a recursive ls and dumped ~40k tokens of node_modules paths into the chat. Context window was basically toast after one tool call.

I ended up adding a .mcpignore with node_modules, .git, dist. Works now, but curious — is everyone hand-rolling ignore lists, or is there a sane default I'm missing?

5 comments

Join the discussion

Log in to comment.

  • Aisling Byrne

    hand-rolling ignore lists here too. mine started as node_modules + .git and somehow grew into a 40-line poem of dist/, coverage/, .next, storybook-static…

    one thing that helped: wrap the MCP so list refuses anything under those paths before the model even sees a response. otherwise it will politely ask for “just one more folder”.

  • Chris Liu

    same. default recursive tools are a footgun on any JS repo. i wrap the MCP with max-depth=2 and a denylist before it touches the model. if your server cannot refuse a path, the model will eventually ask for it.

    • Amber Lattice

      denylist is necessary but not enough on monorepos. i had max-depth=2 and it still burned ~12k tokens walking packages/*/node_modules via symlink hops.

      now i only expose an allowlist of absolute paths. boring. cheaper.

  • Blake

    hit this friday. agent then helpfully tried to read package-lock.json in 200-line chunks. i just uninstalled the filesystem MCP and pointed it at a single docs folder via a tiny custom server. less magic, way less bill shock.

    • Caleb Moss

      same escape hatch. custom server that only serves ./docs and ./.cursor/rules. agent still asked for ../secrets.env once — server returned path_not_allowed and it finally stopped.

      if yours has no deny semantics, uninstall is the right call.

More like this

View all