Skip to content

Add delegated-end-user-context reference example package - #4641

Draft
axiak wants to merge 1 commit into
modelcontextprotocol:mainfrom
axiak:ma-delegated-user-auth
Draft

Add delegated-end-user-context reference example package#4641
axiak wants to merge 1 commit into
modelcontextprotocol:mainfrom
axiak:ma-delegated-user-auth

Conversation

@axiak

@axiak axiak commented Aug 14, 2026

Copy link
Copy Markdown

Description

Add a new private TypeScript package at src/delegated-user-auth/ that implements the MCP extension io.modelcontextprotocol/delegated-end-user-context as a readable, well-commented reference for other developers. The package includes:

  • extension.ts: shared wire contract (Zod schemas, error builders, redaction)
  • policy.ts: frozen default policy catalog + pure intersection (never widens)
  • data.ts: fake user data, identity canonicalization, scope→field projection
  • jwt.ts: in-repo IdP via jose with test-controllable minting and typed errors
  • server.ts: low-level Server with override-initialize, inline authorizeRequest, and all tool/resource handlers; requires a server-owned trusted-issuer allowlist
  • client.ts: agent-platform client with per-instance overrides and _meta injection
  • demo.ts: in-memory walkthrough (phases 1–7) with redacted printing
  • index.ts: launcher
  • 74 invariant-focused tests and a tutorial README

Also add the spec file (delegated-user-auth.md) and update .gitattributes to suppress the indent-with-non-tab whitespace check for package-lock.json (npm uses space indentation throughout the lockfile).

Publishing Your Server

Note: We are no longer accepting PRs to add servers to the README. Instead, please publish your server to the MCP Server Registry to make it discoverable to the MCP ecosystem.

To publish your server, follow the quickstart guide. You can browse published servers at https://registry.modelcontextprotocol.io/.

Server Details

  • Server:
  • Changes to:

Motivation and Context

How Has This Been Tested?

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follows MCP security best practices
  • I have updated the server's README accordingly
  • I have tested this with an LLM client
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have documented all environment variables and configuration options

Additional context

Add a new private TypeScript package at src/delegated-user-auth/ that
implements the MCP extension `io.modelcontextprotocol/delegated-end-user-context`
as a readable, well-commented reference for other developers. The package
includes:

- extension.ts: shared wire contract (Zod schemas, error builders, redaction)
- policy.ts: frozen default policy catalog + pure intersection (never widens)
- data.ts: fake user data, identity canonicalization, scope→field projection
- jwt.ts: in-repo IdP via jose with test-controllable minting and typed errors
- server.ts: low-level Server with override-initialize, inline authorizeRequest,
  and all tool/resource handlers; requires a server-owned trusted-issuer allowlist
- client.ts: agent-platform client with per-instance overrides and _meta injection
- demo.ts: in-memory walkthrough (phases 1–7) with redacted printing
- index.ts: launcher
- 74 invariant-focused tests and a tutorial README

Also add the spec file (delegated-user-auth.md) and update .gitattributes
to suppress the indent-with-non-tab whitespace check for package-lock.json
(npm uses space indentation throughout the lockfile).
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.

1 participant