mcp_cimd_server
This MCP server provides a greeting tool and implements server-side processing for Client ID Metadata Documents (CIMD) with robust security and caching.
say_hello(name)– Returns a friendly greeting for a given name (defaults to 'world').cimd_resolve(client_id)– Fetches, validates, and caches CIMD metadata from an HTTPS URL. Applies SSRF protections: HTTPS-only, blocks private/loopback/link-local IPs, DNS rebinding protection, TLS validation, 5 KB size limit,application/jsoncontent-type enforcement, and max 3 redirects. Validates the JSON schema (client_id must match, redirect_uris required). Returns specific OAuth error codes on failure (e.g.,invalid_client,invalid_client_metadata). Caches results with a 10-minute TTL.cimd_cache_info()– Inspects the current CIMD metadata cache, showing cached client IDs and their remaining TTLs (admin tool).cimd_clear_cache()– Clears all cached CIMD metadata, forcing a re-fetch on the nextcimd_resolvecall (admin tool).Runs as an MCP server over stdio, compatible with MCP clients like Claude Desktop or Cline.
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., "@mcp_cimd_serverResolve the CIMD document for https://client.example.com/metadata.json"
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.
MCP Hello CIMD
A Model Context Protocol (MCP) hello world server with a say_hello tool, that also implements the server side of CIMD — Client ID Metadata Documents (https://client.dev/servers).
⚠️ Important: this project is a server, not a client. It serves MCP tools to MCP clients and it consumes CIMD documents exactly as an OAuth authorization server would.
What is CIMD?
CIMD (Client ID Metadata Documents) is a new OAuth approach that lets clients identify themselves using HTTPS URLs instead of preregistration. Instead of a client registry, an authorization server fetches the client's metadata just-in-time from the client_id URL.
This project implements the server-side CIMD processing flow from https://client.dev/servers:
Receive OAuth request — client sends
client_idas an HTTPS URLFetch CIMD document — HTTPS GET to the
client_idURL withAccept: application/jsonValidate schema & content — parse JSON, verify required fields, check redirect URIs
Enforce policies — SSRF protections, size limits, TTL caching
Proceed with OAuth flow — return the validated metadata
Related MCP server: mcp_auth_server
Features
MCP (the hello world part)
say_hello(name)— the classic hello world MCP tool
CIMD (server-side implementation)
cimd_resolve(client_id)— full CIMD server flow: validate URL → fetch → validate schema → cachecimd_cache_info()— admin tool to inspect the metadata cachecimd_clear_cache()— admin tool to force re-fetch of metadata
Security (SSRF protections)
HTTPS only — rejects non-HTTPS client_id URLs immediately
Private/loopback/link-local address blocking — RFC 1918, 127.0.0.0/8, 169.254.0.0/16, IPv6 equivalents, and more
DNS rebinding protection — resolves and validates DNS, pins IPs for requests
TLS validation — validates certificates, modern TLS only
Size limits — 5 KB max document size (per the CIMD spec)
Content-Type enforcement — requires
application/jsonRedirect limits — max 3 redirects, each hop re-validated
Cache with TTL — 10 minute default TTL to balance freshness and performance
Installation
pip install -e .Running the server
The server speaks MCP over stdio:
Or directly:
uvicorn mcp_hello_cimd.main:app --port 8001
Add to an MCP client (e.g. Claude Desktop / Cline)
Add to your MCP settings configuration (mcpServers):
{
"mcpServers": {
"hello-cimd": {
"command": "python",
"args": ["-m", "mcp_hello_cimd.cli"]
}
}
}The CIMD flow in action
When an OAuth request arrives with a client_id like:
GET /authorize?client_id=https://client.example.com/.well-known/oauth-client-metadata.json&...cimd_resolve performs the server-side flow:
1. Validate URL format → must be https://
2. Check cache first → TTL 600s, returns if fresh
3. Fetch with SSRF protections → 5KB limit, 10s timeout, 3 redirects max
4. Parse and validate JSON → client_id must match URL, redirect_uris required
5. Cache and return metadata → cached for 10 minutesExample metadata document a client would host
{
"client_id": "https://client.example.com/.well-known/oauth-client-metadata.json",
"client_name": "Example OAuth Client",
"client_uri": "https://client.example.com",
"redirect_uris": ["https://client.example.com/callback"],
"grant_types": ["authorization_code"],
"response_types": ["code"],
"token_endpoint_auth_method": "private_key_jwt",
"scope": "openid profile email"
}Error semantics
Per the CIMD server spec, failures produce clear OAuth-style errors:
Condition | Error code |
Metadata fetch failed (network, HTTP error) |
|
Malformed JSON / missing required fields |
|
SSRF violation (non-HTTPS, private IP, etc.) |
|
Project layout
src/mcp_hello_cimd/
├── __init__.py
├── main.py # CLI entry point (stdio transport)
├── server.py # MCP server: say_hello + CIMD tools
└── cimd/
├── __init__.py
├── ssrf.py # SSRF protections (blocked ranges, DNS pinning)
└── processor.py # CIMD server flow: fetch → validate → cache
tests/
└── test_server.py # TestsTesting
pip install -e ".[dev]"
pytestResources
running test pytest -k test_say_hello
test client
start server
uvicorn mcp_hello_cimd.main:app --port 8001And then run the client
python streamable_http_client.pyAvailable Tools
4 toolscimd_cache_infoA
Inspect the CIMD metadata cache (admin/management tool).
Returns: Cache contents with remaining TTL seconds per client_id.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the burden of disclosing behavior. 'Inspect' signals a read-only operation, and the return description of 'cache contents with remaining TTL seconds per client_id' adds useful behavioral detail. It does not explicitly state side-effect-free or permission requirements, but the core behavior is sufficiently transparent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise: two sentences, front-loaded with the primary purpose, followed by a clear statement of return values. No redundant or filler content.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with no parameters and a provided output schema, the description sufficiently covers purpose, return content, and admin context. It is complete enough for an agent to correctly select and invoke the tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has zero parameters, so per the baseline this warrants a 4. The description adds context about the output being per client_id, which is useful even though there are no parameters to explain.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action 'Inspect' and the specific resource 'CIMD metadata cache', and labels it as an admin/management tool. This distinguishes it from sibling tools like cimd_clear_cache and cimd_resolve by implying a read-only inspection role.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context by identifying the tool as an admin/management tool for inspecting cache contents. It doesn't explicitly name alternatives or state when-not-to-use, but the admin/management label plus the contrast with cimd_clear_cache and cimd_resolve reasonably implies appropriate usage.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
cimd_clear_cacheA
Force re-fetch of all cached CIMD metadata (admin tool).
Returns: A confirmation message.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are present, so the description carries the burden. It states the action (force re-fetch), scope (all cached metadata), and admin requirement, but does not describe side effects like performance impact or cache invalidation consequences.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences with no filler. The Returns line is slightly redundant given the output schema, but it does not detract from the overall conciseness.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the simplicity of the tool (no parameters, output schema present), the description covers purpose, scope, and access level. It does not explain when to use it or relationships to siblings, but the absence of parameters and presence of output schema reduce the burden.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has no parameters, so the schema is trivially covered. The description adds no parameter semantics, which is acceptable given zero parameters; baseline 4 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb+resource ('Force re-fetch all cached CIMD metadata') and identifies it as an admin tool. This clearly distinguishes it from sibling tools like cimd_cache_info, which likely inspects cache state.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives no explicit guidance on when to use this tool versus alternatives. It only notes it is an admin tool, but does not contrast with cimd_cache_info or state prerequisites for invocation.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
cimd_resolveA
Resolve an OAuth client_id URL to its CIMD metadata document.
Implements the server-side CIMD flow: validate the HTTPS URL, fetch the Client ID Metadata Document, validate the schema (client_id match, redirect_uris present, HTTPS redirect URIs), and cache the result with a TTL. SSRF protections are applied.
Args: client_id: The client_id URL pointing to the CIMD document (e.g. https://client.example.com/oauth/metadata.json).
Returns: The validated client metadata, or an error payload matching the CIMD error semantics (invalid_client / invalid_client_metadata) if resolution fails.
| Name | Required | Description | Default |
|---|---|---|---|
| client_id | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full burden and thoroughly discloses behavior: validating HTTPS, fetching the metadata document, schema checks, caching with TTL, SSRF protections, and returning CIMD error semantics. This goes well beyond a simple 'resolve' summary.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is front-loaded with the core purpose in the first sentence and uses clear Args/Returns sections. Each sentence adds meaningful detail about validation, caching, or error behavior, with no filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a one-parameter tool with no annotations, the description covers input semantics, the resolution process, side effects (cache TTL), security (SSRF), and error output. It provides a complete mental model without needing the output schema.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0% and the schema only names 'client_id' with a title. The description's Args section explains the meaning ('The client_id URL pointing to the CIMD document') and gives a concrete example URL, fully compensating for the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb+resource: 'Resolve an OAuth client_id URL to its CIMD metadata document.' It distinguishes cimd_resolve from sibling tools like cimd_cache_info and cimd_clear_cache by focusing on resolution and validation, not cache inspection or clearing.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives clear context by stating it 'Implements the server-side CIMD flow' and lists prerequisites (HTTPS URL, schema validation). It does not explicitly name alternatives or state when not to use, but the server-side framing and validation steps make the intended use unambiguous.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
say_helloA
Say hello to someone.
Args: name: The name to greet (defaults to 'world').
Returns: A friendly greeting.
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | world |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the burden of disclosing behavior. It states that the tool 'Returns: A friendly greeting,' which clearly indicates a side-effect-free, pure operation. No hidden state changes or side effects are implied, so the coverage is adequate for a tool of this simplicity.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise, containing only one line of prose plus a simple Args and Returns block. Every sentence adds necessary information, with no filler or redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the trivial complexity (one optional parameter) and the presence of an output schema, the description is complete. It covers the function, the parameter semantics, and the return value, leaving no meaningful gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema provides only the parameter name, type, and default, with no semantic description. The description adds essential meaning: 'name: The name to greet (defaults to 'world').' This fully clarifies the parameter's purpose, exceeding the schema's minimal information.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function with a specific verb and resource: 'Say hello to someone.' This unambiguously distinguishes it from sibling tools (cimd_resolve, cimd_cache_info, cimd_clear_cache), which all deal with caching and resolution.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies when to use the tool (whenever a greeting is needed) but does not explicitly state alternatives or exclusions. Since the siblings are unrelated, there is no risk of confusion, but the tool does not go beyond stating its basic function.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
4 tool updates
v0.1.0- First observed
cimd_cache_info - First observed
cimd_clear_cache - First observed
cimd_resolve - First observed
say_hello
TDQS
Scored across 4 tools
Each tool has a distinct purpose: say_hello is a basic greeting, cimd_resolve performs the actual CIMD resolution with caching, cimd_cache_info inspects the cache, and cimd_clear_cache resets it. There is no functional overlap between them.
The cimd_* tools share a clear prefix and describe their actions (resolve, cache_info, clear_cache). However, cimd_cache_info is more noun-like than verb-first, and say_hello breaks the prefix pattern. Overall, the naming is consistent enough to be predictable.
With 4 tools, the server is compact and focuses on the core CIMD resolution domain plus cache management. The unrelated say_hello tool adds a bit of noise but does not make the set feel over- or under-scoped.
The server covers the essential flow: resolving a client_id with caching, viewing cache contents, and clearing the cache. A minor gap is the lack of a tool to invalidate a specific cache entry without clearing all, but for a small CIMD server this is workable.
Maintenance
Related MCP Connectors
Experimental MCP server for current empirical verification of explicit public HTTPS endpoint claims.
MCP server for verifying EUDI/Talao wallet data via OIDC4VP (pull) for AI agents.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA minimal Model Context Protocol server built with FastAPI that provides a basic "Hello World" resource and tool. Serves as a starting point for building and validating MCP client integrations with richer resources and tools.-
- FlicenseNot gradedqualityDmaintenanceA proof-of-concept MCP server implementing OAuth 2.1 authorization with CIMD client registration and PKCE, demonstrating protected resource access and step-up authentication.-
- FlicenseNot gradedqualityDmaintenanceA simple MCP server with OAuth 2.0 authentication for testing OAuth support in mcp-cli.-
- FlicenseNot gradedqualityBmaintenanceA simple HTTP-based MCP server that provides demo tools (get_test_string, echo, check_maintenance), greeting prompts, and test resources, with optional OAuth 2.1 support.-