AWS Builder Center
When MCP servers lie: an open health registry from AWS UG Madurai's DevTool Month

When MCP servers lie: an open health registry from AWS UG Madurai's DevTool Month

Four apps in a DevTool Mon sprint. One of them addresses a problem I've been circling in production for months.

I came into the AWS User Group Madurai  DevTool Month  sprint expecting to knock out three prescribed challenges and go home. I left having shipped four apps and, buried inside the Open Project, the tool I've actually been wanting to build for six months: a public health registry for MCP servers.
This post is mostly about that Open Project — MCP Health Registry — because it's the one worth writing about at length. The three prescribed levels (Bookmark Manager, Live Polls, AI Help Desk) are covered briefly at the end for context on how the sprint built up to it. Everything runs locally with  npm run dev  on top of  AWS Blocks  v0.2.3.

The problem the registry is trying to solve

MCP — the  Model Context Protocol  — has grown fast. Dozens of public MCP servers now offer tools, resources, and integrations to agent frameworks. If you asked me last month which of those servers were actually healthy, I couldn't have told you. Nobody could. There is no public uptime signal for MCP.
That's a problem I've been circling in my own libraries. My  opentel-mcp  package exists specifically because MCP servers can lie about their own health — they return HTTP 200 with a JSON-RPC error object carrying  isError: true  inside, and generic HTTP monitors happily count that as success. My v0.4.0 catches that pattern by inspecting  CallToolResult.isError  and marking the OpenTelemetry span as ERROR. But  opentel-mcp  is instrumentation. Someone has to install it. The external view was missing.
So over the sprint I built one.

What "up" means for an MCP server

The classifier is the interesting part, so start there. Every 60 seconds a CronJob probes every registered server. The classification funnels five real-world failure modes into a normalized  up | degraded | down :
// Inside the CronJob 'probe-sweep' handler, per server:
const t0 = Date.now();
try {
const res = await fetch(server.endpointUrl, {
signal: AbortSignal.timeout(3000),
});
const latencyMs = Date.now() - t0;

if (res.ok) {
// Silent-failure detection: HTTP 200 with a JSON-RPC error body.
// This is the pattern opentel-mcp exists to catch.
let body: unknown = null;
try { body = await res.clone().json(); } catch { /* not JSON, that's fine */ }
const isError =
typeof body === 'object' && body !== null &&
(('isError' in body && body.isError === true) ||
('error' in body && (body as any).error != null));
if (isError) {
return { status: 'down', latencyMs, httpCode: res.status,
error: 'silent_failure_isError_true' };
}
if (latencyMs >= 2500) {
return { status: 'degraded', latencyMs, httpCode: res.status, error: null };
}
return { status: 'up', latencyMs, httpCode: res.status, error: null };
}
return { status: 'down', latencyMs, httpCode: res.status,
error: `http_${res.status}` };
} catch (err) {
const latencyMs = Date.now() - t0;
const name = (err as Error).name === 'TimeoutError' ? 'timeout' :
(err as any).code === 'ECONNREFUSED' ? 'refused' : 'unknown';
return { status: 'down', latencyMs, httpCode: null, error: name };
}

Verified with a real local test target during M7 validation. From  [CronJob:probe-sweep] triggered at 2026-07-28T10:15:50.732Z , one sweep classified 43 servers in 1210ms. Five of them were purpose-built failure fixtures — timeout, refused, degraded, silent-fail, and healthy — and every one landed in the right bucket. The  silent_failure_isError_true  error name is what lets a downstream analyzer distinguish a real 500 from an MCP server that quietly failed a tool registration behind a 200.
Two decisions in that code that only came out of running it:
The 2500ms degraded threshold isn't arbitrary. The probe timeout is 3000ms. If I called anything under 3000ms "up", a server responding in 2999ms with a completed HTTP transaction would look healthy while its p95 destroys client agents' latency budgets. 2500ms leaves a 500ms buffer for the probe's own scheduling jitter without letting a slow server pass. This came from watching one of my test fixtures return 2712ms and having to decide, on the spot, whether that was fine.
The classifier reads  res.clone().json()  inside a try/catch, not  res.json() . Two reasons. Cloning means the body stream is still available if I want to hash it downstream. And swallowing a  SyntaxError  there — for servers returning plain HTML on a 200 — is a design choice, not a bug: the classifier is asking "does this response look like an MCP silent failure?" not "is this response valid JSON?" A 200 with an HTML body isn't a silent failure by this definition; it just isn't an MCP server, which the registry surfaces differently.



