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

ai-sdk-relayshield

v0.1.3

Published

Vercel AI SDK tools and a mandatory pre-execution gate for RelayShield's MCP registry risk and prompt-injection breach checks.

Readme

ai-sdk-relayshield

Vercel AI SDK tools and a mandatory pre-execution gate for RelayShield's agentic-security endpoints — MCP server registry risk and AI-agent-sourced credential breach detection.

Install

npm install ai-sdk-relayshield

Tools

import { generateText } from "ai";
import { checkMcpServerRisk, checkPromptInjectionBreach } from "ai-sdk-relayshield";

const result = await generateText({
  model,
  tools: { checkMcpServerRisk, checkPromptInjectionBreach },
  prompt: "Is it safe to connect to the MCP server at https://mcp.example.com/sse? My RelayShield key is rs_live_...",
});
  • checkMcpServerRisk — flags known-malicious IOC matches, typosquat domains, and newly-registered domains hosting an MCP server, before an agent connects to or installs it.
  • checkPromptInjectionBreach — checks whether an email appears in RelayShield's stolen-session corpus with a suspected-agentic-source marker (a session/token exposure that shows signs of having been captured via a compromised AI agent).

Both tools take apiKey as a call argument rather than reading it from the environment implicitly — a shared agent process can act safely on behalf of multiple callers with different RelayShield keys.

Get a key at api.relayshield.net/developers.

Mandatory gate

Most "AI agent security" checks are optional — the agent can call them, but nothing stops it skipping the call and taking the risky action anyway. relayshieldMcpGate is the other kind: a gate the SDK enforces before a protected action (connecting to or installing an MCP server) can happen at all, built on the Vercel AI SDK's toolApproval option.

import { generateText } from "ai";
import { relayshieldMcpGate } from "ai-sdk-relayshield";

// Attach directly to your own connect/install tool — the gate is scoped by
// which tool key you attach it to, not by matching tool names inside it.
const result = await generateText({
  model,
  tools: { connectMcpServer },
  toolApproval: { connectMcpServer: relayshieldMcpGate },
  prompt,
});

relayshieldMcpGate reads serverUrl/packageName (or server_url/package_name) off the tool's parsed input and returns "denied" to block the call, or undefined to let it proceed — the shape the Vercel AI SDK's per-tool toolApproval function expects.

Properties, all non-negotiable by design:

  • An internal exception defaults to "denied", never silently allows — a gate failure must not become a pass.
  • Bounded retry applies only to transient upstream failures (timeout/429/5xx) — auth failures, malformed responses, and payment-required states are terminal after one attempt.
  • The gate logs the decision, reason codes, check version, target, and timestamp — never keys, payment proofs, or session material.
  • The raw connect/install tool should never be bound to the model directly in a real deployment — only route access to it through the gate.

Same normalized policy as langchain-relayshield's RelayShieldMCPGateMiddleware and openai-agents-relayshield's relayshield_mcp_gate — ported rather than imported, so this package has no dependency on either.

License

MIT