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

@authplane/mcp

v0.2.0

Published

Authplane JWT validation adapter for MCP TypeScript SDK

Readme

@authplane/mcp

Authplane JWT validation adapter for the official MCP TypeScript SDK. Bearer-token auth on your MCP server in a few lines.

Install

npm install @authplane/sdk @authplane/mcp @modelcontextprotocol/sdk express zod

Requires Node.js 20 LTS or newer.

Quickstart

import express from "express";
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { authplaneMcpAuth } from "@authplane/mcp";
import { z } from "zod";

const server = new McpServer({ name: "weather", version: "1.0.0" });
server.tool(
  "get_weather",
  { city: z.string() },
  async ({ city }) => ({ content: [{ type: "text", text: `${city}: sunny` }] }),
);

const auth = await authplaneMcpAuth({
  issuer: "https://auth.example.com",
  resource: "https://mcp.example.com/mcp",
  scopes: ["tools/get_weather"],
});

const app = express();
app.use(express.json());
app.get(auth.protectedResourceMetadataPath, auth.protectedResourceMetadataHandler);
app.all("/mcp", auth.bearerAuth /* , transport handlers */);
app.listen(3000);

auth.bearerAuth is an Express middleware that validates the bearer token, enforces scopes, and attaches req.auth (MCP's AuthInfo).

Per-tool scope enforcement

Two requireScope symbols exist; use the right one:

  • requireScope(scope, extra.authInfo) from @authplane/mcp — call inside an MCP tool handler. Throws if the bound bearer token does not carry scope.
  • claims.requireScope(scope) method on VerifiedClaims from @authplane/sdk/core — call when you are doing manual JWT validation outside the MCP request flow and you already hold a VerifiedClaims.

In a normal MCP server you only need the first one; the bearer middleware already populated extra.authInfo for you.

Local development

The default FetchSettings reject plaintext http:// issuers (SSRF protection). When pointing the adapter at a local authserver — typically http://localhost:9000 — pass devMode: true to relax the network policy:

const auth = await authplaneMcpAuth({
  issuer: "http://localhost:9000",
  resource: "http://localhost:8080/mcp",
  scopes: ["tools/get_weather"],
  devMode: true,
});

Warning: Never set devMode: true in production — it disables SSRF protection entirely.

devMode: true is shorthand for fetchSettings: new FetchSettings({ ssrfProtection: false, allowHttp: true, allowLocalhost: true, allowPrivateNetworks: true }). If you need finer control (e.g. allow loopback but keep HTTPS-only), construct a FetchSettings directly and pass it as fetchSettings:

import { FetchSettings } from "@authplane/mcp";

Without one of these, metadata discovery against an http:// issuer fails with MetadataFetchError: URL must use HTTPS.

Learn more

  • User Guide — complete reference: options, scope enforcement, URL elicitation, introspection, error handling, advanced configuration.
  • @authplane/sdk — the underlying OAuth/JWT primitives.

On shutdown call await auth.client.close() to stop internal refresh timers.