http-semantics-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@http-semantics-mcp is this cache entry fresh? max-age=60, age=30"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
http-semantics-mcp
Deterministic HTTP semantics judgement, delivered as an MCP server over stdio.
Status: released — v0.2.0. The server starts, completes the MCP handshake and
reports five tools — cache_evaluate, conditional_evaluate,
cors_evaluate, cors_simulate_fetch and vary_match. Each one ships a JSON
Schema descriptor (input and output) under
src/http_semantics_mcp/schemas/tools/, mirrored byte-identically to
schemas/tools/, and every tools/call result returns the judgement in
structuredContent as well as in content[0].text. All five are judged against
frozen golden cases (18 + 19 + 24 + 10 + 9) and produce byte-identical output; a
contract gate proves the published output schema equals each tool's real key set
and value shapes across every case, and a determinism gate proves same-input /
same-sha256 across all of them. Released as
v0.2.0
(previous release: v0.1.0,
whose attachment predates the 0.2.0 work — see plan/RELEASE-M6.md). CI runs
{ubuntu-latest, windows-latest} × {3.12}. See
plan/05-里程碑.md and the decision log in
plan/06-交付对标与决策记录.md.
What this is
An oracle for the corners of HTTP that fail silently: CORS, cache semantics,
conditional requests and Vary. You hand it request/response headers as
literals; it hands back a specification-derived verdict plus the rule IDs and
clause references behind it.
No network. No DNS, no TCP, no HTTP.
urlis parsed for scheme/host/port only. There is nothing to capture, proxy or replay.No capture. Input is caller-supplied header literals, not observed traffic.
No security scoring. No grades, no severity, no "is this site safe". Header security scanning is a different job and is out of scope.
Deterministic. Same input → byte-identical serialised output. No clock, no randomness, no environment reads. Time is an argument, not a lookup.
Tools
Tool | Question it answers | Milestone |
| Will the browser let this response through? | M2 ✅ |
| What happens across redirects, hop by hop? | M2 ✅ |
| Can this stored response be served without revalidating? | M3 ✅ |
| Which conditional-request rule decides the status? | M4 ✅ |
| Does this cached entry match the incoming request? | M4 ✅ |
tools/list returns exactly the tools that are implemented. A stub descriptor
would tell a client a capability exists that does not, which is why the
remaining milestones add tools rather than plans.
A cache verdict by hand
Ask whether a stored response is still fresh, and what the numbers are:
printf '%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' \
'{"jsonrpc":"2.0","method":"notifications/initialized"}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"cache_evaluate","arguments":{"now":"2026-01-01T00:00:30Z","response_headers":{"Cache-Control":"max-age=60","Date":"Thu, 01 Jan 2026 00:00:00 GMT"},"stored":{"stored_at":"2026-01-01T00:00:10Z","age":"10"}}}}' \
| python -m http_semantics_mcp{"action":"serve","current_age":30,"freshness_lifetime":60,"is_fresh":true,"must_revalidate":false,"reasons":[],"stale_while_revalidate_window":0}now is an argument, not a clock read: the same call always returns the same
bytes, on any machine, at any time.
What it is not
Not a browser. Verdicts are spec-derived; where an implementation differs from the specification, the specification wins and the divergence is noted.
Not a substitute for
mitmproxy/powhttp-style capture tools. Those need real traffic; this needs a JSON object.Not a security scanner. Out of scope by design (see
plan/01-题目文档.mdsection 6).
Related MCP server: datapact
Install
Requires Python 3.12 or newer. The runtime has no third-party dependencies.
The floor is 3.12 because every interpreter below it is end-of-life (3.8 reached
EOL on 2024-10-07) and because the build metadata needs setuptools>=77 for an
SPDX license expression. The CI matrix is {ubuntu-latest, windows-latest} × {3.12}.
git clone https://github.com/yuluo554/http-semantics-mcp.git
cd http-semantics-mcp
python -m pip install -e ".[dev]".[dev] installs the test-time dependencies only (pytest, PyYAML). If you
only want to run the server, python -m pip install -e . is enough.
Verify the install:
python -m http_semantics_mcp --version
python -m http_semantics_mcp --selftest--selftest prints one line per check and exits 0 on pass, 1 on failure.
It never prints a verdict — it checks the installation, not your headers.
Run
The server speaks newline-delimited JSON-RPC 2.0 on stdin/stdout.
python -m http_semantics_mcpOr, after installation, the console script:
http-semantics-mcpClient configuration
Claude Code (~/.claude.json or project .mcp.json):
{
"mcpServers": {
"http-semantics": {
"command": "python",
"args": ["-m", "http_semantics_mcp"],
"env": {}
}
}
}Codex (~/.codex/config.toml):
[mcp_servers.http-semantics]
command = "python"
args = ["-m", "http_semantics_mcp"]Any stdio MCP client works: spawn the process, write one JSON object per line, read one JSON object per line.
Protocol surface
Method | Result |
|
|
| no response |
|
|
| registered tools, ASCII-sorted by name |
| tool result, or a JSON-RPC error for an unknown tool |
anything else |
|
Supported protocol versions: 2025-11-25, 2025-06-18, 2025-03-26,
2024-11-05. An unrecognised version is answered with 2025-06-18, which the
specification permits; the client decides whether to continue.
This server speaks the legacy handshake only. That means a client must
send initialize (and notifications/initialized) before anything else. A
modern client as defined by the 2026-07-28 revision — one that skips
initialize and carries the version in each request's
params._meta["io.modelcontextprotocol/protocolVersion"] — is not
supported: every such request is answered with -32002 Server not initialized,
and server/discover is answered with -32601. Nothing here silently
misparses; the client gets a defined error and can fall back.
Error codes: -32700 parse error, -32600 invalid request, -32601 unknown
method, -32602 invalid params, -32002 not initialized, -32603 internal
error. A tool-level bad input is not a JSON-RPC error: it returns a result
with isError: true.
A handshake by hand
printf '%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18"}}' \
'{"jsonrpc":"2.0","method":"notifications/initialized"}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/list"}' \
| python -m http_semantics_mcpA verdict by hand
Ask whether a cross-origin response is allowed, and what to change if not:
printf '%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' \
'{"jsonrpc":"2.0","method":"notifications/initialized"}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"cors_evaluate","arguments":{"method":"GET","url":"https://api.example.com/v1","origin":"https://app.example.com","credentials":"omit","request_headers":{},"response":{"status":200,"headers":{}},"is_preflight":false}}}' \
| python -m http_semantics_mcpThe verdict arrives twice in the same result: as one JSON string inside
content[0].text, and as the object itself in structuredContent. Both carry
the same value, byte for byte in the serialised form — a test asserts it.
{"decision":"block","missing_headers":["access-control-allow-origin"],"notes":{"allow_credentials_null_origin":false,"max_age_capped_by_client":false,"wildcard_with_credentials":false},"recommended_headers":{"access-control-allow-origin":"https://app.example.com"},"violations":[{"code":"CORS_MISSING_ALLOW_ORIGIN","detail":"response has no Access-Control-Allow-Origin (origin=https://app.example.com)","spec_ref":["Fetch §CORS check"]}]}structuredContent is there because every tool publishes an outputSchema, and
the specification says a server that does so MUST return structured results
conforming to it. On an error result the same key holds
{"error": {"code", "field", "detail"}}.
decision: "block" is a successful judgement, so isError stays false. Only
a malformed request sets isError: true, and it still answers with a payload
rather than a stack trace.
Development
python -m pytest
python tools/run_gates.py
python tools/mutate_check.py
python tools/smoke_stdio.py
python tools/gen_codes.py --check
python tools/gen_golden.py --check
python tools/gen_schemas.py --check
python scripts/check_release.py --pre-tagpytestruns the full suite (protocol, transport framing, determinism, gates, packaging surface).tools/run_gates.pyruns the eight static gates and names the failing one.tools/mutate_check.pybreaks one behaviour per gate and asserts the gate goes red. A gate that cannot fail is decoration; this script is how that claim is kept honest rather than asserted.tools/smoke_stdio.pystarts the server as a real subprocess and asserts on the raw bytes: every stdout line is JSON, no\r, response count matches request count.tools/gen_codes.py --check,tools/gen_golden.py --checkandtools/gen_schemas.py --checkrecompute the generated artefacts (rule catalogue, golden cases, schema mirror) and compare bytes, so a hand edit that drifts from its source is caught rather than committed.scripts/check_release.py --pre-tagis the release-terminal gate. It is not wired into CI on purpose: before a tag exists, several of its checks must be red, and a permanently red job carries no information.
Repository gates
Eight static gates run in tests, in CI, and inside the release check. Each one
must be provably able to fail (tests/test_gates.py and tests/test_m1_gates.py
inject a defect for every gate, and tools/mutate_check.py proves it end to
end):
Gate | Rule |
purity |
|
no-nondeterminism | the whole runtime package imports no clock, randomness or network; no |
single-serialiser |
|
absolute paths | no machine-specific path (drive letter, home directory, UNC share) in repository text |
line endings | every text file is LF-only and |
oracle independence |
|
golden hygiene | every frozen case has the required fields and no |
code literals | no hand-written package source spells a rule code; the generated catalogue ( |
Two further gates live in the test suite rather than in tools/gates.py,
because they must run the tools instead of reading files:
Gate | Rule |
schema parity | for every tool, |
determinism | two calls on the same input serialise to the same sha256, for every tool and every case, and no output carries a machine-specific path or a date the caller did not supply |
Layout
src/http_semantics_mcp/ server, protocol, registry, judgement layer
schemas/tools/ generated mirror of the in-package JSON Schemas
references/ generated mirror of the in-package code table
data/golden/ frozen golden cases (input + expected output)
data/wpt/ WPT cors/ directory index (paths + blob shas only)
data/wpt-mapping.json WPT cors/ mapping ledger
plan/ the project plan, milestones and release records
tools/ gates, smoke test, generators
scripts/check_release.py release-terminal self-checkThe in-package copies under src/http_semantics_mcp/ are the only editable
sources for codes.json and the tool schemas; the top-level copies are
byte-identical mirrors so an installed distribution and a reader both see the
same contract.
Data and verification
All inputs are synthetic. Domains are reserved examples (example.com,
example.org, example.net, localhost); ETags are explicit fakes; times are
fixed literals. No real response headers, tokens, cookies, HAR or pcap files
are collected, and .gitignore blocks those paths.
Golden cases freeze the input and the expected output. Expected values are
produced by an independent oracle under tools/golden_oracle/, not by the
implementation under test, and a gate forbids the oracle from importing the
judgement layer — otherwise the benchmark would be comparing an implementation
with itself.
Browser behaviour is cross-checked against
web-platform-tests/wpt's cors/
suite (index pinned to commit 850b36a5, data day 2026-10-18), transcribed to
header-level cases in data/golden/. The ledger in data/wpt-mapping.json
accounts for all 45 files in the directory: 15 mapped, 30 listed with a reason
(real network, TLS, timing, browser-proprietary behaviour, or out of scope).
Nothing is guessed at, and no test body is copied into this repository.
Measured on this build
Every number below comes from a local run on a clean interpreter — no state from
a development checkout. CI runs the matrix {ubuntu-latest, windows-latest} × {3.12};
the last green run before the floor moved to 3.12 was the four-leg
{ubuntu, windows} × {3.8, 3.12} matrix on the main push (run
39141511111)
and the v0.1.0 tag push (run
39141686281).
Metric | Value |
Frozen golden cases, byte-identical to production | 87 / 87 |
Rule codes reachable by at least one case (set equality, both directions) | 31 / 31 |
WPT | 15 / 45 (30 / 45 listed with a reason; all 15 mapped rows re-run and reconcile with production) |
Tool descriptors (input + output schema per tool) | 5 |
Static gates | 8 |
Mutations that must turn a gate red | 43 / 43 |
Collected tests | 397 (Python 3.12) |
The three generated artefacts are recomputed and compared byte for byte on
every run (gen_codes --check, gen_golden --check, gen_schemas --check),
and every static gate has at least one mutation proving it can fail.
License
MIT. See LICENSE.
Project plan
plan/00-README总览.md— index, decisions, promise ledgerplan/01-题目文档.md— the problem statement (frozen)plan/02-架构与技术选型.md— architecture and transport contractplan/03-模块详设.md— T1–T5 algorithmsplan/04-数据计划.md— golden cases, WPT mapping, oracle independenceplan/05-里程碑.md— milestones and definition of doneplan/06-交付对标与决策记录.md— scoring map and decision log
Available Tools
5 toolscache_evaluateA
Decide whether a stored response may be reused without revalidating. Applies the RFC 9111 age and freshness arithmetic (Date, Age, Cache-Control, Expires, Last-Modified) and returns action serve|revalidate|miss, the age and freshness lifetime in whole seconds, and the rule IDs with their clause references. now is an argument: the cache never reads a clock.
Inputs: now (required), stored (required), request_headers, response_headers. Returns: action, reasons, is_fresh, current_age, +3 more
conditional_evaluateA
Judge one request's preconditions and report the status they decide. Evaluates If-Match, If-Unmodified-Since, If-None-Match and If-Modified-Since in the RFC 9110 section 13.2.2 precedence order, stopping at the first applicable one, and returns status 200|304|412, which rule decided it, and the rule IDs with their clause references.
Inputs: method (required), resource (required), request_headers (required). Returns: status, explain, rule_applied, weak_comparison_used
cors_evaluateA
Judge one HTTP response against the Fetch Standard CORS check. Returns decision allow|block, the violated rule IDs with their clause references, the headers that are missing, and what to send instead. No network: url is parsed for scheme/host/port only.
Inputs: url (required), method (required), response (required), is_preflight (required), +3 more. Returns: notes, decision, violations, missing_headers, +1 more
cors_simulate_fetchB
Walk a redirect chain hop by hop and judge each hop with the CORS check. Reports the ordered redirect events (origin_set_to_null, credentials_dropped), the visible response headers, and the effective Access-Control-Max-Age.
Inputs: url (required), method (required), response (required), mode, +5 more. Returns: hops, events, decision, final_type, +4 more
vary_matchB
Decide whether a stored response can be reused for an incoming request, per RFC 9111 section 4.1. Compares the fields named by the stored Vary value under that field's normalisation policy and returns match hit|miss, the fields that differ, the normalised Vary members, and the rule IDs with their clause references.
Inputs: cached (required), incoming (required). Returns: match, reasons, normalized_vary, differing_headers
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Most tools target clearly distinct HTTP semantics concerns (cache freshness, Vary matching, conditional preconditions, CORS). The two CORS tools (cors_evaluate for a single response, cors_simulate_fetch for a redirect chain) and the two cache-related tools (cache_evaluate for freshness, vary_match for field matching) are related but their scopes are differentiated in the descriptions.
All names use snake_case with a domain_prefixed convention (cors_*, cache_*, conditional_*, vary_match). Mostly consistent, though cors_simulate_fetch breaks the domain_action pattern slightly with an extra verb.
Five focused tools are well-scoped for a narrow HTTP semantics/RFC-conformance evaluator, with no redundant or filler entries. Each tool earns its place.
The set covers the core RFC 9111 cache reuse path (freshness + Vary), RFC 9110 preconditions, and CORS including redirects, which is solid coverage. Minor gaps exist (e.g., no explicit cache storage/no-store decision or combined end-to-end request evaluation), but agents can work around them.
Maintenance
Related MCP Connectors
Deterministic prompt-injection detector; signed, offline-verifiable verdicts. Not an LLM.
Validate JSON, YAML, XML and CSV with exact line/column errors and silent-corruption warnings.
Validate OpenRTB bid requests and responses against IAB specs. ARTF, Rust core.
A paid remote MCP for ZeroLang, built to return verdicts, receipts, usage logs, and audit-ready JSON
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceServes offline document validation and evaluation operations of the Judgment Pack Specification to MCP clients over stdio, enabling agents to validate and evaluate JPS documents as tool calls. Supports conformance validation, experimental evaluation with disposition and error classes, and corpus testing.2Apache 2.0
- AlicenseNot gradedqualityBmaintenanceExposes an offline data-contract runtime to MCP-capable agents, enabling them to lint ODCS contracts and validate CSV datasets against them via stdio.MIT
- AlicenseNot gradedqualityBmaintenanceEnables local, read-only static inspection of Python/FastAPI, Docker, and GitHub Actions release evidence through a stdio interface, returning rule and instance findings without importing or executing target code.Apache 2.0
- AlicenseAqualityBmaintenanceEnables an AI agent to create stateful signal sessions over stdio, feed synthetic or replayed event streams, and read advisory verdicts for evaluation, demos, and integration checks.6MIT