npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@bluealba/pae-mcp-sdk

v0.2.0-feature-rename-platform-to-pillar-502

Published

Utilities for Blue Alba Platform in-house MCP servers: forwarded-identity extraction and on-behalf-of (RFC 8693) gateway calls with public-origin propagation.

Downloads

581

Readme

@bluealba/pae-mcp-sdk

Utilities for Pillar in-house MCP servers that act on behalf of the user against the Pillar gateway.

It embeds the identity plumbing every such server needs:

  • reading the federated identity the gateway forwards (x-forwarded-mcp-token, x-forwarded-host, x-forwarded-proto);
  • OAuth 2.0 Token Exchange (RFC 8693) — trading the user's MCP token for a short-lived on-behalf-of access token, no service secret;
  • public-origin propagation: the server reaches the gateway by its internal hostname, but the gateway derives the OAuth issuer/audience of its self-issued tokens from the request Host. Without forwarding the public origin, token exchange and the on-behalf-of re-entry are validated against the internal host and rejected with Untrusted issuer. This SDK forwards it automatically.

Usage

import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { PlatformGatewayClient, runOnBehalfOfUser } from '@bluealba/pae-mcp-sdk';

const GATEWAY_URL = process.env.GATEWAY_URL ?? 'http://pae-nestjs-gateway-service';

// `resource` is THIS server's base path (RFC 8707) — one per MCP server.
const gateway = new PlatformGatewayClient({ gatewayUrl: GATEWAY_URL, resource: '/my-mcp' });

server.registerTool('list_things', { description: '…', inputSchema: {} }, (_args, extra) =>
  runOnBehalfOfUser(extra, gateway, (client, token) =>
    client.request('GET', '/things', { accessToken: token }),
  ),
);

runOnBehalfOfUser reads the token from extra, binds the client to the request's public origin, exchanges the token, runs the action with the scoped client + access token, and maps errors to an MCP tool error. Reuse the single exchanged token across every gateway call the action makes.

Domain clients

Extend PlatformGatewayClient with typed domain methods; scoping preserves the subclass, so domain methods remain available on the client passed to the action:

class MyApiClient extends PlatformGatewayClient {
  constructor(opts: { gatewayUrl: string }) {
    super({ ...opts, resource: '/my-mcp' });
  }
  listThings(token: string) {
    return this.request('GET', '/things', { accessToken: token });
  }
}

API

  • getForwardedMcpToken(extra) / getForwardedOrigin(extra) — read the forwarded identity.
  • PlatformGatewayClientexchangeToken, request, withForwardedOrigin.
  • runOnBehalfOfUser(extra, client, action) — the full on-behalf-of tool flow.
  • okResult / errorResult / ToolResult — MCP tool result helpers.
  • GatewayApiError — thrown on non-2xx gateway responses.