Idempotency, because CronJob will fire twice

The  AWS Blocks CronJob docs  are explicit:  handler MUST be idempotent — can run more than once . Locally this rarely fires, but the block maps to EventBridge Scheduler + Lambda in production, and EventBridge Scheduler's at-least-once delivery means duplicate ticks are a real Tuesday.
The whole probe pipeline hangs off one guarantee:  probeRun  is set to the CronJob event's  scheduledTime , not  Date.now() . Two sweeps at the same scheduled minute produce the same  probeRun , and the conditional write kicks the duplicate out cleanly:
// Inside the per-server probe result recording:
try {
await probes.put(
{
serverId: server.serverId,
probedAt: new Date().toISOString(),
status, latencyMs, httpCode, error,
probeRun: event.scheduledTime, // ← the idempotency anchor
},
{ ifNotExists: true } // ← DynamoDB ConditionExpression at deploy
);
} catch (err) {
if (isBlocksError(err, DistributedTableErrors.ConditionalCheckFailed)) {
// This exact (server, probeRun) pair was already recorded.
// A duplicate CronJob tick landed. Skip silently — the earlier write is durable.
logger.info('probe_duplicate_skipped', { serverId: server.serverId, probeRun: event.scheduledTime });
continue;
}
throw err;
}

 ifNotExists: true  maps to a DynamoDB  PutItem  with  ConditionExpression: "attribute_not_exists(pk)" . The  ConditionalCheckFailedException  becomes AWS Blocks'  DistributedTableErrors.ConditionalCheckFailed . Catching that specific error and continuing is what makes replay safe. Any other error re-throws — a network failure to DynamoDB is not the same thing as "this row already exists."
The alternative I considered and rejected: keying  probeRun  on  Date.now() . That works locally because the mock uses process time, but the moment this runs across two Lambda invocations for the same scheduled minute, both writes succeed and you've got duplicate probe history. The idempotency test I ran locally — deliberately firing two sweeps within the same minute by manually invoking the handler — caught this in about ninety seconds of debugging, well before any deployment.



The domain, and why Latest exists

Four DistributedTables. The interesting pair is Probe and Latest.
┌───────────────────────────────┐ ┌───────────────────────────────┐
│ Server │ 1 ∞ │ Probe │
│───────────────────────────────│─────────>│───────────────────────────────│
│ + serverId : string (PK) │ │ + serverId : string (PK) │
│ + ownerId : string │ │ + probedAt : string (SK/ISO) │
│ + name : string │ │ + status : up|degraded|down │
│ + endpointUrl : string │ │ + latencyMs : number │
│ + tags[] : string │ │ + probeRun : string │
│ + version : number │ │ │
│ │ │ │
│ index byOwner: │ │ │
│ PK ownerId, SK createdAt │ │ │
└──────────────┬────────────────┘ └────────────────┬──────────────┘
│ │ derived
│ ▼
│ ┌──────────────────────────────────────┐
│ │ Latest │
└────────────────────>│──────────────────────────────────────│
│ + serverId : string (PK) │
│ + lastStatus : string │
│ + lastProbedAt : string │
│ + consecutiveFailures : number │
│ + updatedAt : string │
│ │
│ optimistic locking: ifFieldEquals │
│ { updatedAt } │
└──────────────────────────────────────┘

┌───────────────────────────────┐
│ RateLimit │
│───────────────────────────────│
│ + subject : string (PK) │ subject = userId + ':' + operation
│ + windowStart : number (SK) │ windowStart = floor(now / 60000) * 60000
│ + count : number │
│ + version : number │ CAS: ifFieldEquals { version }
│ + expiresAt : number │
└───────────────────────────────┘

