bcquality/custom/knowledge/mcp/mcp-server-must-be-verified-at-session-start.md
Michael Dieringer dd5637b1db Custom-laget bestaar nu begge CI-checks: 72 validator-fejl -> 0
Normalisering af alle 39 custom knowledge-filer til READ-kontraktens
skema (validate_frontmatter.py + Test-KnowledgeIndex.ps1 begge groenne):

- R01/R02: 28 filer manglede frontmatter eller brugte aeldre skemaer
  (title/category/severity/rule-id m.fl.) - alle har nu praecis de 6
  kraevede noegler; keywords haandskrevet pr. fil da de driver
  worklist-selektionen i INDEX/knowledge-index
- R09: manglende Description-sektion - regel-agtige foersteoverskrifter
  (Core Rule/Rule/Regel/Core Principle) omdoebt, eller sektion indsat
  efter titlen hvor intro-tekst fandtes
- R10: fenced code blocks konverteret til 4-space indrykkede blokke
  i alle filer (indhold uaendret)
- R11: 4 filer over 100 linjer fortaettet redaktionelt uden semantisk
  tab (ai-eval-scores 143->100, git-lifecycle 121->97,
  permission-sets 113->99, test-feature-scenario-tags 105->91)
- R05: AL0197->al0197, add_repo->add-repo; keyword-lister trimmet
  til maks 10

Ingen regler er fjernet eller aendret i betydning - kun form.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-01 23:47:31 +02:00

56 lines
2.2 KiB
Markdown

---
bc-version: [all]
domain: mcp
keywords: [mcp-server, verification, session-start]
technologies: [al]
countries: [w1]
application-area: [all]
---
# MCP server availability must be verified at session start
## Description
When an MCP server is configured in `.mcp.json`, the agent must at session start verify
that the server's tools appear in the active deferred-tools list. If they are missing,
the agent must name the missing server and stop MCP-dependent work until the problem
is resolved or a workaround is chosen and declared.
## Why
MCP servers are started by the Claude Code harness when a session initializes. If a
server fails to start — due to a startup error, a configuration problem, or a timing
issue — its tools do not appear in the deferred-tools list. The harness does not report
this failure explicitly. An agent that proceeds as if the tools are available will
spend the session diagnosing what appears to be a tool-call error but is actually a
server-startup failure.
Early detection saves the entire session from misdirected debugging.
## How to verify
At session start, before using any MCP-dependent tool:
1. Note which servers are configured in `.mcp.json`.
2. Check whether each server's tools appear in the deferred-tools list
(visible in the `system-reminder` block at session start).
3. If a server's tools are absent: report it immediately.
> "WARNING: MCP server '[name]' is configured in .mcp.json but its tools are not
> registered in this session. MCP-dependent work for this server is paused.
> Likely causes: startup error, missing config, or harness timeout. Diagnose before
> continuing."
4. Offer a diagnostic path: verify the server command runs without error,
check configuration files, check for BOM or encoding issues in the server script.
## What NOT to do
- Do not proceed with MCP-dependent tasks assuming the tools will appear later.
- Do not silently skip MCP steps without reporting why.
- Do not attempt to call MCP tools whose server is not confirmed active.
- Do not diagnose the absence as a tool-call error — diagnose it as a startup failure.
## Applies to
All CURABIS projects that configure MCP servers in `.mcp.json`.