{"slug": "claude-code-mcp-setup-and-usage-rules", "title": "Claude Code MCP setup and usage rules", "summary": "A developer detailed a year-long effort to refine a Claude Code MCP setup, settling on four active servers across two machines: Context7 and CodeGraph on a work laptop, plus Discord and Chrome extension servers on a Mac mini. The developer found that the real work lies not in connecting MCP servers but in writing explicit rules in CLAUDE.md governing when each tool should be used, when to stop, and how to report failures, noting that without such rules tools are ignored or invoked redundantly.", "body_md": "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.\n\nOn 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.\n\nThe 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.\n\nI 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.\n\nThe 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.\n\nReviewing 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.\n\nMCP is less about the connection and more about the rules.\n\n*Originally published at [Homelab Notes](https://aisideincomelab.blogspot.com/2026/09/claude-code-mcp-setup-and-usage-rules.html) — notes from one Mac mini running local LLMs and 24/7 automation.*", "url": "https://wpnews.pro/news/claude-code-mcp-setup-and-usage-rules", "canonical_source": "https://dev.to/devlog/claude-code-mcp-setup-and-usage-rules-2l93", "published_at": "2026-09-23 06:42:56+00:00", "updated_at": "2026-09-23 06:52:40.255584+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "agent-protocols", "ai-products"], "entities": ["Claude Code", "MCP", "Context7", "CodeGraph", "Discord", "Chrome", "Search Console", "Homelab Notes"], "alternates": {"html": "https://wpnews.pro/news/claude-code-mcp-setup-and-usage-rules", "markdown": "https://wpnews.pro/news/claude-code-mcp-setup-and-usage-rules.md", "text": "https://wpnews.pro/news/claude-code-mcp-setup-and-usage-rules.txt", "jsonld": "https://wpnews.pro/news/claude-code-mcp-setup-and-usage-rules.jsonld"}}