Probes are per-server time series — no global secondary index, every read is a range query inside a single server's partition. When the AI triage agent asks for "last two hours of probes for server X" it's one query on  { serverId, probedAt between t0 and t1 } . Cheap in every sense — read units, latency, and code.
Latest is a denormalization, and it needs saying out loud because it's the kind of decision an article that only names services wouldn't mention. Computing the current status from the newest Probe row on every render was correct and expensive: the public status board shows all N servers at once, and doing N reads per page render was going to be the first performance problem on a real deployment. So Latest exists as a single row per server that the CronJob rewrites after each probe.
The tradeoff is standard: an extra write per probe in exchange for a cheap public read. The CAS on  updatedAt  catches the pathological interleaving case where two probe runs land for the same server (which shouldn't happen with idempotent scheduling but the local mock let me prove it can't cause corruption).



Rate limiting with three DynamoDB writes and no in-memory state

The AI triage endpoint is the abuse surface — a Bedrock invocation costs money per call, and an unlimited anonymous endpoint is an invitation. There's no built-in rate limiter block in AWS Blocks, which is fine, because composing one from DistributedTable is about forty lines and demonstrates the conditional-write patterns better than any tutorial.
Fixed-window, three requests per five minutes per user:
async function checkAndIncrement(
userId: string,
operation: string,
limit = 3,
windowMs = 5 * 60_000,
): Promise<{ allowed: true } | { allowed: false; reason: string }> {
const subject = `${userId}:${operation}`;
const windowStart = Math.floor(Date.now() / windowMs) * windowMs;
const key = { subject, windowStart };

// Attempt to create the window row at count=1.
// If two callers race here, exactly one lands the row.
try {
await rateLimits.put(
{ subject, windowStart, count: 1, version: 1, expiresAt: windowStart + windowMs },
{ ifNotExists: true },
);
return { allowed: true };
} catch (err) {
if (!isBlocksError(err, DistributedTableErrors.ConditionalCheckFailed)) throw err;
// Row exists. Fall through to CAS increment.
}

// CAS-increment, bounded retry.
for (let attempt = 0; attempt < 5; attempt++) {
const current = await rateLimits.get(key);
if (!current) return { allowed: true }; // TTL swept it. Next call creates.
if (current.count >= limit) {
logger.info('rate_limit_rejected', { subject, windowStart, count: current.count });
metrics.emit('RateLimitRejected', 1, { unit: 'Count' });
return { allowed: false, reason: 'limit' };
}
try {
await rateLimits.put(
{ ...current, count: current.count + 1, version: current.version + 1 },
{ ifFieldEquals: { version: current.version } },
);
return { allowed: true };
} catch (err) {
if (!isBlocksError(err, DistributedTableErrors.ConditionalCheckFailed)) throw err;
// Another caller advanced version between our get and put. Loop and retry.
await new Promise((r) => setTimeout(r, 20 + Math.random() * 60));
}
}
return { allowed: false, reason: 'contention' };
}

Three races closed:
  1. Two callers create the same window at once.  ifNotExists  guarantees exactly one lands the row; the other throws  ConditionalCheckFailed  and falls into the CAS path where it reads the row it just tried to create.
  1. Two callers try to increment the same window at the same time.  ifFieldEquals: { version: current.version }  means exactly one succeeds; the other retries with the fresh version.
  1. A TTL swept the row between our  get  and our  put . Returning to the caller as "allowed" and letting the next call create a fresh window at count=1 is the correct behaviour — the intent of the limit is preserved.
The retry loop is bounded at 5 with jittered backoff (20–80ms). Under pathological contention, the caller receives  { allowed: false, reason: 'contention' }  and a 429, which is honest — the system couldn't decide fast enough, so treat it as a refusal rather than a silent success. In production this would map to a DynamoDB  UpdateItem  with  ConditionExpression: "version = :v" , which is DynamoDB's native optimistic locking pattern — the same code, the same guarantees, no application changes.
One decision worth calling out. The subject key format  userId:operation  is deliberate. Rate-limiting per user per operation means a burst of  sendTriageMessage  calls doesn't consume the budget for  registerServer . The alternative — one shared bucket per user — is simpler but conflates unrelated abuse patterns and makes tuning limits per-endpoint impossible without adding a second table.



