Examples
Runnable, well-commented examples live in the repository's examples/ directory.
Each example is a self-contained TypeScript file.
The examples resolve the workspace packages directly, so they run against your checkout instead of a published build.
Examples
| File | What it shows |
|---|---|
pii-redaction-audit.ts | The canonical mcpose pattern: PII redaction composed with audit middleware over HTTP/SSE, with per-session identity resolution. Needs an upstream MCP server. |
governance-proxy.ts | Governance features: hiddenTools, passThroughTools, and onTelemetry. Self-contained, uses createMockBackendClient, so no upstream server is needed. |
oauth-upstream-client.ts | Connecting to an OAuth-protected remote MCP server from Node: dynamic client registration, PKCE, browser authorization, and persisted tokens with automatic refresh. Needs an OAuth-capable upstream MCP server. |
Run them
From the repository root, install dependencies and run an example with tsx:
# From the repository root:
pnpm install
pnpm --filter mcpose-examples governance-proxy # governance (self-contained, no upstream needed)
pnpm --filter mcpose-examples pii-redaction-audit # PII redaction + audit (needs an upstream MCP server)
pnpm --filter mcpose-examples oauth-upstream-client # OAuth against a remote MCP serverWhat you supply
Each example expects a few things supplied by your application: an upstream MCP server endpoint, an identity resolver, and durable sinks for audit events and manifests.
The comments in each file walk through the setup step by step and mark the values you need to supply.
pii-redaction-audit.ts needs an upstream MCP server.
governance-proxy.ts uses createMockBackendClient and runs with zero external dependencies.
Reference implementation
Reference implementation:
elastic-pii-proxyis a production example of this pattern: an Elasticsearch MCP proxy that uses mcpose with PII redaction and@mcpose/auditto serve financial data safely to LLM agents.