mcp_cimd_server

mcp_cimd_server

MCP server that provides a hello world tool and implements server-side CIMD (Client ID Metadata Documents) processing, enabling OAuth authorization servers to fetch and validate client metadata documents with SSRF protections.

Category
访问服务器

README

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:

  1. Receive OAuth request — client sends client_id as an HTTPS URL
  2. Fetch CIMD document — HTTPS GET to the client_id URL with Accept: application/json
  3. Validate schema & content — parse JSON, verify required fields, check redirect URIs
  4. Enforce policies — SSRF protections, size limits, TTL caching
  5. Proceed with OAuth flow — return the validated metadata

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 → cache
  • cimd_cache_info() — admin tool to inspect the metadata cache
  • cimd_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/json
  • Redirect 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 minutes

Example 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) invalid_client
Malformed JSON / missing required fields invalid_client_metadata
SSRF violation (non-HTTPS, private IP, etc.) invalid_client_metadata

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        # Tests

Testing

pip install -e ".[dev]"
pytest

Resources

running test pytest -k test_say_hello

test client

start server

uvicorn mcp_hello_cimd.main:app --port 8001

And then run the client

python streamable_http_client.py

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选