idm-mcp
Mock identity-management MCP server for decentralized identity that allows minting DIDs, issuing signed Verifiable Credentials, and verifying them.
README
IDM MCP Server
A mock identity-management MCP server for decentralized identity. It exposes tools to mint DIDs, issue signed W3C-style Verifiable Credentials (VCs), and verify them — over the Model Context Protocol.
Status: mock / proof-of-concept. State is held in memory (not persistent), the issuer signing key is regenerated on every restart, and several fields are simplified for demonstration. See Limitations.
Features
get_did— mint adid:ietf:<uuid>identifier + record from an agent's public key.get_vc— issue an Ed25519-signed Verifiable Credential for a subject DID, and store it.verify_vc— verify the issuer signature on a credential.ping/echo— trivial health/echo tools used to smoke-test the MCP plumbing.
The server acts as its own credential issuer: at startup it generates an
Ed25519 keypair and mints its own DID (by calling get_did with
entity_type="IDM"). Credentials are signed with that issuer key, which stays
in-process and is never returned by any tool.
Requirements
- uv
- Python 3.12 (pinned via
.python-version) - Node.js /
npx— only needed for the MCP Inspector (mcp dev)
Dependencies (mcp[cli], cryptography) are managed by uv and installed on first run.
Setup
This project uses uv. Dependencies are declared in
pyproject.toml and pinned in uv.lock — together these replace a
requirements.txt.
After installing uv once, clone or unzip the project and run:
uv run python main.py
uv run automatically creates the virtual environment, installs the exact
locked dependencies, and even fetches Python 3.12 (pinned in .python-version)
if it's missing — no manual venv creation or activate step. Run uv sync
first if you'd rather install dependencies without starting the server.
Prefer plain pip? Export a requirements file from the lockfile, then install the old way:
uv export --format requirements-txt --no-hashes > requirements.txt
# recipient: python -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt
Running
# Run the server (transport is selected in main(); currently streamable-http,
# served at http://127.0.0.1:8000/mcp)
uv run python main.py
# Develop / test interactively with the MCP Inspector (opens a browser UI)
uv run mcp dev main.py
To change the transport, edit the transport variable in main() ("stdio" or
"streamable-http").
Using it from Claude Code
Register the server as a stdio MCP server:
claude mcp add idm-mcp -- uv --directory /path/to/idm_mcp run python main.py
(For stdio, set transport = 'stdio' in main().)
Generating a keypair
The tools operate on an Ed25519 keypair that the agent owns. To generate one, run:
uv run python keygen.py
# Public Key: <64 hex chars>
# Secret Key: <64 hex chars>
The public key (hex) is what you pass as pk to get_did. Keep the
secret key with the agent — it is never sent to the server.
Tools
get_did(entity_type, pk, pktype, description="", protocol="", transparency="")
Creates a DID record from an agent's public key.
| Param | Required | Description |
|---|---|---|
entity_type |
yes | Kind of entity, e.g. "AIagent", "toolbox". |
pk |
yes | Raw Ed25519 public key as hex (64 chars, from keygen.generate_raw_keys()). |
pktype |
yes | Key algorithm label, e.g. "ed25519". |
description, protocol, transparency |
no | Optional metadata recorded on the record. |
Returns the DID record, including its id (the DID).
get_vc(subjectID, content, keyType, signType, usage)
Issues and stores a Verifiable Credential for a subject DID.
| Param | Description |
|---|---|
subjectID |
The subject's DID (as minted by get_did). |
content |
What the credential grants, e.g. "callTools". |
keyType |
Recorded as the proof's cryptosuite value, e.g. "Ed25519". |
signType |
signature scheme, e.g. "asy"; Reserved (currently unused; only asymmetric signing is performed). |
usage |
Intended use, e.g. "authorization". |
The credential is signed by the issuer key over a canonical serialization
(sorted-key compact JSON, with proof empty at signing time).
verify_vc(vc)
Verifies a credential's issuer signature. Rebuilds the exact signed bytes
(proof reset to ""), resolves the issuer key, and checks the Ed25519
signature. Returns {"valid": bool, "issuer": ..., "subjectId": ..., "reason": ...}.
Only credentials issued by this server are verifiable, because other issuers' DIDs are not yet resolvable (no DID registry).
Example flow
An MCP client — an agent, Claude Code, or the MCP Inspector — calls the tools in sequence. The agent supplies its own Ed25519 public key (hex) when requesting a DID (see Generating a keypair).
-
get_did— request a DID for the agent:{ "entity_type": "AIagent", "pk": "4bb0…3c6f", "pktype": "ed25519", "description": "AIassistant", "protocol": "MCP", "transparency": "6GPDL" }→ returns a DID record whose
idis e.g.did:ietf:ebc391…. -
get_vc— issue a credential for that DID as the subject:{ "subjectID": "did:ietf:ebc391…", "content": "callTools", "keyType": "Ed25519", "signType": "asy", "usage": "authorization" }→ returns a signed Verifiable Credential.
-
verify_vc— pass the credential back to check its signature:{ "vc": { "...": "the credential returned by step 2" } }→
{ "valid": true, "issuer": "did:ietf:…", "subjectId": "did:ietf:ebc391…" }
The quickest way to try this by hand is uv run mcp dev main.py, which opens the
MCP Inspector where you can call each tool and paste results between steps.
Project structure
idm_mcp/
├── main.py # FastMCP server + the get_did / get_vc / verify_vc tools
├── keygen.py # Ed25519 key generation + sign/verify primitives (hex-encoded keys)
├── pyproject.toml # uv project + dependencies
└── README.md
Limitations
This is a mock, not production identity infrastructure:
- In-memory only — issued VCs and the issuer key are lost on restart.
- No DID registry — DIDs aren't stored, so only this server's own credentials can be verified.
signTypeis unused, andpktypeis not validated (onlyed25519is actually handled;pkis validated to be a 32-byte Ed25519 key).- Canonical JSON signing, not full JSON-LD Data Integrity canonicalization.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。