Grounding the AI in probe reality

The triage assistant has exactly two tools:  searchRunbooks  (retrieves from a small KnowledgeBase) and  fetchRecentProbes  (queries the Probe table). The system prompt instructs it to call  fetchRecentProbes  first when asked about a specific server, then  searchRunbooks  for the pattern it sees.
The interesting mechanic is  toolContextSchema . The local Agent block runs a canned provider in dev mode which synthesizes placeholder strings like  "sample"  for tool inputs. If I trusted that placeholder, the KnowledgeBase would search for the string  "sample"  instead of the user's real question. The workaround is that every  agent.stream()  call carries the authenticated user's original message as request-scoped context, and every tool handler falls back to that context when the model's input looks placeholder-shaped:
searchRunbooks: tool({
parameters: z.object({ query: z.string() }),
handler: async ({ input, context }) => {
const looksLikePlaceholder =
input.query.length < 6 ||
/^(sample|test|query|example|placeholder|string)/i.test(input.query);
const actualQuery = looksLikePlaceholder ? context.originalMessage : input.query;

const results = await kb.retrieve(actualQuery, { maxResults: 3 });
return results.map((r) => ({ text: r.text, source: r.source, score: r.score }));
},
}),

This is the pattern the AWS Blocks docs call a "deterministic adapter." It's ugly in the sense that it depends on the canned provider's specific failure mode, but it's honest: the authenticated original message reaches  kb.retrieve()  no matter what the model synthesized. On a tool-capable local model (Ollama with a checkpoint that reliably calls tools), the fallback simply doesn't fire. In production against Amazon Bedrock, the model returns real user-derived queries and the branch is dormant.
Verified locally against my seeded corpus. A user asking "Show me recent probes for server  99b5a820-b493-4c34-9c74-a08127cd9fa2  and search the runbooks for what silent failure means in MCP servers" triggered both tools:
  •  fetchRecentProbes  returned  { totalProbes: 9, statusCounts: { up: 0, degraded: 0, down: 9 }, firstFailedAt: "2026-07-28T10:24:50.805Z", latencyP50: 3017, latencyP95: 4539 }  — real numbers from the real probe table
  •  searchRunbooks  returned three chunks from  probe-failures.md  with the top hit at score 1.0, including a snippet referencing  mcp-pulse restart <serverId> 
Both tools land, the source is cited, and the answer is grounded. This is the moment the deterministic-adapter pattern earns its complexity budget.



Public read, owner write

The trust model is deliberately asymmetric because non-owners viewing the board is the whole product.
Anyone (no auth)
Authenticated owner group
listAllServers()
registerServer(...)
getLatestSnapshot()
listMyServers()
joinBoard() (WebSocket)
deleteMyServer(id)

createTriageConversation()

sendTriageMessage(...)

getTriageChannel(id)

getTriageConversation(id)
Public reads return servers without  ownerId . Owner reads return only records where the derived-from-session  ownerId  matches. Triage endpoints check ownership on the conversation ID via  agent.listConversations(userId) , not by trusting that the conversation ID itself is unguessable.
Every owner method calls  auth.requireRole(context, 'owner')  on the backend before touching a row. A hidden UI tab is not a role check — the tests deliberately POST to the JSON-RPC endpoint from a customer session and confirm  403 Forbidden .

Four defects I found in  @aws-blocks/blocks 

