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/fastmcp

v0.2.0

Published

Authplane JWT validation adapter for FastMCP

Readme

@authplane/fastmcp

Authplane JWT validation adapter for FastMCP. Bearer-token auth on your FastMCP server in a few lines.

Install

npm install @authplane/sdk @authplane/fastmcp fastmcp zod

Requires Node.js 20 LTS or newer.

Quickstart

import { FastMCP, requireScopes } from "fastmcp";
import { authplaneFastMcpAuth, type AuthplaneFastMcpSession } from "@authplane/fastmcp";
import { z } from "zod";

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

const server = new FastMCP<AuthplaneFastMcpSession>({
  name: "weather",
  version: "1.0.0",
  authenticate: auth.authenticate,
  oauth: auth.oauth,
});

server.addTool({
  name: "get_weather",
  parameters: z.object({ city: z.string() }),
  canAccess: requireScopes("tools/get_weather"),
  execute: async ({ city }) => ({ content: [{ type: "text", text: `${city}: sunny` }] }),
});

await server.start({ transportType: "httpStream", httpStream: { port: 8090, endpoint: "/mcp" } });

auth.authenticate validates the bearer token and exposes a typed session; auth.oauth publishes the RFC 9728 Protected Resource Metadata automatically.

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 authplaneFastMcpAuth({
  issuer: "http://localhost:9000",
  resource: "http://localhost:8090/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/fastmcp";

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

Compatibility

Tested against fastmcp@^3.35.0 (verified on 3.35.x and 4.0.1).

If you configure inboundDPoP in any mode (Required or Supported — every accepted DPoP-bound request goes through the replay store), note that the adapter relies on a per-request verification cache to accommodate FastMCP's current authenticate invocation pattern: FastMCP calls the callback twice per HTTP request (once at the request gate, once when building the session payload), but RFC 9449 inbound replay verification can only run once per proof. The cache uses Node's AsyncLocalStorage scoped to the request's async context (see src/auth.ts): both invocations within the same HTTP request share the in-flight verifyAccessToken promise, and different requests carry distinct async contexts so cross-request leakage is structurally impossible. If a future FastMCP version moves the second authenticate invocation to a callsite that loses async-context propagation, you may observe DPoPReplayDetected errors on previously-working flows — please file an issue.

Learn more

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

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