跳转到主要内容

WRITING

MCP in Practice: An Agent Ecosystem from Code Search to Gmail

April 12, 20264 min readTianli Zeng
aiagentmcpllmclaude
MCP in Practice: An Agent Ecosystem from Code Search to Gmail

MCP Isn't Just a Protocol — It's an Ecosystem

Model Context Protocol (MCP) lets an LLM call external tools, but the real value isn't in the protocol itself — it's in the tooling ecosystem you build around it. I currently have 3 MCP Servers integrated into Claude Code, and they cover the three core scenarios of my daily work.

The Three MCP Servers

Topology of Claude Code connected to three MCP servers — code-search, cclog and gmail — each with its own security boundary
Each server owns one scenario: code-search searches code, cclog searches sessions, gmail handles email — and each keeps a clean security boundary: code-search only indexes Git repos, gmail uses OAuth and never stores passwords.

code-search builds a semantic index for Git repositories so Claude can search code in natural language.

Typical usage:

  • "Find the middleware code that handles cookies"
  • "Which files deal with track-switching logic"
  • "Where's the core formula for water resources carrying capacity computation"

Its constraint is that it can only index Git repositories (a security policy choice) — it won't search files like ~/.personal_env. That's actually a feature: sensitive material is naturally isolated.

cclog is an MCP Server I wrote that builds a SQLite index over Claude Code's 512+ historical sessions.

Core API:

  • search_sessions(query) — keyword search across sessions
  • get_session_detail(id) — pull the full conversation log
  • get_daily_digest(date) — what got done on a given day

Why it matters: Claude Code drops the context the moment a session ends. cclog lets me retrieve across sessions — for example, "the session where I fixed deploy.sh last week, what exactly changed?"

3. gmail — Email Read/Write

A node-based Gmail MCP that supports searching, reading, sending, and labeling. Paired with the daily Briefing system, it powers automated information delivery.

Registration and Management

MCP Servers are registered in the mcpServers field of ~/.claude.json:

claude mcp add code-search -- code-search --mcp --mcp-auto-workspace
claude mcp add cclog -- python3 ~/Dev/cclog/src/cclog/mcp_server.py
claude mcp list  # verify

You must restart the CC session after editing this, otherwise the new server won't load.

A Cross-MCP Workflow Example

A typical multi-MCP workflow — "investigate last week's deployment issue":

Four-step cross-MCP sequence for investigating last week's deployment issue: two cclog lookups, code-search locating the script, gmail sending the notice after the fix
Four steps across three servers: cclog finds the session and surfaces the CSS-hash-mismatch root cause, code-search locates the deploy script, and gmail sends the notice after the fix — Claude orchestrates the whole flow with no manual tool-switching.
  1. cclog: search_sessions("deploy failure") → find related sessions
  2. cclog: get_session_detail(id) → pull the full transcript, discover it was a CSS hash mismatch
  3. code-search: codebase-retrieval("deploy.sh rsync") → locate the deploy script
  4. After fixing → gmail: send a notification email

Claude drives the whole flow autonomously — I never have to switch tools manually.

Lessons Learned

  1. MCP Servers should be small and focused: each server does one thing; combinations stay flexible
  2. Register globally, not per-project: use ~/.claude.json instead of .mcp.json so every project sees them
  3. Keep the security boundary explicit: code-search won't index non-Git directories; gmail uses OAuth, never stores passwords
  4. Fail gracefully: a downed MCP Server should never block the entire session

Next on my list: build MCP servers for the Cloudflare API and VPS state monitoring, so Claude can manage infrastructure directly.

FOLLOW

New posts land here first. Subscribe via RSS: /feed.xml

AUTHOR

Tianli Zeng

Hydraulic engineer. I write about AI methodology, daily investment reviews, and engineering practice.

Found a mistake, or have something to add?