The sprint had me build four apps against this library. Along the way I hit four separate defects worth naming, because "everything worked" is a story nobody learns from.
1.  createLambdaHandler  factory signature. The generated  aws-blocks/index.handler.ts  in the React scaffold calls  createLambdaHandler(backend)  with the eagerly-imported backend module. The correct call is  createLambdaHandler(() => import('./index.js'))  — a factory, not the module itself. Without the fix,  tsc --noEmit  fails at the type boundary. Workaround: fix the one line. Reproducible on every app I generated.
2. WebSocket teardown hangs the test process. After the last realtime test in a suite, the process holds an open WebSocket handle even though every subscription has been  unsubscribe() 'd.  process.getActiveResourcesInfo()  shows a  TCPSocketWrap  that survives cleanup. The library's internal  Realtime  client keeps a bridge socket for reconnection retries that isn't tied to any subscription's lifecycle. Workaround:  process.exit(0)  in an  after()  hook. This is what turns a 2-second test suite into a 90-second hang if not caught.
3. Realtime reconnect race in tests. The client's  onclose  schedules an auto-reconnect timer that races against  __resetConnectionsForTest . Fix in application code: call the reset helper twice with a short delay, so the orphaned timer created by the first race gets cleared on the second pass.
4.  AuthCognito  local mock caches state at boot. The state file at  .bb-data/<auth fullId>/state.json  is read once when the dev server starts. Editing it while the server is running — as a naïve seed script would — is invisible until you restart the server. This is the one that cost me an hour before I realized what was happening. Workaround: seed before  npm run dev , or restart after seeding, and document it loudly in the seed script's README so the next person doesn't repeat the debugging.
None of these are showstoppers. All four are the kind of thing that costs you an hour when you find them and thirty seconds when you know they exist. That's why they're here.



The other three sprint apps, briefly

The prescribed levels sit under the same discipline — typed API imports only, conditional writes for concurrency, protected methods with role gates — and were the practice that made the MCP Registry buildable in a weekend:
  • Level 1 — Personal Bookmark Manager. AuthBasic + DistributedTable. The teaching point is that  deleteBookmark(bookmarkId)  isn't enough; the delete has to compose  { userId, bookmarkId }  server-side or user B can nuke user A's records by guessing an ID.  ifFieldEquals  on the delete plus the derived  userId  from  requireAuth(context)  closes it.
  • Level 2 — Live Polls. AuthBasic + DistributedTable + Realtime + CronJob. The eight-step vote algorithm — reserve with  ifNotExists , re-read poll for close race, CAS-increment revision, publish snapshot tagged with the revision — is the graded core. Two truly concurrent votes by the same user were verified via  Promise.all  with per-request cookie jars, and exactly one landed. The naïve "check then write" version passes casual clicking and fails under real contention.
  • Level 3 — AI Help Desk. AuthCognito + role groups + FileBucket + KnowledgeBase + Agent + Realtime. Same deterministic-adapter approach as the Registry, plus a separate customer/agent role split and a protected file-staging path that's deliberately not the KB source — uploading a doc to staging doesn't index it, which is the distinction the workshop graded specifically.
All four apps commit-verified, all four survive local restart, all four run without an AWS credential.



What's next

The Registry runs locally today. The obvious next step is  npm run sandbox  and eventually  npm run deploy  — AWS Blocks maps every block to its real AWS service (Cognito, DynamoDB, EventBridge Scheduler, API Gateway WebSocket, Bedrock KB, Bedrock) with no application code change. That's the part of AWS Blocks I still find hard to believe: the same lines that run against  .bb-data/  locally run against DynamoDB in production, and the conditional writes I wrote for the local mock become DynamoDB  ConditionExpression s under  PutItem .
Two things I want to add before I put it on the internet:
  • Real ingestion into the KnowledgeBase from  mcp-pulse  incident reports — the runbooks are static markdown today. If they came from actual production incidents, the triage assistant would get sharper every week.
  • Owner-facing SLA emails via AsyncJob. Fifteen minutes of consecutive downtime should send a nudge.
But the sprint's local definition of done is met. Two browser windows on the status board, a fresh server registered, one minute later the probe fires and both windows show the row appear live — the whole story of the app in a ninety-second demo.



Links and sources

If you ship an MCP server, register it. If you build an agent framework that consumes MCP servers, the status API is public and CORS-friendly. If you find yet another way the  isError -inside-200 pattern can bite, tell me — I'd rather catch it in the probe pipeline than watch someone else's agent stack pick a dead server.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article