Claude Code MCP setup and usage rules

Claude Code MCP setup and usage rules

I have been experimenting with various MCP servers for Claude Code. After over a year of trial and error, I have narrowed my setup to four active servers across two machines: two on my work laptop and two on my Mac mini. I also removed several others that didn't fit my workflow.

On my work laptop, Context7 is a staple. This MCP feeds the latest library and framework documentation to the model, preventing Claude from writing outdated API code based on its training cutoff. To optimize this, I added specific rules to my global CLAUDE.md instructing Claude to use Context7 automatically for code generation, configuration, migration, or example verification. Local documentation in the repository takes priority, with Context7 used for supplementation. Crucially, if a search fails or documentation is missing, Claude must explicitly state this before proceeding; this prevents the model from silently reverting to its own training data. I also added a rule that if a code analysis agent makes a claim about how a library works, Claude must verify it via Context7 or the web before applying changes.

The second tool on my laptop is CodeGraph, which uses tree-sitter to parse code into a graph of symbols, call relationships, and files. The key is separating structural queries from literal searches. I configured it so that questions about definition locations, callers, change impact, or signatures use the graph tool, while literal strings, comments, or log messages are handled by grep. To avoid inefficiency, I instructed Claude to answer "How does X work?" using one context tool call and two or three exploration calls, rather than looping through sub-agents and grep. I also established boundaries: since the graph updates approximately 0.5 seconds after a file is saved, Claude should not query it again in the same turn immediately after a modification. Furthermore, because graph results are parsing-based, Claude should not use grep to re-verify them. Without these rules, Claude would often run the graph tool and then immediately run grep to be sure, doubling the processing time.

I eventually removed my browser automation MCP because the connection died whenever the session changed, forcing constant restarts. It even left a note in its memory stating, "session dies between conversations, restart required." Ultimately, it was more stable to control the browser using direct scripts.

The setup on my Mac mini is different. One MCP handles Discord; a plugin allows me to use Claude Code as a Discord bot with tools for replying, reacting, and downloading attachments. In fact, I am writing this post based on instructions received through that interface. The other is a Chrome extension. While using it today to check Search Console, I found that screen captures kept timing out because the page was constantly loading; only reading the body text via JavaScript worked. Whenever I find a reliable method, I save it to the memory.

Reviewing my CLAUDE.md and work logs, it is clear that the real effort isn't in attaching the MCPs, but in defining the rules. Without those few lines in CLAUDE.md explaining when to use a tool, when to stop, and how to report failure, the tools are either ignored or used redundantly.

MCP is less about the connection and more about the rules.

Related posts

This post is the English edition of a Korean write-up: 원문 보기

Comments

Popular posts from this blog

npm command not found on Windows: fix the PATH

Tailscale without sudo: what userspace mode actually costs you

Claude CLI 401 Unauthorized Refresh Token Issue