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

@getcordon/policy

v0.2.10

Published

TypeScript SDK for configuring Cordon for MCP — the security gateway for MCP tool calls.

Downloads

1,052

Readme

@getcordon/policy

TypeScript SDK for configuring Cordon for MCP — the security gateway for MCP tool calls.

This package exports defineConfig and the config type surface. You only need it if you're writing a cordon.config.ts file.

Install

npm install @getcordon/policy

cordon init (from the @getcordon/cli package) installs this automatically into your project.

Usage

import { defineConfig } from '@getcordon/policy';

export default defineConfig({
  servers: [
    {
      name: 'database',
      transport: 'stdio',
      command: 'npx',
      args: ['-y', '@modelcontextprotocol/server-postgres', process.env.POSTGRES_URL!],
      policy: 'read-only',
    },
    {
      name: 'github',
      transport: 'stdio',
      command: 'npx',
      args: ['-y', '@modelcontextprotocol/server-github'],
      policy: 'approve-writes',
      tools: {
        delete_repository: 'block',
        create_pull_request: 'approve',
      },
    },
  ],

  audit: {
    enabled: true,
    output: 'file',
  },

  approvals: {
    channel: 'terminal',
    timeoutMs: 60_000,
  },

  rateLimit: {
    perServerPerMinute: 60,
  },
});

Policy actions

| Policy | Behavior | |---|---| | allow | Pass through immediately | | block | Reject with an error | | approve | Pause the agent, prompt for human approval | | approve-writes | Reads pass through, writes require approval | | read-only | Writes are blocked, reads pass through | | log-only | Pass through, flagged in audit log | | hidden | Filtered from tools/list — the model never sees it | | sql-read-only | Parse the SQL arg; allow SELECT, block everything else (fail-closed on unparseable) | | sql-approve-writes | Parse the SQL arg; allow reads, pause writes for approval, block unparseable |

Policies can be set at the server level or per-tool. Per-tool overrides the server default.

SQL-aware policies

For database MCP servers where a single tool takes arbitrary SQL, Cordon can parse the statement and decide based on type rather than tool name:

tools: {
  query: 'sql-read-only',            // default: inspects arg named 'sql'
  execute: 'sql-approve-writes',
  run: { action: 'sql-read-only', sqlArg: 'statement' },  // custom arg name
}
  • Uses PostgreSQL dialect. Other dialects: future release.
  • Fail-closed: unparseable SQL (malformed, non-string, missing arg) is blocked rather than allowed.
  • Classified as reads: SELECT, WITH ... SELECT CTEs, SHOW, bare EXPLAIN SELECT/... (the leading EXPLAIN is stripped before classifying the inner statement).
  • Classified as writes: everything else — INSERT/UPDATE/DELETE/DROP/ALTER/TRUNCATE/CREATE/SET/BEGIN/COMMIT/ROLLBACK etc. EXPLAIN ANALYZE is deliberately NOT stripped (ANALYZE actually executes the query) and falls through to unknown.
  • Multi-statement input classifies as write if any statement is non-read.

Known parser limitations (PostgreSQL dialect)

The underlying node-sql-parser doesn't parse these in PG mode, so they fall through to 'unknown' and get blocked under sql-read-only (you'd need to switch to sql-approve-writes, add a tool-level override, or wrap the intent in a supported form):

  • DESCRIBE users / DESC users (MySQL-style; use SELECT * FROM information_schema.columns WHERE table_name = 'users' instead)
  • Standalone VALUES (1, 2), (3, 4) (wrap in SELECT * FROM (VALUES ...) AS t(a,b))
  • PRAGMA foreign_keys = ON (SQLite-specific)
  • EXPLAIN ANALYZE ... (deliberately not supported — ANALYZE runs the query)

Source

https://github.com/marras0914/cordon