aiagent.
A complete site for Claude Code + MCP agents — from setup to production-ready.
Articles
17 postsclaude-code-mcp-sigterm-keepalive-pattern
9 minMcp Tool Oauth Www Authenticate Meta
71 minObservability for Claude agents: tracing, cost tracking, and the dashboard you actually need
The fifth article closes the series with the production-readiness layer. Cover three observability planes: (1) per-run trace — every message, tool call, tool result, token count, and latency — emitted as structured JSON logs, (2) cost tracking — input vs output tokens per run, daily rollup, per-tool cost attribution, (3) the minimal dashboard — three panels (success rate, p50/p95 latency, daily cost) built with Grafana + Loki or a 50-line FastAPI + HTMX page. Unique angle: skip the 'use LangSmith / use Arize' recommendation and show a free, self-hosted stack that works for solo operators. Reader gets a `TracingAgentLoop` decorator that emits OpenTelemetry spans, a cost-calculation helper keyed to current Claude pricing, and a screenshot-walkthrough of the three-panel dashboard.
9 minError recovery and the tool-budget loop: stopping agents that spiral into 200 tool calls
The fourth article addresses the failure mode that kills production agents: infinite retry loops, tool-call spirals, and silent context exhaustion. Cover four concrete safeguards: (1) per-task tool budget with hard cutoff, (2) repeat-call detection (same tool + same args twice in a row → force a reflection step), (3) error classification (transient vs permanent → retry vs escalate), (4) explicit 'I'm stuck' tool that lets the agent ask for human input rather than guess. Unique angle: instrument a real agent against a deliberately broken tool (flaky network, malformed JSON, rate-limit 429s) and show the difference in tool-call count and final success rate with vs without each safeguard. Reader gets a `BudgetedAgentLoop` wrapper, the repeat-detection logic, and a runnable test harness that injects failures.
10 minStep 1: Scaffold a minimal MCP server with SSE transport and one slow tool
57 minWhen Your Local AI Agent Forgets: The Silent 1024-Token Context Ceiling in Ollama
9 minmcp resources/updated notification client fallback
Design an MCP server that emits `resources/updated` per spec but degrades gracefully on clients that currently ignore the notification (Claude Desktop, Claude Code) — etag-on-tool-call + lazy revalidation as a polling fallback so the same server works in both worlds.
11 minMCP Tool Error Response vs Python Exception: When to Raise and When to Return
Two error paths exist in the MCP python-sdk. Picking the wrong one breaks the LLM's retry loop or crashes your session. Here's the rule, plus the pattern that survives SDK version drift.
9 minPreToolUse Hooks in Claude Code: Validating Bash Before It Runs
Build a PreToolUse hook for Claude Code that vets every Bash command, blocks dangerous patterns, and logs the rest. Includes a working Python validator and denylist patterns.
6 minIsolate the Anthropic SDK Behind One Adapter: A Pattern for Agent Codebases
Wrap Anthropic Sonnet calls in a single adapter module to get testability, prompt versioning, retry policy, and cost tracking without scattering SDK calls across your agent codebase.
7 minAgent WebSocket Delegation: Auth, Envelopes, and Timeout Fallback
A practical pattern for delegating work from a server-side agent to a remote agent over WebSocket — handshake auth, typed message envelopes, and timeout fallback that doesn't leak tasks.
6 minMCP Config Scopes in Claude Code: User vs Project vs Local
How .mcp.json scope resolution works in Claude Code, where to put env vars, and a verification flow that catches broken servers before they break your session.
5 min