This page documents the codemode command, its subcommands, and their options.
codemode [options] <command> [arguments]
Run codemode --help or codemode <command> --help for the same information in the terminal.
| Option | Behavior |
|---|---|
--json |
Print one JSON value instead of formatted text |
-q, --quiet |
Suppress progress and informational output |
--no-color |
Disable colored output |
-v, --version |
Print the version and exit |
Codemode reads the nearest .codemode folder at or above the working directory. See Configuration.
codemode exec 'return await github.issue.get({ owner: "nodejs", repo: "node", issueNumber: 1 })'
codemode exec -f ./scripts/triage.js
codemode actions --connectedSee Run Code for the calling conventions and the runtime.
exec <code>, aliase
Runs JavaScript and prints the returned value. Logs go to stderr, and--quiethides them. A failed run exits with status 1. With--json, prints{ result, logs }or{ error, logs }, withtruncatedandfullResultPathwhen the result passed the output limit.exec --no-limit
Prints the whole result and logs, however large. Use it to pipe a result to another program.exec -f,--file
Treats<code>as the path of a file to run.exec -e,--package <source>
Loads a package for this run without recording it. Repeat it for several packages. A relative path resolves from the working directory.actions
Lists every loadable action with its access label, inputs, and description. With--json, includes each input schema.actions -c,--connected
Lists only the actions of plugins that have a connection, and of configured MCP servers.actions -e,--package <source>
Includes a package's actions for this listing only.
exec loads a bundled plugin only when a connection names it. actions loads every bundled plugin.
Both load every enabled MCP server as a plugin. A server whose tool list is not cached is connected to once.
codemode connection add gh --plugin github --set token=$GITHUB_TOKEN
codemode auth gmailSee Connections for environment variables, OAuth setup, and storage.
connection add <name> -p <plugin>
Adds a connection, or replaces the one with that name.-p,--pluginis required.connis an alias ofconnection.connection add -s,--set <key=value>
Sets one config value. Repeat it for several values.connection list
Lists connections. With--json, includes field names with redacted values.connection remove <name>
Removes a connection.auth <plugin>
Runs the plugin's OAuth login in the browser and saves the tokens as a connection.auth -n,--name <name>
Names the connection. The default is the plugin name.auth --client-id <id>,--client-secret <secret>
Supply the OAuth client. Without them, codemode reads the plugin's environment variables and then prompts.
codemode install npm:@example/codemode-orders@1.2.0
codemode list --outdated
codemode updateSee Packages for sources, versions, and the package format.
install <source>
Fetches a package, shows its plugins, action counts, and credential targets, and records it after confirmation. Install scripts do not run.install -l,--local
Records the package in the project's.codemodefolder instead of~/.codemode, and trusts the project.install -y,--yes
Installs without asking. Required when there is no terminal.remove <source>, aliasuninstall
Removes a package's entry and its installed files. Add-l,--localto remove it from the project.update [source]
Updates one package or all of them. Exact versions, tags, and commits stay where they are. A package that cannot be updated is reported, the others are still updated, and the command exits with status 1.list, aliasls
Lists configured packages. Add--outdatedto show the ones with newer versions.search [terms]
Searches npm for packages with thecodemode-pluginkeyword.
A source is npm:<name>[@version], git:<host>/<path>[@ref], a git URL, or a local path.
codemode mcp add files -- npx -y @modelcontextprotocol/server-filesystem .
codemode mcp add sentry --url https://mcp.sentry.dev/mcp
codemode auth sentrySee MCP Servers for entries, secrets, and sign-in.
mcp add <name> -- <command> [args]
Adds a server that runs as a local program, connects to it once, and reports its state.mcp add <name> --url <url>
Adds a server reached over Streamable HTTP.mcp add --env <KEY=VALUE>
Adds a variable to the command's environment. Repeat it for several.mcp add --header <KEY=VALUE>
Sends a header with every request to the URL. Repeat it for several.mcp add -l,--local
Records the server in the project's.codemode/config.jsonand trusts the project. The default is~/.codemode/config.json.mcp list, aliasmcp ls
Connects to every enabled server and prints its state, the number of tools its entry loads, and its error. Exits with status 1 when an enabled server is not connected.mcp refresh [name]
Reads tool lists again from every enabled server, or from one. A server that cannot be read is reported, the others are still read, and the command exits with status 1. With--json, prints{ ok, refreshed, changed, problems }.mcp remove <name>
Removes a server and its cached tool list. Add-l,--localto remove it from the project.auth <name>
Signs in to an HTTP server that uses OAuth and saves the result in its connection. The name is the server's, as configured or as written in code.
codemode plugin listSee Plugins for how plugins load.
plugin list
Lists loaded plugins with their versions, action counts, and the folder, package, or MCP configuration each came from. It starts no MCP server, so a server whose tool list is not cached shows no actions.plugin install <source>
Installs a package into the project without asking. Add-g,--globalto install into~/.codemode.plugin remove <source>
Removes a package from the project, or from~/.codemodewhen the project does not have it.
codemode init
codemode trustinit
Creates.codemode/config.jsonand.codemode/plugins/in the working directory and trusts the new project.trust [dir]
Allows the plugins, packages, and MCP servers of a project's.codemodefolder to load. The default is the nearest one. Your own~/.codemodefolder needs no trust and is refused.trust --revoke
Withdraws that trust.
See Project trust.
Commands exit with status 0 on success and 1 on failure. With --json, a failed package or MCP command prints { ok: false, error, code }.