opg-dev-cli
v0.2.8
Published
OPG CLI and Codex MCP server for AI app backend development.
Readme
opg-dev-cli
CLI and Codex MCP bridge for OPG backend services.
npm install -g opg-dev-cli
opg init --base-url https://api.example.com --app my-app
opg login
opg smoke
opg db smoke
opg db manifest
opg db query --sql "SELECT * FROM app_my_app__customers"
opg codex installEnvironment
The CLI reads .opg/credentials.json, .env.local, and .opg/opg.config.json.
OPG_BASE_URL: Gateway base URLOPG_APP_SLUG: App slug owned by the current tenantOPG_API_KEY: Optional explicit Developer Grant (opg_dev_...) for CI or non-interactive runsOPG_PLATFORM_TOKEN: Platform admin JWT for global control-plane tools
opg login opens a browser authorization URL, creates a platform Developer Grant with app and scope limits, and stores the local SDK credential in .opg/credentials.json. opg codex install writes a Codex MCP config template without embedding secret values.
Platform Control Plane
App SDK operations stay app-scoped. Global operations use the platform token:
opg platform apps list
opg platform apps create --json '{"name":"Demo App","slug":"demo"}'
opg platform runtime get
opg platform runtime update --json '{"api_base_url":"https://opg.example.com"}'
opg platform feedbacks list --app-id <app-id> --status open
opg platform feedbacks get --app-id <app-id> --feedback-id <feedback-id>
opg platform analytics users --app-id <app-id> --days 30
opg platform ai-usage logs --app-id <app-id> --days 7
opg platform payments orders --app-id <app-id> --page 1
opg platform request --path /storage/providers --method GETThe MCP server also exposes platform tools for app creation, runtime settings,
storage providers, AI sources/models, app feedback, app analytics, app AI usage,
app payment orders, and a generic opg_platform_request escape hatch for other
/api/v1/platform-admin/* endpoints.
Common app-data MCP tools:
opg_platform_app_feedbacks_listopg_platform_app_feedback_getopg_platform_app_feedback_updateopg_platform_app_feedback_commentopg_platform_app_feedback_reviewopg_platform_app_analytics_overviewopg_platform_app_analytics_usersopg_platform_app_ai_usage_logsopg_platform_app_payment_orders
Codex Database Tools
The MCP server exposes app-scoped database tools:
opg_database_manifest_getopg_database_tables_listopg_database_table_describeopg_database_queryopg_database_execute
Database SQL is limited to app-owned tables such as app_my_app__customers.
opg_database_execute defaults to dry-run. Applying changes requires
confirm=apply:<app-slug>.
The same database operations are also available from the terminal:
opg db manifest
opg db smoke
opg db tables
opg db describe app_my_app__customers
opg db query --sql "SELECT * FROM app_my_app__customers"
opg db execute --sql "CREATE TABLE app_my_app__customers (id uuid PRIMARY KEY DEFAULT gen_random_uuid())" --dry-run true