← RETURN TO ROOT
Connected
Unsendbox Opencode setup
Turn this repo into an Opencode project with ChatGPT/Codex auth, MCP registrations, and local hooks.
Open Opencode guideWhat gets added
Place these files under the repo root to standardize local AI operations.
1) Add `opencode.json`
Use this baseline and keep secrets in environment variables.
- 01Copy the generated example into repo root as `opencode.json`.
- 02Set provider keys (`OPENAI_API_KEY`) and optional `UNSENDBOX_MCP_TOKEN` in environment.
- 03Set `UNSENDBOX_MCP_URL` to your target environment (`http://localhost:4100/api/v1/mcp` for dev).
- 04Set `UNSENDBOX_MCP_MODE` to your preferred default (`primary` for local-first flow).
- 05Enable the unsendbox MCP block and keep external MCP blocks disabled until needed.
2) MCP and org/API scope
Scope notes for production-safe usage.
3) Install local guard plugin
Enable repo-level safety checks for Opencode commands.
- 01Keep local plugin file at `.opencode/plugins/unsendbox-guard.ts` from this template.
- 02Run initial session and verify pre-tool hooks are loaded before making file writes.
- 03Confirm destructive shell commands are blocked by default.
- 04Confirm one run of `list_threads` works, then `send_email` in a staging domain.
4) Skill-like agent model
Map repeated tasks to agent names and prompt framing.
5) Verify configuration integrity
Run this checklist before handing the repo to the team.
- 01Start a fresh Opencode session from this repo.
- 02Run `/help` and verify `unsendbox` MCP tools are listed.
- 03Confirm `connect_domain`, `create_address`, `send_email`, and `get_domain_health` are callable.
- 04Check that `/docs/user-guide/connect-ai-tool` and `/docs/configuration/workspace-and-api-access` match runtime behavior.
- 05Document all env-var expectations in team onboarding notes.
Example config file
Keep this file as a reference and adjust IDs/URLs for your environment.
Helpful deep links
Use these pages to resolve setup and safety details.
Rollback plan
If your Opencode session becomes unstable, revert safely.
- 01Rename `opencode.json` temporarily and restart Opencode.
- 02Disable local plugin loading and clear session cache if needed.
- 03Keep using dashboard operations while restoring MCP endpoint and auth tokens.
- 04Document any command policy changes before turning plugin hooks back on.
- 05Re-enable hooks only after two successful smoke tests.