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

@agentvalet/mcp-broker

v0.1.1

Published

Embeddable credential broker and policy enforcement for third-party MCP servers. Wrap once; every tool is policy-checked, credential-injected, and audited.

Readme

@agentvalet/mcp-broker

An embeddable credential broker and policy enforcement wrapper for MCP servers. Wrap your server once. Every tool you register after that is policy-checked, gets a resolved narrow credential injected at call time, and emits an audit record. The agent never holds the downstream secret.

It's free and open source. The paid layer is the hosted AgentValet control plane (managed policy, push approvals, SSO, central audit, the vault), and it plugs in through the same four interfaces this package defines.

This is the mirror image of @agentvalet/mcp-server: that package lets an agent call platforms through the AgentValet proxy, whereas this package lets you embed AgentValet enforcement inside your own MCP server.

Install

npm install @agentvalet/mcp-broker

@modelcontextprotocol/sdk is a peer dependency you already have. The broker itself has zero runtime dependencies.

Three lines to adopt

import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { broker } from "@agentvalet/mcp-broker";

const server = new McpServer({ name: "github-tools", version: "1.0.0" });

// Wrap once. Every tool registered after this is policy-checked,
// credential-injected, and audited.
broker(server, {
  policy: "file:./policy.yaml",          // or "authzen:https://pdp.example.com"
                                          // or "agentvalet:" (hosted)
  secrets: "env:",                        // or "file:./secrets.enc"
  audit: "jsonl:./audit.log",             // or "agentvalet:" (hosted)
});

server.tool("create_issue", schema, async (args, ctx) => {
  // ctx.credential is the resolved, narrow secret for this call only.
  return await githubClient(ctx.credential.token).issues.create(args);
});

You don't restructure your handlers. broker() intercepts tool registration, so register your tools after the wrap and each one runs inside the enforcement pipeline:

resolve identity -> evaluate policy -> (approval if required) ->
resolve credential -> invoke handler -> redact -> audit

Fail closed by default

failMode defaults to "closed". If the policy source is unreachable, the call is denied. "open" exists for a dev loop only, and it logs loudly on every request. A security tool that fails open is not a security tool.

The same policy semantics as the hosted plane, provably

The file: policy source evaluates your local YAML with a byte-identical copy of the exact policy kernel the hosted AgentValet plane runs. The copy is generated by a sync script and a contract test fails the build if it ever drifts. So a rule you write locally decides allow, deny, or require_approval with the same semantics you'd get in the cloud. There's no second implementation to disagree with.

Local policy is small on purpose

version: 1
defaults:
  effect: deny
rules:
  - tool: create_issue
    effect: allow
    credential: github_issues_rw
  - tool: delete_repo
    effect: require_approval
    credential: github_admin

One file, one rule per tool, deny by default. There are no environments, no inheritance, no templating, and no record of who changed a rule. That's a deliberate limit, not a missing feature. The moment you need any of those, you've outgrown a single file, and that's what the hosted plane is for. This format will never grow them.

The four interfaces

Every escape hatch is an interface, and the hosted implementations are just the best implementation of each:

  • PolicySource decides allow, deny, or require_approval for a call.
  • SecretSource resolves a narrow credential and honours scope narrowing from the decision's obligations.
  • ApprovalProvider gates a call on a human decision. The reference implementation is a CLI y/n prompt with a timeout; the hosted one is push approval to the owner's devices.
  • AuditSink receives a stable, versioned event carrying an args fingerprint, never the raw arguments.

Pass a scheme string ("file:", "env:", "jsonl:", "authzen:", "agentvalet:") or your own implementation object. Both work everywhere.

What the audit records

Each tool call emits one event: caller identity, server and tool, an args fingerprint (never the raw args), the decision and policy version, the credential scope, latency, and the outcome. Every outcome is covered, including denials, approval timeouts, and handler errors.

License

MIT.