Skip to main content
Glama
abluva

mcp-request-idempotency-reference

by abluva

Request Idempotency — Reference Implementation

Minimal, runnable demonstration of the mechanism proposed in sep-0000-request-idempotency.md: an optional idempotencyKey argument on tools/call, with server-side deduplication and explicit conflict-fingerprint semantics for a reused key presented with different arguments.

This is a demonstration server, not a production implementation — the dedup store is an in-memory dict with no eviction. It exists to make the before/after failure mode concrete for reviewers, per the SEP process's prototype requirement ("a standalone proof-of-concept demonstrating the key mechanics").

Setup

pip install -r requirements.txt

Note on the version pin: this demo uses FastMCP from mcp.server.fastmcp. As of the mcp SDK's 2.0.0 release, that class was renamed and moved to MCPServer in mcp.server.mcpserver. Installing a plain pip install mcp today will pull 2.0.0 and fail on import. The pin above (mcp>=1.9.0,<2.0.0) avoids that; if you'd rather run against the current SDK, swap the import for mcp.server.mcpserver.MCPServer (same constructor/decorator surface for the pieces this demo uses).

Related MCP server: Simple MCP Demo

Run

python3 client_demo.py

This spawns server.py as a stdio subprocess and runs three scenarios:

  1. No idempotency support — a lost-response retry double-charges.

  2. With idempotencyKey — the same retry is deduplicated; the cached result is returned, no re-execution.

  3. Conflict semantics — the same key reused with different arguments is rejected outright, not replayed or silently executed.

Verified working end-to-end against mcp==1.9.4 on 2026-08-01.

Files

  • server.py — the guarded (charge_guarded) and unguarded (charge_unguarded) tool implementations, plus a reset_ledger test helper.

  • client_demo.py — drives all three scenarios against server.py.

A
license - permissive license
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    -
    quality
    D
    maintenance
    A Python-based demonstration server showcasing multiple Model Context Protocol transport mechanisms, including stdio, SSE, and HTTP. It provides a functional reference for tool discovery and execution using a sample number addition tool.
    Last updated
  • F
    license
    A
    quality
    D
    maintenance
    A minimal MCP server demo written without the MCP Python SDK that demonstrates the complete protocol flow. It provides weather, file search, and datetime tools, and includes a CLI client that bridges MCP tools with OpenAI function calling.
    Last updated
    3
  • A
    license
    D
    quality
    D
    maintenance
    A TypeScript MCP server demo supporting local Stdio and remote Streamable HTTP, demonstrating tool invocation for AI agents.
    Last updated
    2
    MIT

View all related MCP servers

Related MCP Connectors

  • Reliable async execution for agent tool calls: schema gating, retries, idempotency, audit trail.

  • Hash-chained HMAC-signed audit log MCP for A2A (agent-to-agent) calls. Every tool-call, agent-ha...

  • AI Reasoning Cache & Consensus Layer with 11 MCP tools via Streamable HTTP.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/abluva/mcp-request-idempotency-reference'

If you have feedback or need assistance with the MCP directory API, please join our Discord server