Repository navigation
cmd mcp
Start the nSelf MCP server: a tool for every exposed command, plus resources and prompts, for Claude Code and other MCP clients.
nself mcp <subcommand> [flags]
nself mcp starts a Model Context Protocol server that
exposes nSelf as tools, resources, and prompts. MCP clients (including Claude Code) can
then call those directly, without leaving their coding environment.
By default the server runs over stdio, which is the correct mode for Claude Code's
mcpServers configuration. Use --transport sse or --transport http (streamable HTTP)
to expose the server over a local port instead — set NSELF_MCP_TOKEN to require a bearer
token on those two transports (stdio has no network exposure, so it never needs one).
nself mcp must be run from inside a directory that contains an nSelf project (i.e. one
initialised by nself init). The server exits immediately if no project is found.
The tool list is generated, not hand-written: one tool per exposed command of the command registry, with its summary, side effect, whether it asks for confirmation, and a link to its input schema. See MCP-Tools for the current list. The 26 tools earlier releases registered by hand keep working under their old names; each is either the generated tool of the same name or a deprecated alias of one (see MCP-Server).
Every tool call runs the command as a child of the nself binary itself (resolved via
os.Executable(), never a bare "nself" on PATH) with --json, so the result is the
command's own v1 envelope. A tool that changes state outside the project returns
confirmation_required first; repeat the identical call with the confirm value to run it.
| Name | Description |
|---|---|
nself://config |
Project config snapshot |
nself://env |
Effective env cascade inputs |
nself://services |
Service inventory |
nself://urls |
Service URLs |
nself://env lists every env file present in the project (secrets redacted) but
deliberately does not compute which file wins for a given key — that precedence is being
revised (see nself env explain on the roadmap); ask the CLI, not this resource, for the
authoritative answer.
| Name | Description |
|---|---|
add-service |
Enable an optional service (or install a plugin) and bring it up safely |
diagnose-failure |
Investigate why an nSelf service is unhealthy or a project won't start |
prepare-deploy |
Run the pre-deploy checklist before promoting a project to staging or prod |
The five sentry_* tools wrap the same typed client the cmd-sentry command group uses,
so any MCP-capable AI agent can operate monitoring end to end. No dashboard visit needed.
Authentication resolves in this order: NSELF_SENTRY_API_KEY environment variable, then
~/.nself/sentry.json (written by nself sentry login). Set NSELF_SENTRY_API_URL to
target a self-hosted or local sentry bundle instead of the hosted SaaS.
Example prompts an agent can now handle:
Add an uptime monitor for https://api.example.com checked every minute.
Any open incidents right now? Acknowledge the critical one and summarize it.
Is our status page fully operational? If a component is degraded, list it.
List every monitor slower than a 60s interval and tell me which ones to tighten.
Write tools respect tier quotas server-side (free: 10 monitors at 5-minute intervals). The
API returns a quota error with an upgrade hint when a limit is reached. Monitor deletion is
deliberately not exposed over MCP; use nself sentry monitors rm from the CLI.
The nself_run_migration tool enforces a DDL allowlist before executing any SQL. This
prevents AI Studio sessions or automated agents from running destructive statements via
confirm: true set programmatically.
Permitted statement types:
CREATE TABLE IF NOT EXISTSALTER TABLE ADD COLUMNCREATE INDEXCREATE EXTENSIONCREATE POLICY-
INSERTwith an explicit column list -
UPDATEwith aWHEREclause DROP POLICY
Blocked statement types (return an error without executing):
| Blocked prefix | Why |
|---|---|
DROP TABLE |
Irreversible data loss |
DROP DATABASE |
Irreversible data loss |
DROP SCHEMA |
Irreversible data loss |
TRUNCATE |
Irreversible data removal |
DELETE FROM |
Unbounded data removal |
ALTER ROLE |
Privilege escalation |
GRANT |
Privilege escalation |
REVOKE |
Privilege removal |
\copy |
psql meta-command, data exfil risk |
\connect |
psql meta-command, connection switching |
The check is case-insensitive and strips leading SQL comments (-- ...) so that
comment-prefix bypasses are also blocked.
For blocked statement types, run nself db migrate directly from the CLI.
| Name | Shorthand | Type | Default | Env | Escalates to | JSON override | Description |
|---|---|---|---|---|---|---|---|
--allowed-host |
stringSlice |
[] |
Host name this server is reachable under; required (repeatable) for a non-loopback --host | ||||
--host |
string |
127.0.0.1 |
Bind address for the sse/http transports | ||||
--port |
-p |
int |
3825 |
Port for the sse/http transports | |||
--transport |
-t |
string |
stdio |
Transport: stdio, sse, or http | |||
--help |
-h |
bool |
false |
Show help |
| Name | Description |
|---|---|
setup |
Print or write the MCP client config and AGENTS.md for this project |
-
Side effect:
read -
Output:
stream -
JSON:
none - Exit codes: none declared
# Run as a Claude Code MCP server using stdio (recommended)
nself mcp# Run as an SSE server for browser-based clients
nself mcp --transport sse# Run SSE on a custom port
nself mcp --transport sse --port 4000# Run the streamable-HTTP transport
nself mcp --transport http --port 4000# Require a bearer token on the sse/http transports (stdio never needs one)
NSELF_MCP_TOKEN=$(openssl rand -hex 32) nself mcp --transport httpAdd the following to your project's .claude/settings.json:
{
"mcpServers": {
"nself": {
"command": "nself",
"args": ["mcp"]
}
}
}Claude Code will start nself mcp automatically and connect over stdio.
- cmd-doctor — run the nSelf diagnostics suite
- cmd-plugin — manage the plugin catalog
- cmd-start — start the nSelf stack
Getting Started
Commands
- Commands, Overview
- Lifecycle: cmd-init · cmd-build · cmd-start · cmd-stop · cmd-restart · cmd-dev
- Monitoring: cmd-status · cmd-logs · cmd-health · cmd-urls · cmd-doctor · cmd-monitor · cmd-alerts · cmd-sentry · cmd-watchdog
- Data: cmd-db · cmd-backup · cmd-dr · cmd-queue · cmd-webhooks
- Config: cmd-config · cmd-service · cmd-env · cmd-promote
- Networking: cmd-ssl · cmd-trust · cmd-dns-setup
- Security: cmd-access · cmd-security · cmd-secrets
- Tenancy: cmd-tenant · cmd-billing
- Plugins: cmd-plugin · cmd-license · cmd-dogfood (extracted, CLI-R11) · cmd-k8s (extracted, CLI-R11) · cmd-encryption (extracted, CLI-R11) · cmd-waf (extracted, CLI-R11) · cmd-federation (extracted, CLI-R11) · cmd-mail (extracted, CLI-R11) · cmd-dlq (extracted, CLI-R11)
- AI: cmd-ai · cmd-claw · cmd-model
- Templates: cmd-template
- Utilities: cmd-exec · cmd-clean · cmd-reset · cmd-update · cmd-upgrade · cmd-version · cmd-admin · cmd-migrate · cmd-migrate-firebase · cmd-migrate-supabase · cmd-completion
Features
- Features, Overview
- Feature-Auth
- Feature-Storage
- Feature-Search
- Feature-Functions
- Feature-Email
- Feature-Monitoring
- Feature-Plugins
- Feature-nClaw, AI Assistant
- Feature-nChat, Messaging
- Feature-nFamily, Family Social
- Feature-nCloud, Managed Hosting
- Feature-Memory-Rooms, Knowledge Organization
- Feature-Agent-Dashboard, Agent Metrics
- Feature-Image-Generation, AI Image Generation
Configuration
- Configuration, Overview
- Config-Env-Vars
- Config-Postgres
- Config-Hasura
- Config-Auth
- Config-Nginx
- Shared-Proxy
- Config-Optional-Services
- Config-Custom-Services
- Config-System
Plugins (87 + 10 monitoring)
- Plugin-Overview
- Plugin-Catalog
- Plugin-Install
- Plugin-Licensing
- Plugin-Architecture
- Plugin-Dev-Guide
- Plugin-Migrations-Contract
Free (25)
- plugin-backup
- plugin-content-acquisition
- plugin-content-progress
- plugin-cron
- plugin-donorbox
- plugin-feature-flags
- plugin-github
- plugin-github-runner
- plugin-invitations
- plugin-jobs
- plugin-link-preview
- plugin-mdns
- plugin-mlflow
- plugin-monitoring
- plugin-notifications
- plugin-notify
- plugin-paypal
- plugin-search
- plugin-shopify
- plugin-stripe
- plugin-subtitle-manager
- plugin-tokens
- plugin-torrent-manager
- plugin-vpn
- plugin-webhooks
Pro (62)
- plugin-access-controls
- plugin-activity-feed
- plugin-admin-api
- plugin-analytics
- plugin-auth
- plugin-bots
- plugin-browser
- plugin-calendar
- plugin-cdn
- plugin-chat
- plugin-claw
- plugin-claw-budget
- plugin-claw-news
- plugin-claw-web
- plugin-cloudflare
- plugin-cms
- plugin-compliance
- plugin-ddns
- plugin-devices
- plugin-documents
- plugin-entitlements
- plugin-file-processing
- plugin-game-metadata
- plugin-geocoding
- plugin-geolocation
- plugin-google
- plugin-home
- plugin-idme
- plugin-knowledge-base
- plugin-linkedin
- plugin-livekit
- plugin-media-processing
- plugin-meetings
- plugin-moderation
- plugin-mux
- plugin-object-storage
- plugin-observability
- plugin-photos
- plugin-podcast
- plugin-post
- plugin-realtime
- plugin-retro-gaming
- plugin-rom-discovery
- plugin-social
- plugin-sports
- plugin-support
- plugin-tmdb
- plugin-voice
- plugin-web3
- plugin-workflows
Planned (26)
plugin-auditplugin-blogplugin-checkoutplugin-commerceplugin-drmplugin-exportplugin-flowplugin-importplugin-ldapplugin-mailgunplugin-mediaplugin-oauth-providersplugin-pagesplugin-postmarkplugin-rate-limitplugin-reportsplugin-samlplugin-schedulerplugin-sendgridplugin-ssoplugin-subscriptionplugin-thumbplugin-transcoderplugin-twilioplugin-wafplugin-watermark
Guides
- Guide-Production-Deployment
- Guide-SSL-Setup
- Guide-Multi-Tenancy
- Guide-Security-Hardening
- Guide-Monitoring-Setup
- Guide-Backup-Restore
- Guide-Custom-Services
- Guide-Migration-from-v1
Architecture
- Architecture
- Architecture-Guardrails
- Service-Graph
- Compose-Generation
- Nginx-Generation
- Plugin-Architecture
Reference
Machine interface
-
JSON-Output,
--jsonenvelope -
Command-Registry,
nself help --json - Exit-Codes
- error-codes, Error Codes
-
Compat-V15,
NSELF_V15gate
Licensing
Security
Brand
Operations
- operations/release-cascade, Release Cascade
- operations/self-healing, Self-Healing Schema
- operations/redis-tuning, Redis Pool Tuning
- operations/meilisearch-warmup, MeiliSearch Warm-Up
- operations/jwt-rotation, JWT Key Rotation
- operations/windows-wsl2-setup, Windows / WSL2 Setup
- operations/gemini-oauth-reauth, Gemini OAuth Reauth
Contributing
Admin
- USER-ACTION-QUEUE, Pending Admin Actions
All commands (21)
- A: cmd-add · cmd-admin
- B: cmd-backup · cmd-build
- C: cmd-clean · cmd-config
- D: cmd-db · cmd-deploy · cmd-doctor
- E: cmd-exec
- I: cmd-init
- L: cmd-license · cmd-logs
- M: cmd-mcp
- R: cmd-remove · cmd-reset · cmd-restart
- S: cmd-start · cmd-status · cmd-stop
- U: cmd-update