Configures Claude Code hooks and Codex hooks.json/notify. Use when adding PreToolUse guards, Stop hooks, managed hooks, format-on-save, preflight, audits, or worktree/budget hooks.
日本語の概要は準備中です。原文の説明を表示しています。
Configures and hardens Claude Code and Codex MCP servers. Use when connecting databases, APIs, SaaS, building servers, or serving a clearance-filtered knowledge base.
インストールする前に、エージェントに与えられる指示の中身を確認できます。
Use this skill to decide whether MCP is the right abstraction, configure existing servers in Claude Code or Codex, or build a narrow custom server when repeated agent workflows justify it.
Protocol revision is a lookup, not a constant. Before building or migrating a server, open the newest revision listed at modelcontextprotocol.io/specification, read its changelog and its deprecated-features registry, and record which revision your server targets. The answer decides which shapes below apply and which features are migration debt.
Breaking boundary to know: the 2026-07-28 revision redesigned the protocol relative to 2025-11-25 (changelog):
initialize/notifications/initialized handshake and the Mcp-Session-Id header were removed (SEP-2567, SEP-2575). Every request carries its protocol version and client capabilities in _meta; a mandatory server/discover RPC advertises supported versions and identity. Servers needing cross-call state mint explicit handles passed as ordinary tool arguments.roots/list, sampling/createMessage, and elicitation/create were replaced by Multi Round-Trip Requests (MRTR): the server returns resultType: "input_required" with inputRequests, and the client retries the original request carrying inputResponses.resources/subscribe/unsubscribe collapse into one subscriptions/listen stream; SSE resumability (Last-Event-ID) was removed, so a broken stream means re-issuing the request with a new ID. ping and logging/setLevel were removed. HTTP+SSE transport is formally Deprecated; use Streamable HTTP.The deprecation clock is the planning fact. The spec has a formal feature lifecycle (Active / Deprecated / Removed) with a minimum twelve-month deprecation window (SEP-2596). Anything built on a deprecated feature has a bounded lifetime: treat it as migration debt from the start. The window is a floor, not a promised removal date; check the registry for the current state.
SDK release lines move independently of the spec. Which SDK major version targets which revision, and how long the older line gets fixes, is a lookup in the SDK repo's README (see Build a Custom Server).
Governance (a vendor-trust input, not a technical one): Anthropic donated MCP to the Agentic AI Foundation, a directed fund under the Linux Foundation, in December 2025 (blog.modelcontextprotocol.io/posts/2025-12-09-mcp-joins-agentic-ai-foundation). The maintainers keep technical authority through the SEP process. When a security review asks "who owns this protocol", cite the foundation, not Anthropic.
Do not use MCP for one-off HTTP calls or for giant generic wrappers when a simpler direct tool will do.
Pick the lightest surface that does the job, in this order: a rule or hook when it must fire on every matching path or event with no judgment; a skill for a playbook loaded only when needed; MCP for a structured tool interface several clients call repeatedly; a local CLI or script for a simple local action; a direct API call for one narrow remote step.
Enable a server by default for everyone only if both hold: (1) nearly every user of the harness needs it, and (2) the job needs what MCP adds (session state, streaming, an auth handshake, structured browsing) rather than stateless request and response a CLI wrapped in a skill could serve. If either fails, make it opt-in per project: unless deferred loading is confirmed active, a default server's tool schemas load into every session whether used or not.
stdio/.well-known/oauth-protected-resource (RFC 9728), and Client ID Metadata Documents as the primary client-registration mechanism (Dynamic Client Registration is now backwards-compat only). Plain OAuth 2.0 is not spec-compliant. See references/mcp-security.md.isError: true, not as protocol errors (see Tool Result Contract)Prefer CLI setup over hand-editing config. Keep server options before --; everything after it is passed to the stdio command. Check claude mcp add --help for option placement in the installed build (CLI setup docs).
# stdio (local): postgres example; pick a maintained server from the registry first
claude mcp add postgres \
--scope project \
--env POSTGRES_URL=postgresql://user:pass@localhost:5432/app \
-- npx -y <maintained-postgres-mcp-server>
# Streamable HTTP (remote) — Linear example
claude mcp add --transport http linear-server https://mcp.linear.app/mcp
# Remote with bearer token header
claude mcp add --transport http \
--header "Authorization: Bearer ${SENTRY_TOKEN}" \
sentry https://mcp.sentry.io/mcp
claude mcp list
claude mcp get postgres
claude mcp remove postgres
Use .mcp.json for project-shared config. Scope options: local (default, you only, this project), project (.mcp.json), user (all your projects). Both local and user entries live in ~/.claude.json, not in a separate mcp.json.
The codex mcp add CLI covers both transports: stdio via --env + the -- separator, and Streamable HTTP via --url. There is no --transport flag: transport is inferred from --url vs. a trailing -- <command>. Confirm the flags your build accepts with codex mcp add --help before scripting them.
# stdio (local helper) — CLI path
codex mcp add repo-tools --env API_KEY=secret -- node ./dist/index.js
# Streamable HTTP (remote) — CLI path, bearer token via env var
codex mcp add figma --url https://mcp.figma.com/mcp --bearer-token-env-var FIGMA_OAUTH_TOKEN
codex mcp login figma # OAuth handshake for a server that needs it (or --oauth-client-id / --oauth-resource on add)
codex mcp list
Edit ~/.codex/config.toml directly for fields the CLI doesn't expose — modular tool gating (enabled_tools/disabled_tools, default_tools_approval_mode), static http_headers, and OAuth callback ports:
# ~/.codex/config.toml — remote Streamable HTTP server, full field set
[mcp_servers.figma]
url = "https://mcp.figma.com/mcp"
bearer_token_env_var = "FIGMA_OAUTH_TOKEN"
startup_timeout_sec = 10
Scopes mirror Claude Code: ~/.codex/config.toml is global; a project-root .codex/config.toml is project-scoped (trusted projects only). Full schema — env, tool gating, OAuth callback — in references/mcp-custom.md.
| Concern | Claude Code | Codex |
|---|---|---|
| Add stdio server (CLI) | claude mcp add NAME -- cmd args | codex mcp add NAME -- cmd args |
| Add remote HTTP server | claude mcp add --transport http NAME URL | codex mcp add NAME --url URL |
| Project-shared file | .mcp.json (mcpServers) | .codex/config.toml ([mcp_servers.NAME]) |
| Per-server env | --env K=V / JSON env | [mcp_servers.NAME.env] table |
| Remote auth header | --header "Authorization: Bearer …" | bearer_token_env_var or [mcp_servers.NAME.env_http_headers] |
| Per-tool approval | permission settings | default_tools_approval_mode, per-tool approval_mode |
Transport rule is identical for both: stdio for local helpers, Streamable HTTP for remote shared services.
Before relying on any MCP server:
mcp listFor a scripted connection check, run bash scripts/mcp_health_check.sh from the skill directory. Use --server NAME for a named server; Claude Code can omit WebSocket servers from mcp list. Run the script's offline regressions with python3 scripts/test_mcp_health_check.py. Its --verbose option explains the evidence boundary without printing raw configuration or server responses.
If auth fails:
Do not loop on auth failure.
Before building anything custom:
https://registry.modelcontextprotocol.ioEnd-to-end recipes for the requests this skill actually receives. Each ends at a hardened, verified state — not a bare connection.
@modelcontextprotocol/server-postgres was moved to the servers repo's archive, so do not install it for new work.references/mcp-for-dwh.md, Layer 1).claude mcp add postgres --scope project --env POSTGRES_URL=… -- <server command> (Codex: [mcp_servers.postgres] stdio block + [mcp_servers.postgres.env]).mcp list → mcp get → one low-cost SELECT … LIMIT 1.inputSchema, outputSchema for structured returns. Use the SDK's high-level server API; look up its current class and import path in the SDK README for your major version (references/mcp-custom.md). Return failures as isError results (references/mcp-patterns.md).mcp-patterns.md REST + pagination patterns).npx @modelcontextprotocol/inspector before wiring any client.stdio; shared → Streamable HTTP bound to 127.0.0.1 with Host/Origin validation.claude mcp add --transport http NAME URL (+ --header if it takes a bearer token). Codex: codex mcp add NAME --url URL --bearer-token-env-var VAR_NAME, then codex mcp login NAME if it needs OAuth.claude mcp list, then check the session's context breakdown (/context) to see what tool definitions actually cost. Per-server costs vary too much to estimate.ENABLE_TOOL_SEARCH.enabled_tools/disabled_tools./mcp panel instead of deleting its config. Claude Code records the choice per project in ~/.claude.json (disabledMcpServers), and the server stays listed as disabled.../software-paas-hosting/references/aws-bedrock-agentcore.md, Gateway section).references/mcp-servers.md, Server Categories).A tool result is read by a model, not by a program. It is the model's only signal for what to do next. Rules 1–5 come from the protocol and hold across SDKs and clients. Rule 6 and the completeness deviation in rule 3 are design practice from one project (morluto/rea; see data/sources.json), not protocol requirements. Generic tool-schema design lives in ../ai-agents/references/tool-design-specs.md; this section owns the MCP result contract.
isError: true and a text block the model can act on.No customer with id "c_91". Find the id with search_customers(email=...). No stack traces, internal hostnames, or secrets.limit/cursor arguments and set a small default page. When you truncate, say so and give the continuation, for example "showing 50 of 1,240; call again with cursor=...". Clients enforce their own output caps. Claude Code warns above one threshold and truncates at another, configurable with MAX_MCP_OUTPUT_TOKENS; look up the current values in its MCP docs. Never use the client cap as your bound. Deviation: when the answer depends on completeness (absence, equivalence, diff), never page or truncate silently. Return the whole result. If it exceeds the server's configured response budget (set at or below the smallest receive limit among the clients you support, and configurable), return a typed error (isError: true with a machine-readable reason) that carries a reference the caller can pass to a paging or view tool on the same connection.detail/response_format argument for more. Put human-readable names next to opaque IDs. Declare outputSchema and return structuredContent when a caller parses the result, with a text rendering as well. Return a resource_link instead of inlining large payloads.instructions field to say when this server's tools apply.unknown. When the server derives relationships, mark observed facts apart from inferred edges and keep unresolved edges.Worked result shapes (error vs success, pagination, idempotency keys) are in references/mcp-patterns.md.
Claude Code can defer MCP tool schemas. Tool names and short descriptions load at session start; full schemas load on demand through a search tool. This cuts tool-definition overhead for large fleets, and tool-selection accuracy drops when many tools load at once. Because only names and short descriptions are visible up front, name each tool for the task a user would describe and group a server's tools under one prefix (tickets_search, tickets_update) so search finds them together. The controls belong to Claude Code, not to the protocol:
| Control | Purpose |
|---|---|
ENABLE_TOOL_SEARCH unset | the documented default behaviour |
true / false | force search on / load every schema upfront |
auto / auto:N | threshold mode: upfront while tool definitions fit under a share of the context window (N = custom percentage), search above it |
per-server alwaysLoad | keep a small, always-needed server's tools loaded |
server instructions | tell tool search when to look for this server's tools |
Lookup step. Read "Configure tool search" in Claude Code's MCP docs for four things: the current default, which models and providers support deferral (a non-first-party ANTHROPIC_BASE_URL proxy or some cloud providers may fall back to upfront loading), exact key names, and any per-request tool limits. They change between releases. The answer decides whether you budget the fleet as deferred or as upfront-loaded.
Measure, don't assume. After connecting, check /context. A user report (anthropics/claude-code issue #40314, filed against an older build) described about 250 tools behind an HTTP gateway loading upfront despite ENABLE_TOOL_SEARCH=auto:5. A bot closed it as stale ("not planned"). No maintainer confirmed it and no fix was recorded, and the docs describe no transport exception. Treat it as a reason to measure, not as a known limitation.
Codex equivalent: gate tool exposure per server with enabled_tools / disabled_tools and default_tools_approval_mode / per-tool approval_mode in config.toml, not with a global defer flag.
For new servers:
fastmcp project, which is a separate, larger superset. Say which you mean.Build only the tools the workflow needs. Avoid giant generic CRUD surfaces.
Declare all four tool annotation hints (readOnlyHint, destructiveHint, idempotentHint, openWorldHint) on every tool as part of the build, not as a later pass — see references/mcp-custom.md#tool-annotation-hints. Before broader rollout, author evaluation questions per references/mcp-evaluation.md.
If the server returns retrieved document text (knowledge base, policy corpus, code hub), also load references/mcp-knowledge-serving.md before designing the tools: launch-bound clearance, fenced and scrubbed output, citations, abstain.
Use mcp-custom.md, mcp-patterns.md, and mcp-evaluation.md.
stdio and HTTP transport guidance mixed together in one recommendation with no runtime-specific separation.
Resolution: Always declare the transport first, then give guidance specific to that transport. Use the transport-auth matrix in references/transport-auth-matrix.md as the decision anchor. Never give a single config block that silently assumes one transport.
OAuth or token caching issues that look like protocol failures but are really stale local auth state. Resolution: Follow the Auth Failure Rule above: re-authenticate once, retry once, then stop. Clear only the local cache — do not loop. If the error recurs, report the exact transport, server name, and HTTP status code before escalating.
Registry discovery done without recording write scope, maintainer, and auth model, leading to unsafe tool adoption. Resolution: Before adopting any server from the registry, record its transport, auth model, write scope, and maintainer in your project's server manifest. Reject servers with write access and no documented approval boundary.
Multi-server hubs introduced before inventory, ownership, and lifecycle management exist.
Resolution: Start with a single server. Add a second only after the first has an owner, a documented transport and auth model, and a tested health-check run. Use scripts/mcp_health_check.sh to check Claude Code's connection status, then run the low-cost read tool in the Health Gate. The script exits nonzero for empty inventories, unknown status output, failed connections, and unverified targets; a connected status alone does not prove tool access (status docs).
Large output tools shipped with no summarization, filtering, or paging strategy. Resolution: Add server-side row limits and page sizes before the first client integration. Never raise client-side output caps as the first fix — tighten the server first, then adjust the client limit if still needed.
Local HTTP servers bound too broadly or deployed without Host and Origin validation.
Resolution: Always bind to 127.0.0.1 (not 0.0.0.0) for local servers. Add Host and Origin header validation before the first non-localhost request is accepted. See references/mcp-security.md for the full checklist.
Assuming deferred tool loading shrinks context for a large fleet (especially behind an HTTP gateway), then finding the session starts mostly full.
Resolution: Measure with /context after connecting, before trusting the default. If definitions still load upfront, check your model and provider against the tool-search docs, then cut to fewer, narrower servers.
Throwing a protocol error for a failure the model could fix (not found, permission denied, upstream 4xx).
Resolution: Return an isError: true result with an actionable message (see Tool Result Contract). Keep JSON-RPC errors for unknown tools, malformed requests, and server faults.
Copying a template written for another SDK major version, then failing on imports or silently running an older API. Resolution: Read the installed SDK's README and migration guide first, and pin the major version.
Host and OriginUse references/mcp-security.md for the full checklist.
Host, and OriginisError, pagination, idempotency, retry)Before delivering output, verify:
recommended config paths and commands exist or are clearly marked as proposed
generated JSON or YAML is syntactically valid
transport, auth, and approval guidance match the runtime
the permission boundary is the narrowest safe one for the task
Prefer modelcontextprotocol.io and official SDK repos over blog posts.
@modelcontextprotocol/sdk package, with McpServer imported from @modelcontextprotocol/sdk/server/mcp.js, or low-level Server + setRequestHandler(CallToolRequestSchema, ...). The v2 line split this into separate server and client packages. The v1 line kept receiving fixes for a transition period; check the SDK README for the support window before you plan the upgrade.from mcp.server.fastmcp import FastMCP with pip install "mcp[cli]". According to the Python SDK's migration guide, v2 renamed this class (FastMCP became MCPServer). An unpinned install can therefore break these imports.sampling/createMessage, roots/list, or elicitation/create, or on SSE Last-Event-ID resume, predate the 2026-07-28 redesign. Treat them as migration debt (see the breaking boundary at the top).If an upgrade breaks these imports, follow the migration guide. Do not quietly pin back without recording the debt.
</details>When prior decisions or pitfalls are relevant, consult learnings.consolidated.md if present; use learnings.md only for needed history or as the available fallback. Otherwise skip both.
After applying it, if you encountered a pattern worth remembering, a mistake worth preventing, or a domain fact that surprised you, append one dated bullet to learnings.md via agents-skills-feedback-loop/scripts/append_learning.py. Do not modify SKILL.md itself.
まだレビューはありません。使ってみた感想をお寄せください。
概要と使いどころ
Configures Claude Code hooks and Codex hooks.json/notify. Use when adding PreToolUse guards, Stop hooks, managed hooks, format-on-save, preflight, audits, or worktree/budget hooks.
日本語の概要は準備中です。原文の説明を表示しています。
Owns instruction files: AGENTS.md, CLAUDE.md, personal and repo rules. Use when writing, pruning, auditing them, sharing rules across Claude and Codex, or fixing ignored rules.
日本語の概要は準備中です。原文の説明を表示しています。
Creates and audits agent skills: SKILL.md, references, scripts, runtime metadata. Use when writing, validating, or security-reviewing a skill, or fixing truncated skill listings.
日本語の概要は準備中です。原文の説明を表示しています。
Adds per-skill learnings loops for dated patterns, mistakes, and domain facts. Use when wiring skill memory, consolidation, or drift audits.
日本語の概要は準備中です。原文の説明を表示しています。
Chooses subagent, team, workflow, or debate and launches it on Claude Code or Codex. Use when delegating, running agent review boards, or installing shared agents.
日本語の概要は準備中です。原文の説明を表示しています。
Designs and runs agent hives and multi-agent waves. Use when setting hive roles, code gates, dependency-graph fan-out, or verifier, vote and loop-until-dry passes.
日本語の概要は準備中です。原文の説明を表示しています。