Skip to content

Add whoami tool to fast-time-server for header reflection - #43

Merged
jonpspri merged 2 commits into
mainfrom
issue41-whoami
Sep 30, 2026
Merged

jonpspri merged 2 commits into
mainfrom
issue41-whoami

Conversation

@jonpspri

Copy link
Copy Markdown
Collaborator

Summary

Adds a whoami tool to fast-time-server that reflects the HTTP headers of the tools/call request as a lowercased JSON map, so ContextForge plugin E2E suites (e.g. Vault tool_pre_invoke) can assert upstream header behavior without the bespoke echo_mcp.py FastMCP backend.

  • General form: all received headers, names lowercased; authorization key always present, null when absent
  • Works in both protocol eras (rmcp injects http::request::Parts into request extensions on session and stateless paths)
  • Header values appear only in the tool response, never in server logs
  • Returned as structuredContent plus mirrored text content

Verification

  • cargo fmt, cargo clippy --all-targets, cargo test all pass (39 tests, incl. 2 new whoami tests)
  • Smoke-tested over streamable HTTP with curl: auth + X-Vault-Tokens headers reflected; second call returns "authorization": null; zero header values in server logs

Downstream

IBM/mcp-context-forge consumes this image pinned by digest in docker-compose.yml; suite migration waits on an image publish and a digest bump after merge.

Closes #41

The tool returns the HTTP headers received with the tools/call request as
a lowercased JSON map, so ContextForge plugin E2E suites (e.g. Vault
tool_pre_invoke) can assert upstream header behavior without a bespoke
echo backend. The authorization key is always present, null when the
header is absent; header values never appear in server logs.

Closes #41

Signed-off-by: Jonathan Springer <jps@s390x.com>
The rmcp macro auto-generates outputSchema from the Json<T> return type;
schemars renders serde_json::Value as a typeless schema, which violates
the MCP requirement that outputSchema be an object schema and failed the
conformance tools-list scenario in CI. Use a transparent BTreeMap newtype
so the generated schema is a valid object schema. Verified locally with
@modelcontextprotocol/conformance@0.1.16: baseline check passes.

Signed-off-by: Jonathan Springer <jps@s390x.com>
@jonpspri
jonpspri merged commit c8082fb into main Sep 30, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Add header-reflecting whoami tool to fast-time-server

1 participant