MCP (Model Context Protocol) lets agents access tools running outside the agent process — databases, APIs, filesystems, internal services. This lesson covers MCP server configuration, the project-vs-user distinction, environment variable handling, and the built-in tools (Read, Write, Edit, Bash, Grep, Glob).
Project-Level vs User-Level MCP Config
| File | Scope | Use for |
|---|---|---|
.mcp.json (in repo) | Project — version-controlled, shared with team | Standard team integrations: Jira, GitHub, internal APIs |
~/.claude.json | User — personal, NOT shared via git | Experimental tools, personal credentials, sandbox servers |
Tools from ALL configured servers are available simultaneously. There's no "active server" — the agent sees the union.
The Standard Config Shape
{
"servers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": { "GITHUB_TOKEN": "${GITHUB_TOKEN}" }
}
}
}
Environment Variable Expansion — Never Commit Secrets
The ${VAR} syntax expands at runtime. Set GITHUB_TOKEN in your shell environment; the config references it without storing the actual value. This is the only safe way to use credentials in .mcp.json — committing raw tokens to git is a hard fail in any security review.
Choose Existing Community Servers
For standard integrations (Jira, GitHub, Slack, Notion), use community-maintained MCP servers via npx -y @modelcontextprotocol/server-X. Building your own only makes sense for proprietary internal systems. The community servers are tested across thousands of users — your own implementation will lag in coverage.
Resources for Content Catalogs
MCP supports resources in addition to tools. Resources expose static content (documentation, product catalogs, knowledge bases) that the agent can reference without calling a tool. This reduces exploratory tool calls — instead of "list documents, then read document X", the agent sees the catalog directly.
Built-in Tools
| Tool | Use for |
|---|---|
| Grep | Searching file contents for patterns: function names, error messages, imports |
| Glob | Finding files by path/name patterns: **/*.test.tsx |
| Read | Loading the full contents of a file |
| Write | Full file creation or replacement |
| Edit | Targeted modification using unique anchor text matching |
| Bash | Command execution for things outside the file-tool surface |
Edit Failure Recovery
The Edit tool requires the anchor text (old_string) to be unique in the file. If Edit fails because the anchor matches multiple locations, fall back to Read + Write: read the file, modify in memory, write the full new contents back.
Skills to Develop
- Configure project-level MCP servers in
.mcp.jsonwith environment-variable expansion for credentials. - Choose community MCP servers over custom builds for standard integrations.
- Expose static content as MCP resources to reduce exploratory tool calls.
- Pick the right built-in tool for the job: Grep for content, Glob for paths, Read for full files, Edit for targeted changes.
.mcp.json. Use ${VAR} expansion. If a question describes a credential leak via committed config, the answer involves environment variable references.