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

@codex-modules/mcp-manager

v0.1.0

Published

Safely manage Codex MCP server registrations with collision checks, backups, patches, and rollback.

Downloads

118

Readme

MCP Manager

Safely manage Codex MCP server registrations with collision checks, backups, advanced-key patches, dry-run planning, and rollback.

What it does

codex-mcp-manager is a small wrapper around the official codex mcp CLI. It delegates normal add, remove, list, and get operations to Codex so the official writer and validation stay in charge, then adds the safety features that are useful for repeatable setup scripts:

  • detects name collisions before add
  • creates backups before mutating config.toml
  • records backup manifests for rollback
  • supports dry-run plans
  • patches advanced MCP table keys that codex mcp add does not expose
  • rejects plaintext bearer tokens; use environment-variable references instead

The manager supports stdio servers and streamable HTTP servers.

Install

npm install @codex-modules/mcp-manager

For local development inside this repository:

cd modules/mcp-manager
npm install
npm run build

Usage

Add a stdio server:

codex-mcp-manager add \
  --name docs \
  --command node \
  --arg /path/to/server.js

Add a streamable HTTP server:

codex-mcp-manager add \
  --name web \
  --url https://mcp.example.com/mcp \
  --bearer-token-env-var MCP_WEB_TOKEN

Read a server definition from JSON:

{
  "name": "github",
  "url": "https://mcp.example.com/github",
  "bearerTokenEnvVar": "GITHUB_MCP_TOKEN",
  "httpHeaders": {
    "X-Client": "codex"
  }
}
codex-mcp-manager plan --from github.json --json
codex-mcp-manager add --from github.json --force

Patch advanced keys under an existing [mcp_servers.<name>] table:

codex-mcp-manager patch github \
  --set startup_timeout_sec=20 \
  --set 'enabled_tools=["search","open"]'

Inspect or remove servers:

codex-mcp-manager list --json
codex-mcp-manager get github --json
codex-mcp-manager remove github
codex-mcp-manager doctor

Use --codex-home DIR on any command to target an isolated Codex home instead of the current user's default ~/.codex.

API

import {
  addServer,
  doctor,
  getServer,
  listServers,
  patchServer,
  patchServerText,
  plan,
  removeServer,
  rollback,
  type ServerDef,
} from "@codex-modules/mcp-manager";

const def: ServerDef = {
  name: "web",
  url: "https://mcp.example.com/mcp",
  bearerTokenEnvVar: "MCP_WEB_TOKEN",
};

await plan(def, { codexHome: "/tmp/codex-home" });
await addServer(def, { codexHome: "/tmp/codex-home", force: true });
await patchServer("web", { startup_timeout_sec: 20 }, { codexHome: "/tmp/codex-home" });
await rollback({ codexHome: "/tmp/codex-home" });

ServerDef accepts either:

  • stdio: { name, command, args?, env?, envVars? }
  • HTTP: { name, url, bearerTokenEnvVar?, httpHeaders? }

Do not pass plaintext bearer tokens. Values named bearer_token, bearer-token, or bearerToken are rejected. Store the secret in an environment variable and pass bearerTokenEnvVar.

patchServerText(content, name, keys) is exported for fixture tests and tools that need to preview a table patch without touching disk.

How it works

For add, remove, list, and get, this module calls the installed codex binary with CODEX_HOME set to the requested target directory. Before a mutating operation, it copies config.toml into:

<CODEX_HOME>/codex-mcp-manager-state/backups/

Each backup is recorded in:

<CODEX_HOME>/codex-mcp-manager-state/manifest.jsonl

patchServer is intentionally narrower than a TOML rewriter. It validates the file, inserts or replaces only the requested keys inside [mcp_servers.<name>], validates again, and asks codex mcp get --json to parse the result. This avoids reserializing unrelated parts of config.toml.

Codex itself may reserialize an MCP server table when codex mcp add replaces that table. Top-level comments and unrelated keys are expected to remain, but comments inside the affected MCP server table are not preserved by Codex.

Uninstall and rollback

Removing the npm package does not edit Codex configuration:

npm uninstall @codex-modules/mcp-manager

To undo the last change made by this module:

codex-mcp-manager rollback

For an isolated home:

codex-mcp-manager rollback --codex-home /tmp/codex-home

If the CLI is unavailable, restore manually by copying the latest backup from <CODEX_HOME>/codex-mcp-manager-state/backups/ over <CODEX_HOME>/config.toml. The manifest at <CODEX_HOME>/codex-mcp-manager-state/manifest.jsonl records which file each backup belongs to.

Attribution

Schema mapping was informed by jtianling/mcps-manager (MIT). Writer and backup patterns were informed by Brightwing-Systems-LLC/mcp-manager (MIT).