The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
feat(mcp): register Beacon Cloud MCP in Oh My Pi
Kyle Elliott9b774a3baab9
diff --git a/cli/beacon/cmd/mcp_connect.go b/cli/beacon/cmd/mcp_connect.goindex fd6911ff..5753dd31 100644--- a/cli/beacon/cmd/mcp_connect.go+++ b/cli/beacon/cmd/mcp_connect.go@@ -59,7 +59,7 @@ var mcpConnectCmd = &cobra.Command{Use: "connect",Short: "Register Beacon Cloud MCP in the harnesses on this machine",Long: `Register the Beacon Cloud MCP server, as "beacon-managed", in every detected harness that-supports it: Claude Code, Codex CLI, Cursor, VS Code, Gemini CLI and OpenCode.+supports it: Claude Code, Codex CLI, Cursor, VS Code, Gemini CLI, OpenCode and Oh My Pi.By default only the URL is written, and each harness signs in with OAuth the first time itconnects. With --token-env, each config references an environment variable holding a personaldiff --git a/cli/beacon/cmd/mcp_connect_e2e_test.go b/cli/beacon/cmd/mcp_connect_e2e_test.goindex 1164421a..e76e1976 100644--- a/cli/beacon/cmd/mcp_connect_e2e_test.go+++ b/cli/beacon/cmd/mcp_connect_e2e_test.go@@ -163,6 +163,38 @@ func TestMCPConnectEndToEndOpenCode(t *testing.T) {}}+// Oh My Pi lists its MCP servers with `/mcp list`, a slash command inside a session, and has no CLI+// subcommand a test can run instead. `omp read mcp://…` loads the configured MCP servers the way a+// session does -- discovery, ${VAR} expansion, stored credentials -- and connects to each before it+// looks the resource up, so a request reaching the fixture proves the entry was loaded at the+// connected URL. The read itself fails: no server has that resource.+func TestMCPConnectEndToEndOhMyPi(t *testing.T) {+ bin := realCLI(t, "omp")+ fx := realCLIFixture(t, "omp")+ probe := func() []string {+ before := len(fx.auth.all())+ _, _ = runCLI(t, fx.home, bin, "read", "mcp://beacon-e2e/probe")+ return fx.auth.all()[before:]+ }++ connectReal(t, fx, "omp")+ if got := probe(); len(got) == 0 || got[0] != "" {+ t.Fatalf("Oh My Pi did not connect to %s without credentials; saw %q", fx.url, got)+ }+ if _, _, err := runMCP(t, "disconnect", "--harness", "omp"); err != nil {+ t.Fatal(err)+ }+ if got := probe(); len(got) != 0 {+ t.Fatalf("Oh My Pi still connected after disconnect; saw %q", got)+ }++ t.Setenv("BEACON_MCP_TOKEN", e2eToken)+ connectReal(t, fx, "omp", "--token-env", "BEACON_MCP_TOKEN")+ if got := probe(); !containsString(got, "Bearer "+e2eToken) {+ t.Fatalf("Oh My Pi did not send the token from BEACON_MCP_TOKEN; saw %q", got)+ }+}+// Copilot CLI is a manual target: connect prints the command. Running that command, with a// placeholder token, must produce a server Copilot lists at the URL.func TestMCPConnectEndToEndCopilotManualStep(t *testing.T) {diff --git a/cli/beacon/cmd/mcp_connect_test.go b/cli/beacon/cmd/mcp_connect_test.goindex 5a73876f..342af264 100644--- a/cli/beacon/cmd/mcp_connect_test.go+++ b/cli/beacon/cmd/mcp_connect_test.go@@ -75,7 +75,7 @@ func newMCPFixture(t *testing.T, detected ...string) *mcpFixture {t.Helper()fx := &mcpFixture{home: t.TempDir(), requests: &requestLog{}, strays: &requestLog{}, auth: &requestLog{}}testenv.SetHome(t, fx.home)- for _, key := range []string{"XDG_CONFIG_HOME", "CLAUDE_CONFIG_DIR", "CODEX_HOME", "CI", "CONTINUOUS_INTEGRATION", "GITHUB_ACTIONS", "GITLAB_CI", "BUILDKITE", "JENKINS_URL", "TEAMCITY_VERSION"} {+ for _, key := range []string{"XDG_CONFIG_HOME", "CLAUDE_CONFIG_DIR", "CODEX_HOME", "PI_CODING_AGENT_DIR", "PI_CONFIG_DIR", "OMP_PROFILE", "PI_PROFILE", "CI", "CONTINUOUS_INTEGRATION", "GITHUB_ACTIONS", "GITLAB_CI", "BUILDKITE", "JENKINS_URL", "TEAMCITY_VERSION"} {t.Setenv(key, "")os.Unsetenv(key)}@@ -191,7 +191,7 @@ func filesUnder(t *testing.T, dir string) map[string]string {return out}-var allAutomatic = []string{"claude_code", "codex_cli", "cursor", "vscode", "gemini_cli", "opencode"}+var allAutomatic = []string{"claude_code", "codex_cli", "cursor", "vscode", "gemini_cli", "opencode", "omp"}func TestMCPConnectSubcommandsAreRegistered(t *testing.T) {for _, sub := range []string{"connect", "disconnect", "status"} {@@ -280,8 +280,8 @@ func TestMCPConnectWritesEveryDetectedHarnessThenDisconnectRestores(t *testing.T}for _, want := range []string{"(checked)", "Server name: beacon-managed", "Auth: OAuth",- "✓ Claude Code", "✓ Codex CLI", "✓ Cursor", "✓ VS Code", "✓ Gemini CLI", "✓ OpenCode",- "codex mcp login beacon-managed", "opencode mcp auth beacon-managed", "run /mcp",+ "✓ Claude Code", "✓ Codex CLI", "✓ Cursor", "✓ VS Code", "✓ Gemini CLI", "✓ OpenCode", "✓ Oh My Pi",+ "codex mcp login beacon-managed", "opencode mcp auth beacon-managed", "run /mcp", "/mcp reauth beacon-managed","Add by hand", "copilot mcp add --transport http beacon-managed " + fx.url,"Not connected (Beacon does not know how these configure MCP servers): pi_cli",} {diff --git a/cli/beacon/cmd/omp_target_test.go b/cli/beacon/cmd/omp_target_test.goindex 9a96f734..1de83305 100644--- a/cli/beacon/cmd/omp_target_test.go+++ b/cli/beacon/cmd/omp_target_test.go@@ -67,8 +67,9 @@ func TestOmpEndpointTargetIsHookShaped(t *testing.T) {func TestInstallEndpointHookTargetHandlesOmp(t *testing.T) {home := t.TempDir()testenv.SetHome(t, home)- t.Setenv("PI_CODING_AGENT_DIR", "")- t.Setenv("PI_CONFIG_DIR", "")+ for _, name := range []string{"PI_CODING_AGENT_DIR", "PI_CONFIG_DIR", "OMP_PROFILE", "PI_PROFILE"} {+ t.Setenv(name, "")+ }previousLevel := endpointOpts.hookLevelendpointOpts.hookLevel = string(endpointhooks.LevelUser)diff --git a/cli/beacon/internal/endpoint/harness/omp_test.go b/cli/beacon/internal/endpoint/harness/omp_test.goindex 2ac446ad..8327ca3d 100644--- a/cli/beacon/internal/endpoint/harness/omp_test.go+++ b/cli/beacon/internal/endpoint/harness/omp_test.go@@ -23,7 +23,7 @@ func writeOmpExtension(t *testing.T, home, contents string) string {return path}-// Every Oh My Pi discovery test empties PATH and the two environment variables that move its+// Every Oh My Pi discovery test empties PATH and the environment variables that move its// extension directory. Without that, the result depends on whether the machine running the suite// happens to have `omp` installed or a profile active -- exactly the kind of environment-dependent// assertion the repo's deterministic-test rule exists to prevent.@@ -32,8 +32,9 @@ func setupOmpDiscovery(t *testing.T) string {home := t.TempDir()testenv.SetHome(t, home)t.Setenv("PATH", t.TempDir())- t.Setenv("PI_CODING_AGENT_DIR", "")- t.Setenv("PI_CONFIG_DIR", "")+ for _, name := range []string{"PI_CODING_AGENT_DIR", "PI_CONFIG_DIR", "OMP_PROFILE", "PI_PROFILE"} {+ t.Setenv(name, "")+ }return home}diff --git a/cli/beacon/internal/endpoint/hooks/omo_test.go b/cli/beacon/internal/endpoint/hooks/omo_test.goindex ee0fcd50..ea77730a 100644--- a/cli/beacon/internal/endpoint/hooks/omo_test.go+++ b/cli/beacon/internal/endpoint/hooks/omo_test.go@@ -206,8 +206,7 @@ func TestOmoPiAndPrimeInstallToDifferentDirectories(t *testing.T) {t.Setenv(name, "")}t.Setenv(primeAgentDirEnv, "")- t.Setenv(ompAgentDirEnv, "")- t.Setenv(ompConfigDirEnv, "")+ clearOmpEnv(t)for _, level := range []Level{LevelUser, LevelProject} {omo, err := OmoExtensionPath(level)diff --git a/cli/beacon/internal/endpoint/hooks/omp.go b/cli/beacon/internal/endpoint/hooks/omp.goindex 3cd1c542..5f69b0cf 100644--- a/cli/beacon/internal/endpoint/hooks/omp.go+++ b/cli/beacon/internal/endpoint/hooks/omp.go@@ -4,6 +4,8 @@ import ("fmt""os""path/filepath"+ "regexp"+ "strings"ompextension "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/hooks/assets/omp")@@ -35,16 +37,85 @@ const (// ompConfigDirName is the config directory Oh My Pi keeps under the home directory.ompConfigDirName = ".omp"- // ompAgentDirEnv overrides the agent directory outright. Oh My Pi reads it itself, and sets it- // on its own process when a named profile is active, so an install performed from inside a- // profiled session lands in that profile's extension directory rather than the default one.+ // ompAgentDirEnv overrides the agent directory of the default profile. A named profile ignores+ // it, though Oh My Pi exports it (with the profile variables) on its own process when one is+ // active, so a child of a profiled session sees the two agree.ompAgentDirEnv = "PI_CODING_AGENT_DIR"// ompConfigDirEnv renames the config directory under the home directory. Oh My Pi applies it// only to that home-directory root, never to the project directory -- see ompExtensionDir.ompConfigDirEnv = "PI_CONFIG_DIR"++ // ompProfileEnv names the active profile. ompLegacyProfileEnv is read only when ompProfileEnv+ // is unset, so an explicitly empty OMP_PROFILE selects the default profile.+ ompProfileEnv = "OMP_PROFILE"+ ompLegacyProfileEnv = "PI_PROFILE"+)++// The profile names Oh My Pi accepts (normalizeProfileName in its utils/dirs.ts). It refuses to+// start with any other name, so Beacon refuses to resolve one rather than write where nothing+// reads.+var (+ ompProfileNamePattern = regexp.MustCompile(`^[a-z0-9][a-z0-9._-]{0,63}$`)+ ompReservedProfileName = regexp.MustCompile(`(?i)^(?:CON|PRN|AUX|NUL|COM[0-9]|LPT[0-9])(?:\..*)?$`))+// ompProfileName normalizes a profile name as Oh My Pi does: blank and "default" are the default+// profile, returned as "".+func ompProfileName(raw string) (string, error) {+ name := strings.TrimSpace(raw)+ if name == "" || name == "default" {+ return "", nil+ }+ if name == "." || name == ".." || strings.HasSuffix(name, ".") ||+ !ompProfileNamePattern.MatchString(name) || ompReservedProfileName.MatchString(name) {+ return "", fmt.Errorf("Oh My Pi profile %q is not a valid profile name", raw)+ }+ return name, nil+}++// OmpAgentDirForHome resolves Oh My Pi's user agent directory for the active profile: the+// directory that holds its user mcp.json and its extensions directory.+//+// It follows the runtime's own order (getAgentDir in its utils/dirs.ts). The active profile is+// OMP_PROFILE, or PI_PROFILE when OMP_PROFILE is unset; a named profile lives at+// `~/<config>/profiles/<name>/agent` and ignores PI_CODING_AGENT_DIR. The default profile honors+// PI_CODING_AGENT_DIR, except a value that is PI_PROFILE's own profile directory -- what a child+// of a profiled session that switched back to the default inherits -- and otherwise lives at+// `~/<config>/agent`. `<config>` is PI_CONFIG_DIR, or `.omp`.+func OmpAgentDirForHome(home string) (string, error) {+ configDir := ompConfigDirName+ if named := os.Getenv(ompConfigDirEnv); named != "" {+ configDir = named+ }+ profileDir := func(name string) string {+ return filepath.Join(home, configDir, "profiles", name, "agent")+ }+ rawProfile, set := os.LookupEnv(ompProfileEnv)+ if !set {+ rawProfile = os.Getenv(ompLegacyProfileEnv)+ }+ profile, err := ompProfileName(rawProfile)+ if err != nil {+ return "", err+ }+ if profile == "" {+ if agentDir := os.Getenv(ompAgentDirEnv); agentDir != "" {+ legacy, err := ompProfileName(os.Getenv(ompLegacyProfileEnv))+ if err != nil || legacy == "" || home == "" || agentDir != profileDir(legacy) {+ return filepath.Abs(agentDir)+ }+ }+ }+ if home == "" {+ return "", fmt.Errorf("home directory is required to resolve the Oh My Pi agent directory")+ }+ if profile != "" {+ return profileDir(profile), nil+ }+ return filepath.Join(home, configDir, "agent"), nil+}+type OmpOptions struct {Level LevelLogPath string@@ -147,30 +218,21 @@ func OmpExtensionPathForHome(home string, level Level) (string, error) {// ompExtensionDir resolves the directory Oh My Pi actually scans for extension modules.//// The two levels resolve asymmetrically, and the asymmetry is Oh My Pi's rather than a-// simplification here. Its user root is the *agent* directory -- `~/.omp/agent` -- which-// `PI_CODING_AGENT_DIR` replaces outright and `PI_CONFIG_DIR` renames the `.omp` half of; a named-// profile moves it to `~/.omp/profiles/<name>/agent`, which the runtime signals by setting-// `PI_CODING_AGENT_DIR` on its own process, so a profiled install is reached through that variable-// rather than by Beacon guessing a profile name. Its project root is the plain `.omp` directory in-// the working directory, with no `agent` segment and no environment override at all: the runtime-// joins the literal there.+// simplification here. Its user root is the active profile's *agent* directory, which+// OmpAgentDirForHome resolves. Its project root is the plain `.omp` directory in the working+// directory, with no `agent` segment and no environment override at all: the runtime joins the+// literal there.//// Deriving either path from the other, or applying `PI_CONFIG_DIR` to both, would write the file// where Oh My Pi does not look -- and the install would report success and collect nothing.func ompExtensionDir(home string, level Level) (string, error) {switch level {case "", LevelUser:- if agentDir := os.Getenv(ompAgentDirEnv); agentDir != "" {- return filepath.Join(agentDir, "extensions"), nil- }- if home == "" {- return "", fmt.Errorf("home directory is required to resolve the Oh My Pi extension path")- }- configDir := ompConfigDirName- if named := os.Getenv(ompConfigDirEnv); named != "" {- configDir = named+ agentDir, err := OmpAgentDirForHome(home)+ if err != nil {+ return "", err}- return filepath.Join(home, configDir, "agent", "extensions"), nil+ return filepath.Join(agentDir, "extensions"), nilcase LevelProject:cwd, err := os.Getwd()if err != nil {diff --git a/cli/beacon/internal/endpoint/hooks/omp_test.go b/cli/beacon/internal/endpoint/hooks/omp_test.goindex b8e9ca70..dca2408a 100644--- a/cli/beacon/internal/endpoint/hooks/omp_test.go+++ b/cli/beacon/internal/endpoint/hooks/omp_test.go@@ -11,14 +11,23 @@ import ("github.com/asymptote-labs/agent-beacon/cli/beacon/internal/testenv")+// clearOmpEnv empties every variable that moves Oh My Pi's user agent directory, so a suite run+// from inside a profiled Oh My Pi session resolves the same paths as one run anywhere else. An+// explicitly empty OMP_PROFILE selects the default profile even when PI_PROFILE is set.+func clearOmpEnv(t *testing.T) {+ t.Helper()+ for _, name := range []string{ompAgentDirEnv, ompConfigDirEnv, ompProfileEnv, ompLegacyProfileEnv} {+ t.Setenv(name, "")+ }+}+// An empty level means "the default", and the default has to be the user level. Every caller that// does not care about scope passes the zero value, so treating "" as unknown would turn status,// repair and uninstall into errors for the ordinary install.func TestOmpExtensionPathDefaultsToUserLevel(t *testing.T) {home := t.TempDir()testenv.SetHome(t, home)- t.Setenv(ompAgentDirEnv, "")- t.Setenv(ompConfigDirEnv, "")+ clearOmpEnv(t)want := filepath.Join(home, ".omp", "agent", "extensions", "beacon.ts")for _, level := range []Level{"", LevelUser} {@@ -50,15 +59,15 @@ func TestOmpExtensionPathProjectLevelOmitsAgentSegment(t *testing.T) {}}-// PI_CODING_AGENT_DIR replaces the agent directory outright. Oh My Pi reads it itself, and sets it-// on its own process when a named profile is active -- so honoring it is how a profiled install-// lands in `~/.omp/profiles/<name>/agent/extensions` without Beacon having to guess a profile name.+// PI_CODING_AGENT_DIR replaces the default profile's agent directory outright. Oh My Pi reads it+// itself, and exports it on its own process when a named profile is active, so a child of a+// profiled session that sees only this variable still lands in that profile's directory.func TestOmpExtensionPathHonorsTheAgentDirOverride(t *testing.T) {home := t.TempDir()testenv.SetHome(t, home)+ clearOmpEnv(t)agentDir := filepath.Join(home, ".omp", "profiles", "work", "agent")t.Setenv(ompAgentDirEnv, agentDir)- t.Setenv(ompConfigDirEnv, "")got, err := OmpExtensionPath(LevelUser)if err != nil {@@ -80,7 +89,7 @@ func TestOmpExtensionPathAppliesTheConfigDirOverrideToTheUserPathOnly(t *testingcwd := t.TempDir()testenv.SetHome(t, home)t.Chdir(cwd)- t.Setenv(ompAgentDirEnv, "")+ clearOmpEnv(t)t.Setenv(ompConfigDirEnv, ".omp-alt")user, err := OmpExtensionPath(LevelUser)@@ -107,6 +116,7 @@ func TestOmpAgentDirOverrideBeatsTheConfigDirRename(t *testing.T) {home := t.TempDir()testenv.SetHome(t, home)agentDir := filepath.Join(home, "elsewhere", "agent")+ clearOmpEnv(t)t.Setenv(ompAgentDirEnv, agentDir)t.Setenv(ompConfigDirEnv, ".omp-alt")@@ -119,6 +129,71 @@ func TestOmpAgentDirOverrideBeatsTheConfigDirRename(t *testing.T) {}}+// The user agent directory follows the profile Oh My Pi itself would run under: OMP_PROFILE, else+// PI_PROFILE, with a named profile ignoring PI_CODING_AGENT_DIR. Resolving anything else writes+// the extension, and Beacon Cloud MCP's mcp.json, into a profile the runtime is not using.+func TestOmpAgentDirFollowsTheActiveProfile(t *testing.T) {+ const unset = "\x00unset"+ for _, tc := range []struct {+ name string+ ompProfile, piProfile, agentDir string+ configDir string+ want []string // path under home+ }{+ {name: "OMP_PROFILE", ompProfile: "work", piProfile: unset, want: []string{".omp", "profiles", "work", "agent"}},+ {name: "PI_PROFILE when OMP_PROFILE is unset", ompProfile: unset, piProfile: "work", want: []string{".omp", "profiles", "work", "agent"}},+ {name: "OMP_PROFILE beats PI_PROFILE", ompProfile: "work", piProfile: "home", want: []string{".omp", "profiles", "work", "agent"}},+ {name: "an empty OMP_PROFILE selects the default over PI_PROFILE", ompProfile: "", piProfile: "work", want: []string{".omp", "agent"}},+ {name: "default is the default profile", ompProfile: " default ", piProfile: unset, want: []string{".omp", "agent"}},+ {name: "a named profile ignores the agent-dir override", ompProfile: "work", piProfile: unset, agentDir: "elsewhere", want: []string{".omp", "profiles", "work", "agent"}},+ {name: "a named profile keeps the config-dir rename", ompProfile: "work", piProfile: unset, configDir: ".omp-alt", want: []string{".omp-alt", "profiles", "work", "agent"}},+ // What a child of a `work` session inherits after it sets OMP_PROFILE= to go back to the+ // default: the runtime treats the inherited override as the profile's, not the user's.+ {name: "the default ignores an override that is PI_PROFILE's directory", ompProfile: "", piProfile: "work", agentDir: filepath.Join(".omp", "profiles", "work", "agent"), want: []string{".omp", "agent"}},+ } {+ t.Run(tc.name, func(t *testing.T) {+ home := t.TempDir()+ testenv.SetHome(t, home)+ clearOmpEnv(t)+ for name, value := range map[string]string{ompProfileEnv: tc.ompProfile, ompLegacyProfileEnv: tc.piProfile} {+ if value == unset {+ os.Unsetenv(name)+ } else {+ t.Setenv(name, value)+ }+ }+ if tc.agentDir != "" {+ t.Setenv(ompAgentDirEnv, filepath.Join(home, tc.agentDir))+ }+ t.Setenv(ompConfigDirEnv, tc.configDir)++ got, err := OmpAgentDirForHome(home)+ if err != nil {+ t.Fatal(err)+ }+ if want := filepath.Join(append([]string{home}, tc.want...)...); got != want {+ t.Fatalf("OmpAgentDirForHome = %q, want %q", got, want)+ }+ })+ }+}++// Oh My Pi refuses to start with a profile name it does not accept, so there is no directory to+// write to -- and a name like `../x` would otherwise escape the profiles directory.+func TestOmpAgentDirRejectsAProfileNameOhMyPiRejects(t *testing.T) {+ for _, name := range []string{"../escape", "Work", "a.", "con", "lpt1.txt", "-dash"} {+ t.Run(name, func(t *testing.T) {+ home := t.TempDir()+ testenv.SetHome(t, home)+ clearOmpEnv(t)+ t.Setenv(ompProfileEnv, name)+ if got, err := OmpAgentDirForHome(home); err == nil {+ t.Fatalf("OmpAgentDirForHome accepted profile %q and resolved %q", name, got)+ }+ })+ }+}+func TestOmpExtensionPathRejectsUnknownLevel(t *testing.T) {if _, err := OmpExtensionPath(Level("machine")); err == nil {t.Fatal("OmpExtensionPath accepted an unknown level; a typo in a scope flag must fail loudly " +@@ -134,8 +209,7 @@ func TestOmpAndPiInstallToDifferentDirectories(t *testing.T) {cwd := t.TempDir()testenv.SetHome(t, home)t.Chdir(cwd)- t.Setenv(ompAgentDirEnv, "")- t.Setenv(ompConfigDirEnv, "")+ clearOmpEnv(t)for _, level := range []Level{LevelUser, LevelProject} {omp, err := OmpExtensionPath(level)diff --git a/cli/beacon/internal/endpoint/hooks/prime_test.go b/cli/beacon/internal/endpoint/hooks/prime_test.goindex 462aa877..496df63d 100644--- a/cli/beacon/internal/endpoint/hooks/prime_test.go+++ b/cli/beacon/internal/endpoint/hooks/prime_test.go@@ -145,8 +145,7 @@ func TestPrimePiAndOmpInstallToDifferentDirectories(t *testing.T) {testenv.SetHome(t, home)t.Chdir(cwd)t.Setenv(primeAgentDirEnv, "")- t.Setenv(ompAgentDirEnv, "")- t.Setenv(ompConfigDirEnv, "")+ clearOmpEnv(t)for _, level := range []Level{LevelUser, LevelProject} {prime, err := PrimeExtensionPath(level)diff --git a/cli/beacon/internal/endpoint/inventory/inventory_test.go b/cli/beacon/internal/endpoint/inventory/inventory_test.goindex 3224e55f..718e3d05 100644--- a/cli/beacon/internal/endpoint/inventory/inventory_test.go+++ b/cli/beacon/internal/endpoint/inventory/inventory_test.go@@ -350,10 +350,11 @@ func TestScanIncludesAllSupportedCurrentUserAndProjectConfigs(t *testing.T) {work := t.TempDir()t.Setenv("SHELL", "/bin/bash")// Oh My Pi's user extension path is the one candidate an environment variable can move, so the- // two it reads are cleared: a developer who happens to run Oh My Pi under a profile would+ // variables it reads are cleared: a developer who happens to run Oh My Pi under a profile would// otherwise see this test fail on a path that is correct for their machine.- t.Setenv("PI_CODING_AGENT_DIR", "")- t.Setenv("PI_CONFIG_DIR", "")+ for _, name := range []string{"PI_CODING_AGENT_DIR", "PI_CONFIG_DIR", "OMP_PROFILE", "PI_PROFILE"} {+ t.Setenv(name, "")+ }// Senpi reads the same PI_CODING_AGENT_DIR as its last fallback, plus two of its own; all three// are cleared for the same reason.t.Setenv("OMO_CODING_AGENT_DIR", "")diff --git a/cli/beacon/internal/mcpconnect/engine.go b/cli/beacon/internal/mcpconnect/engine.goindex 92774a14..c18d8018 100644--- a/cli/beacon/internal/mcpconnect/engine.go+++ b/cli/beacon/internal/mcpconnect/engine.go@@ -131,6 +131,9 @@ func inspect(t Target, path string) (state, error) {}st.entry, st.exists = tomlTableEntry(parsed, t.container[0], ServerName)default:+ if t.strictJSON && strings.TrimSpace(cf.text) != "" && !json.Valid([]byte(cf.text)) {+ return st, fmt.Errorf("%s is not plain JSON; %s ignores a config with comments or trailing commas, so Beacon leaves it alone", path, t.DisplayName)+ }parsed, err := decodeJSONC(cf.text)if err != nil {return st, fmt.Errorf("%s is not valid JSON (%v)", path, err)@@ -214,6 +217,25 @@ func sameURL(a, b string) bool {return strings.TrimRight(strings.TrimSpace(a), "/") == strings.TrimRight(strings.TrimSpace(b), "/")}+// desiredEntry is the entry connect puts in place: Beacon's, keeping the person's own `enabled`+// value from the existing entry where the harness switches a server off that way. Turning+// beacon-managed off in the harness is the person's decision, and re-running connect must not undo+// it.+func (t Target) desiredEntry(opts Options, existing map[string]any) ordered {+ entry := t.entry(opts.URL, opts.TokenEnv)+ enabled, ok := existing["enabled"].(bool)+ if !t.switchable || !ok {+ return entry+ }+ for i := range entry {+ if entry[i].Key == "enabled" {+ entry[i].Value = enabled+ return entry+ }+ }+ return append(entry, field{"enabled", enabled})+}+// Plan works out what connect would do for each target without writing anything.func Plan(opts Options, targets []Target) ([]Item, error) {m, err := loadManifest(opts.Home)@@ -253,7 +275,7 @@ func planOne(opts Options, m *manifest, t Target) Item {it.ExistingURL = st.urlrec, recorded := m.find(t.Name, path)ours := recorded && st.exists && sameURL(st.url, rec.URL)- want := normalizeJSON(t.entry(opts.URL, opts.TokenEnv))+ want := normalizeJSON(t.desiredEntry(opts, st.entry))same := st.exists && reflect.DeepEqual(normalizeJSON(st.entry), want)if opts.TokenEnv != "" && t.vscodeInputs && !st.inputOK && !(recorded && rec.Auth == AuthTokenEnv) {if opts.Force {@@ -373,7 +395,7 @@ func applyOne(ctx context.Context, opts Options, m *manifest, it Item) (Record,// editForConnect returns the config text with Beacon's entry in place.func editForConnect(t Target, text string, st state, opts Options) (updated string, created int, createdInputs bool, err error) {- entry := t.entry(opts.URL, opts.TokenEnv)+ entry := t.desiredEntry(opts, st.entry)if t.format == formatTOML {eol := tomlLineEnding(text)stripped := text@@ -427,16 +449,20 @@ func isBeaconInput(v any) bool {// entry set: every other key, at every depth, deeply equal. It is the safety net under the text// splicing, the same check the Kimi Code installer runs before it replaces config.toml.func verifyConnect(t Target, before, after string, opts Options) error {+ if t.strictJSON && !json.Valid([]byte(after)) {+ return errors.New("Beacon's edit would not be plain JSON, which " + t.DisplayName + " requires")+ }b, a, err := parseBoth(t, before, after)if err != nil {return err}+ existing, _ := dig(b, t.container)[ServerName].(map[string]any)if strings.TrimSpace(before) == "" && len(t.skeleton) > 0 {for _, f := range t.skeleton {b[f.Key] = normalizeJSON(f.Value)}}- setPath(b, t.container, ServerName, normalizeJSON(t.entry(opts.URL, opts.TokenEnv)))+ setPath(b, t.container, ServerName, normalizeJSON(t.desiredEntry(opts, existing)))if t.vscodeInputs {dropBeaconInputs(b)if opts.TokenEnv != "" {diff --git a/cli/beacon/internal/mcpconnect/harness_test.go b/cli/beacon/internal/mcpconnect/harness_test.goindex 81d10d85..f8c1b001 100644--- a/cli/beacon/internal/mcpconnect/harness_test.go+++ b/cli/beacon/internal/mcpconnect/harness_test.go@@ -359,6 +359,70 @@ bearer_token_env_var = "BEACON_MCP_TOKEN"`,conflict: `{"mcp": {"beacon-managed": {"type": "remote", "url": "https://elsewhere.example"}}}`,},+ {+ // As Oh My Pi itself saves the file: $schema first, two-space indent, no final newline.+ name: "omp",+ existing: `{+ "$schema": "https://raw.githubusercontent.com/can1357/oh-my-pi/main/packages/coding-agent/src/config/mcp-schema.json",+ "mcpServers": {+ "beacon": {+ "type": "stdio",+ "command": "/opt/homebrew/bin/beacon",+ "args": [+ "mcp",+ "serve"+ ]+ }+ },+ "disabledServers": [+ "github"+ ]+}`,+ wantExisting: `{+ "$schema": "https://raw.githubusercontent.com/can1357/oh-my-pi/main/packages/coding-agent/src/config/mcp-schema.json",+ "mcpServers": {+ "beacon": {+ "type": "stdio",+ "command": "/opt/homebrew/bin/beacon",+ "args": [+ "mcp",+ "serve"+ ]+ },+ "beacon-managed": {+ "type": "http",+ "url": "https://mcp.example.test"+ }+ },+ "disabledServers": [+ "github"+ ]+}`,+ wantNew: `{+ "$schema": "https://raw.githubusercontent.com/can1357/oh-my-pi/main/packages/coding-agent/src/config/mcp-schema.json",+ "mcpServers": {+ "beacon-managed": {+ "type": "http",+ "url": "https://mcp.example.test"+ }+ }+}+`,+ wantToken: `{+ "$schema": "https://raw.githubusercontent.com/can1357/oh-my-pi/main/packages/coding-agent/src/config/mcp-schema.json",+ "mcpServers": {+ "beacon-managed": {+ "type": "http",+ "url": "https://mcp.example.test",+ "headers": {+ "Authorization": "Bearer ${BEACON_MCP_TOKEN}"+ }+ }+ }+}+`,+ conflict: `{"mcpServers":{"beacon-managed":{"type":"http","url":"https://elsewhere.example"}}}`,+ },}// isolate points every harness path at a fresh home and returns it.@@ -369,6 +433,10 @@ func isolate(t *testing.T) string {t.Setenv("XDG_CONFIG_HOME", "")t.Setenv("CLAUDE_CONFIG_DIR", "")t.Setenv("CODEX_HOME", "")+ // An explicitly empty OMP_PROFILE is Oh My Pi's default profile even when PI_PROFILE is set.+ for _, name := range []string{"PI_CODING_AGENT_DIR", "PI_CONFIG_DIR", "OMP_PROFILE", "PI_PROFILE"} {+ t.Setenv(name, "")+ }return home}@@ -661,7 +729,7 @@ func userEdit(target Target) string {}func TestUnparseableConfigsAreSkippedAndLeftAlone(t *testing.T) {- for _, name := range []string{"claude_code", "codex_cli", "cursor", "vscode", "gemini_cli", "opencode"} {+ for _, name := range []string{"claude_code", "codex_cli", "cursor", "vscode", "gemini_cli", "opencode", "omp"} {t.Run(name, func(t *testing.T) {home := isolate(t)target := mustTarget(t, name)@@ -854,6 +922,7 @@ func TestLookupAcceptsEndpointTargetSpellings(t *testing.T) {for spelling, want := range map[string]string{"claude": "claude_code", "Claude_Code": "claude_code", "codex": "codex_cli", "codex-cli": "codex_cli","gemini": "gemini_cli", "vs-code": "vscode", "opencode": "opencode", "cursor": "cursor",+ "omp": "omp", "oh-my-pi": "omp", "Oh_My_Pi": "omp","copilot": "copilot_cli", "droid": "factory", "windsurf": "devin-desktop",} {got, ok := Lookup(spelling)@@ -1014,3 +1083,98 @@ func fixtureIndex(name string) int {}panic(name)}++// Oh My Pi parses mcp.json as plain JSON and quietly ignores a file it cannot parse, servers and+// all. A file with a comment is one Beacon's JSONC reader would happily edit, so the strictness has+// to be the target's: editing it would add beacon-managed to a file the runtime never loads.+func TestOhMyPiConfigThatIsNotPlainJSONIsLeftAlone(t *testing.T) {+ home := isolate(t)+ target := mustTarget(t, "omp")+ path := targetPath(t, target, home)+ jsonc := "{\n // mine\n \"mcpServers\": {\n \"x\": {\"type\": \"http\", \"url\": \"https://x\"},\n },\n}\n"+ writeFile(t, path, jsonc)+ plan, err := Plan(fileOptions(home), []Target{target})+ if err != nil {+ t.Fatal(err)+ }+ if plan[0].Action != ActionSkip || !strings.Contains(plan[0].Detail, "not plain JSON") {+ t.Fatalf("plan = %s (%s)", plan[0].Action, plan[0].Detail)+ }+ if _, err := Apply(context.Background(), fileOptions(home), plan); err != nil {+ t.Fatal(err)+ }+ if readFile(t, path) != jsonc {+ t.Fatal("a config Oh My Pi cannot parse was edited")+ }+}++// Connect writes the mcp.json of the profile Oh My Pi would run under, and only that one.+func TestOhMyPiConnectWritesTheActiveProfileOnly(t *testing.T) {+ home := isolate(t)+ target := mustTarget(t, "omp")+ t.Setenv("OMP_PROFILE", "work")+ connect(t, fileOptions(home), target)+ if got := readFile(t, filepath.Join(home, ".omp", "profiles", "work", "agent", "mcp.json")); !strings.Contains(got, ServerName) {+ t.Fatalf("the work profile's mcp.json lacks %s:\n%s", ServerName, got)+ }+ if _, err := os.Stat(filepath.Join(home, ".omp", "agent", "mcp.json")); !os.IsNotExist(err) {+ t.Fatalf("connect also wrote the default profile's mcp.json: %v", err)+ }++ t.Setenv("OMP_PROFILE", "../escape")+ plan, err := Plan(fileOptions(home), []Target{target})+ if err != nil {+ t.Fatal(err)+ }+ if plan[0].Action != ActionSkip || !strings.Contains(plan[0].Detail, "profile") {+ t.Fatalf("an invalid profile planned %s (%s)", plan[0].Action, plan[0].Detail)+ }+}++// A harness that switches servers off with `enabled` inside the entry gets the person's value+// back on every write: re-running connect, or changing auth mode, must not turn beacon-managed+// back on.+func TestConnectKeepsTheEnabledValueThePersonSet(t *testing.T) {+ for name, disable := range map[string]func(string) string{+ "codex_cli": func(s string) string { return s + "enabled = false\n" },+ "opencode": func(s string) string { return strings.Replace(s, `"enabled": true`, `"enabled": false`, 1) },+ "omp": func(s string) string {+ return strings.Replace(s, `"url": "`+testURL+`"`, `"url": "`+testURL+`",`+"\n \"enabled\": false", 1)+ },+ } {+ t.Run(name, func(t *testing.T) {+ home := isolate(t)+ target := mustTarget(t, name)+ path := targetPath(t, target, home)+ opts := fileOptions(home)+ connect(t, opts, target)+ disabled := disable(readFile(t, path))+ writeFile(t, path, disabled)+ if st, _ := inspect(target, path); st.entry["enabled"] != false {+ t.Fatalf("the fixture did not disable the entry:\n%s", disabled)+ }++ if got := connect(t, opts, target); got.Action != ActionPresent {+ t.Fatalf("re-running connect on a disabled entry = %s (%s), want present", got.Action, got.Detail)+ }+ if readFile(t, path) != disabled {+ t.Fatal("re-running connect rewrote a disabled entry")+ }++ tokenOpts := opts+ tokenOpts.TokenEnv = "BEACON_MCP_TOKEN"+ for _, o := range []Options{tokenOpts, opts} {+ if got := connect(t, o, target); got.Action != ActionUpdate {+ t.Fatalf("switching auth mode = %s, want update", got.Action)+ }+ st, err := inspect(target, path)+ if err != nil {+ t.Fatal(err)+ }+ if st.entry["enabled"] != false || entryAuth(st.entry) != o.auth() {+ t.Fatalf("after switching to %s the entry is %v", o.auth(), st.entry)+ }+ }+ })+ }+}diff --git a/cli/beacon/internal/mcpconnect/targets.go b/cli/beacon/internal/mcpconnect/targets.goindex d4bbda5c..dfdc7057 100644--- a/cli/beacon/internal/mcpconnect/targets.go+++ b/cli/beacon/internal/mcpconnect/targets.go@@ -8,6 +8,7 @@ import ("strings""github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/harness"+ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/hooks")// ServerName is the name Beacon registers the Beacon Cloud MCP server under in every harness.@@ -21,6 +22,11 @@ const TokenPage = "beacon.sh → Dashboard → MCP Access"// vscodeInputID names the VS Code input variable that holds a token in token mode.const vscodeInputID = "beacon-managed-token"+// ompMCPSchema is the $schema Oh My Pi writes at the top of every mcp.json it creates or saves.+// A file Beacon creates starts with the same line, so it reads as one Oh My Pi made, and a later+// save by Oh My Pi leaves nothing behind that disconnect would not recognize as Beacon's.+const ompMCPSchema = "https://raw.githubusercontent.com/can1357/oh-my-pi/main/packages/coding-agent/src/config/mcp-schema.json"+// AuthMode is how a harness authenticates to Beacon Cloud MCP.type AuthMode string@@ -67,6 +73,12 @@ type Target struct {cli string// vscodeInputs is set for VS Code, whose token mode uses a prompted input.vscodeInputs bool+ // strictJSON is set for a harness that parses its config as plain JSON and ignores a file+ // with comments or trailing commas: Beacon neither edits such a file nor writes one.+ strictJSON bool+ // switchable is set for a harness that turns a server off with an `enabled` key inside its+ // entry. That key is the person's: connect keeps its value whenever it writes the entry.+ switchable booloauthNext stringtokenNext string // may contain %s for the variable name@@ -95,6 +107,7 @@ func Targets() []Target {{Name: "codex_cli", DisplayName: "Codex CLI", Aliases: []string{"codex", "codex-cli"},Automatic: true, format: formatTOML, path: codexConfigPath, container: []string{"mcp_servers"},+ switchable: true,entry: func(url, tokenEnv string) ordered {e := ordered{{"url", url}}if tokenEnv != "" {@@ -148,7 +161,8 @@ func Targets() []Target {{Name: "opencode", DisplayName: "OpenCode", Aliases: []string{"opencode", "open-code"},Automatic: true, format: formatJSON, path: opencodeConfigPath, container: []string{"mcp"},- skeleton: ordered{{"$schema", "https://opencode.ai/config.json"}},+ switchable: true,+ skeleton: ordered{{"$schema", "https://opencode.ai/config.json"}},entry: func(url, tokenEnv string) ordered {e := ordered{{"type", "remote"}, {"url", url}, {"enabled", true}}if tokenEnv != "" {@@ -159,6 +173,21 @@ func Targets() []Target {oauthNext: "Run `opencode mcp auth " + ServerName + "`.",tokenNext: "Set %s in the environment OpenCode starts from.",},+ {+ Name: "omp", DisplayName: "Oh My Pi", Aliases: []string{"omp", "oh-my-pi", "ohmypi"},+ Automatic: true, format: formatJSON, path: ompMCPConfigPath, container: []string{"mcpServers"},+ skeleton: ordered{{"$schema", ompMCPSchema}},+ strictJSON: true, switchable: true,+ entry: func(url, tokenEnv string) ordered {+ e := ordered{{"type", "http"}, {"url", url}}+ if tokenEnv != "" {+ e = append(e, field{"headers", ordered{{"Authorization", "Bearer ${" + tokenEnv + "}"}}})+ }+ return e+ },+ oauthNext: "In Oh My Pi, run /mcp reauth " + ServerName + " and sign in. Until then it reports " + ServerName + " as failing to connect.",+ tokenNext: "Set %s in the environment Oh My Pi starts from.",+ },// Manual targets: no MCP OAuth support Beacon has confirmed, so Beacon writes nothing// and prints the steps. The snippets follow each runtime's documentation.@@ -315,6 +344,16 @@ func opencodeConfigPath(home string) (string, error) {return filepath.Join(dir, "opencode.jsonc"), nil}+// ompMCPConfigPath is the user-level mcp.json of the active Oh My Pi profile, the file its own+// `/mcp add` writes at user level.+func ompMCPConfigPath(home string) (string, error) {+ dir, err := hooks.OmpAgentDirForHome(home)+ if err != nil {+ return "", err+ }+ return filepath.Join(dir, "mcp.json"), nil+}+// NextStep is what the person does after connect for an automatic target.func (t Target) NextStep(auth AuthMode, tokenEnv string) string {if auth == AuthTokenEnv {diff --git a/cli/beacon/internal/mcpconnect/tomledit.go b/cli/beacon/internal/mcpconnect/tomledit.goindex fd996dde..b5277800 100644--- a/cli/beacon/internal/mcpconnect/tomledit.go+++ b/cli/beacon/internal/mcpconnect/tomledit.go@@ -3,6 +3,7 @@ package mcpconnectimport ("fmt""regexp"+ "strconv""strings""github.com/pelletier/go-toml/v2"@@ -40,12 +41,17 @@ func tomlLineEnding(text string) string {return "\n"}-// tomlBlock renders [mcp_servers.<name>] with fields in the order given.+// tomlBlock renders [mcp_servers.<name>] with fields in the order given. Values are strings, or+// the person's own `enabled` boolean that connect carries over.func tomlBlock(table string, name string, fields []field, eol string) string {var b strings.Builderb.WriteString("[" + table + "." + tomlKey(name) + "]" + eol)for _, f := range fields {- b.WriteString(f.Key + " = " + tomlString(fmt.Sprint(f.Value)) + eol)+ value := tomlString(fmt.Sprint(f.Value))+ if v, ok := f.Value.(bool); ok {+ value = strconv.FormatBool(v)+ }+ b.WriteString(f.Key + " = " + value + eol)}return b.String()}diff --git a/cli/beacon/internal/onboarding/wizard.go b/cli/beacon/internal/onboarding/wizard.goindex 5ea38a06..4636c988 100644--- a/cli/beacon/internal/onboarding/wizard.go+++ b/cli/beacon/internal/onboarding/wizard.go@@ -779,7 +779,7 @@ func (m wizardModel) agentToolsSummary() string {func agentToolCopy(tool int) (string, string) {if tool == agentToolCloudMCP {return "Beacon Cloud MCP",- "Adds Beacon Cloud MCP to Claude Code, Codex, Cursor, VS Code, Gemini CLI and OpenCode, " ++ "Adds Beacon Cloud MCP to Claude Code, Codex, Cursor, VS Code, Gemini CLI, OpenCode and Oh My Pi, " +"so your agents can search the history this machine forwards. Each signs in with " +"beacon.sh the first time; no token is written."}diff --git a/docs/cli/endpoint-onboarding.mdx b/docs/cli/endpoint-onboarding.mdxindex e0eb2fab..d5d1eb80 100644--- a/docs/cli/endpoint-onboarding.mdx+++ b/docs/cli/endpoint-onboarding.mdx@@ -106,7 +106,7 @@ setting them up is opt-out:- **Beacon Cloud MCP**, offered only when you choose Beacon Cloud, runs[`beacon mcp connect`](/cli/mcp-connect) for you: it registers the Beacon Cloud MCPserver as `beacon-managed` in every detected harness Beacon can configure (Claude- Code, Codex CLI, Cursor, VS Code, Gemini CLI and OpenCode), so your agents can search+ Code, Codex CLI, Cursor, VS Code, Gemini CLI, OpenCode and Oh My Pi), so your agents can searchthe history this machine forwards. It uses OAuth, so Beacon writes only the URL andeach harness signs in with beacon.sh the first time it connects. Leaving the rowselected is the confirmation `beacon mcp connect` would otherwise ask for.diff --git a/docs/cli/mcp-connect.mdx b/docs/cli/mcp-connect.mdxindex c4487619..2ed058ca 100644--- a/docs/cli/mcp-connect.mdx+++ b/docs/cli/mcp-connect.mdx@@ -71,7 +71,7 @@ Connect works in these steps:1. **Harnesses.** Without `--harness`, connect acts on every harness `beacon endpoint discover`detects. `--harness` accepts the same names as `beacon endpoint install --harness`, such as- `claude`, `codex`, `cursor`, `vscode`, `gemini` and `opencode`.+ `claude`, `codex`, `cursor`, `vscode`, `gemini`, `opencode` and `omp`.2. **URL.** The URL is `--url`, or the Beacon Cloud URL recorded by[`beacon endpoint connect`](/cli/endpoint-connect) with `/mcp` added. The Beacon Cloud backendmay name its own canonical MCP URL, `https://mcp.beacon.sh` in production. When it does, connect@@ -90,7 +90,7 @@ Connect works in these steps:| `update` | Beacon's own entry, with a different URL or auth mode; connect updates it. || `present` | Already configured as asked. Nothing changes. || `conflict` | A `beacon-managed` entry that Beacon did not write, or one that points at another URL. It is left alone unless you pass `--force`. |- | `skip` | The config cannot be read or edited safely, for example because it does not parse. The reason is shown. |+ | `skip` | The config cannot be read or edited safely, for example because it does not parse, or, for a harness that reads plain JSON, because it has comments or trailing commas. The reason is shown. |5. **Confirm and write.** Connect asks before writing, unless you pass `--yes`. Each changed fileis first backed up next to itself as `<file>.beacon.<UTC time>.bak`, then replaced atomically.@@ -108,6 +108,10 @@ result and checks that the only difference from the original is the `beacon-manaIf anything else would change, nothing is written. A symlinked config, such as one managed by adotfiles tool, is written through the link.+Codex CLI, OpenCode and Oh My Pi turn a server off with an `enabled` key inside its entry. That+key is yours: if you switch `beacon-managed` off, connect keeps your value whenever it writes the+entry, so running it again, or changing the auth mode, never turns the server back on.+What connect wrote is recorded in `~/.beacon/mcp/connections.json` (`0600`): the harness, file, URL,auth mode, variable name and backup, and never a token. `disconnect` uses this record rather thana comment in the config, because some harnesses rewrite their config files and drop comments.@@ -183,6 +187,7 @@ Connect writes these entries (OAuth mode shown, then what `--token-env NAME` add| VS Code | User-profile `mcp.json` (next to the user `settings.json`) | `servers.beacon-managed = {"type": "http", "url": …}` | `"Bearer ${input:beacon-managed-token}"` and a password prompt input | "MCP: List Servers", then start `beacon-managed` || Gemini CLI | `~/.gemini/settings.json` | `mcpServers.beacon-managed = {"url": …, "type": "http"}` | `"Bearer ${NAME}"` | `/mcp auth beacon-managed` || OpenCode | `~/.config/opencode/opencode.json`, or `opencode.jsonc` | `mcp.beacon-managed = {"type": "remote", "url": …, "enabled": true}` | `"oauth": false`, `"Bearer {env:NAME}"` | `opencode mcp auth beacon-managed` |+| Oh My Pi | The active profile's `mcp.json`: `~/.omp/agent/mcp.json`, or `~/.omp/profiles/<name>/agent/mcp.json` under `OMP_PROFILE` (or `PI_PROFILE`). `PI_CODING_AGENT_DIR` replaces the default profile's directory, and `PI_CONFIG_DIR` renames `.omp` | `mcpServers.beacon-managed = {"type": "http", "url": …}` | `headers.Authorization: "Bearer ${NAME}"` | `/mcp reauth beacon-managed` |- **VS Code** asks for the token the first time the server starts and keeps it in its own secretstorage, so in token mode it does not read `NAME`.@@ -190,6 +195,13 @@ Connect writes these entries (OAuth mode shown, then what `--token-env NAME` add`beacon-managed` shows as disabled.- **OpenCode** reads `opencode.json` when both it and `opencode.jsonc` exist. Connect edits thesame file OpenCode's own `opencode mcp add` would.+- **Oh My Pi** signs in only when you run `/mcp reauth beacon-managed`; until then it reports+ `beacon-managed` as failing to connect each time it starts. It reads `mcp.json` as plain JSON and+ ignores a file with comments or trailing commas, so connect skips such a file instead of editing+ it. Connect writes only the active profile; run it with `OMP_PROFILE` set to connect another.+ Oh My Pi also loads the MCP servers of Claude Code, Codex CLI, Cursor, Gemini CLI and OpenCode,+ so a `beacon-managed` entry connect wrote for one of those appears in Oh My Pi as well, and stays+ after `beacon mcp disconnect --harness omp`. Its own entry takes precedence over those.### Harnesses you add by handdiff --git a/docs/cli/mcp.mdx b/docs/cli/mcp.mdxindex 765c6a6b..8034336e 100644--- a/docs/cli/mcp.mdx+++ b/docs/cli/mcp.mdx@@ -30,7 +30,7 @@ the other:| `beacon-managed` | The session history this endpoint forwards to Beacon Cloud, served by Beacon Cloud over HTTPS | [`connect`, `disconnect`, `status`, `token create`](/cli/mcp-connect) |`beacon mcp connect` registers `beacon-managed` in Claude Code, Codex CLI, Cursor, VS Code,-Gemini CLI and OpenCode. By default it writes only the URL, and each harness signs in with OAuth.+Gemini CLI, OpenCode and Oh My Pi. By default it writes only the URL, and each harness signs in with OAuth.With `--token-env`, the config instead references a personal token, created with`beacon mcp token create` or at beacon.sh → Dashboard → MCP Access and held in an environmentvariable. For other harnesses it prints the steps to add thediff --git a/docs/deployment/managed-mcp.mdx b/docs/deployment/managed-mcp.mdxindex 87f3bb9e..1600ca64 100644--- a/docs/deployment/managed-mcp.mdx+++ b/docs/deployment/managed-mcp.mdx@@ -58,6 +58,8 @@ After connecting, restart any harness that is already running. Then sign in from- **VS Code:** Run **MCP: List Servers** and start `beacon-managed`.- **Gemini CLI:** Run `/mcp auth beacon-managed`.- **OpenCode:** Run `opencode mcp auth beacon-managed`.+- **Oh My Pi:** Run `/mcp reauth beacon-managed`. Until you do, Oh My Pi reports the server as+ failing to connect each time it starts.For supported configuration formats, manual setup for other harnesses, and all command flags, seethe [`beacon mcp connect` reference](/cli/mcp-connect).diff --git a/docs/runtimes/oh-my-pi.mdx b/docs/runtimes/oh-my-pi.mdxindex 6a50b003..b3cfb631 100644--- a/docs/runtimes/oh-my-pi.mdx+++ b/docs/runtimes/oh-my-pi.mdx@@ -36,12 +36,13 @@ Beacon's managed extension is a single TypeScript file in one of Oh My Pi's twoUser level is the default, and `beacon endpoint discover` reports on the user path only.-The two paths resolve asymmetrically, which matters if you set either of Oh My Pi's directory variables:+The two paths resolve asymmetrically, which matters if you set any of Oh My Pi's directory variables. The user path follows the profile Oh My Pi itself would run under:| Variable | Effect on the install path ||----------|---------------------------|-| `PI_CODING_AGENT_DIR` | Replaces the user agent directory outright, so the extension goes to `$PI_CODING_AGENT_DIR/extensions/beacon.ts`. Oh My Pi sets this on its own process when a named profile is active, so installing from inside a profiled session lands in `~/.omp/profiles/<name>/agent/extensions/` |-| `PI_CONFIG_DIR` | Renames the `.omp` directory under your home directory only. The project path stays `./.omp/extensions/` |+| `OMP_PROFILE`, or `PI_PROFILE` when `OMP_PROFILE` is unset | Names the active profile. A named profile installs to `~/.omp/profiles/<name>/agent/extensions/beacon.ts`; empty or `default` is the default profile. A name Oh My Pi would refuse is refused |+| `PI_CODING_AGENT_DIR` | Replaces the default profile's agent directory, so the extension goes to `$PI_CODING_AGENT_DIR/extensions/beacon.ts`. A named profile ignores it, as Oh My Pi does. Oh My Pi sets it, with the profile variables, on its own process when a named profile is active |+| `PI_CONFIG_DIR` | Renames the `.omp` directory under your home directory only, including for a named profile. The project path stays `./.omp/extensions/` |Beacon identifies its own extension by the marker `beacon-managed-omp-extension:v1`, which is distinct from Pi's. The version suffix is part of the contract with the extension source: it is what lets a repair recognize a stale file instead of leaving it in place. A `beacon.ts` without the marker belongs to somebody else, so install will not overwrite it and discovery does not report it as Beacon telemetry.@@ -65,6 +66,14 @@ Oh My Pi reports as the `omp` harness with capability `plugin`:A file carrying Pi's marker at this path is not an Oh My Pi install. The two runtimes read different directories, so it should not arise, but the markers are distinct so the answer does not depend on that staying true.+## Beacon Cloud MCP++[`beacon mcp connect`](/cli/mcp-connect) registers the Beacon Cloud MCP server as `beacon-managed` in the active profile's `mcp.json`, next to any servers already there, so Oh My Pi can search the history this endpoint forwards. It resolves the profile the same way as the extension install above. After connecting, run `/mcp reauth beacon-managed` in Oh My Pi and sign in with beacon.sh.++```bash+beacon mcp connect --harness omp+```+## Install or configuration support```bash@@ -127,7 +136,7 @@ The extension itself sends nothing over the network. It spawns the local `beacon- **No enforcement.** As with every other runtime, enforcement stays behind the optional, off-by-default policy provider seam (`BEACON_POLICY_PROVIDER`), which is not wired to Oh My Pi. Its blocking `tool_call` handler and its approval events make it a viable target for that seam later.- **Streaming events are not collected.** The extension subscribes to ten of Oh My Pi's event types and ignores the rest, which are provider-request internals, streaming message updates, compaction and retry signals, and TUI plumbing. Assistant output is recorded once when a message finalizes rather than token by token, so Beacon stays out of the streaming path.- **MCP notifications are not collected.** `mcp_notification` fires for every JSON-RPC notification a connected server sends, most of them routine tools and resources list refreshes. It describes MCP transport plumbing rather than an action the agent took. MCP tool calls the agent makes *are* collected.-- **Named profiles need the environment variable.** Beacon installs into the agent directory `PI_CODING_AGENT_DIR` names, or the default one when it is unset. It does not enumerate `~/.omp/profiles/`, so instrumenting a named profile means running the install with that variable set — which is what Oh My Pi itself does inside a profiled session.+- **One profile at a time.** Beacon installs into the active profile, named by `OMP_PROFILE` or `PI_PROFILE`, or into the default profile. It does not enumerate `~/.omp/profiles/`, so instrumenting another profile means running the install with that profile's variable set.- **Session switches are not distinguished.** Oh My Pi's `session_start` carries no reason, and its `session_switch`, `session_branch`, and `session_tree` events are not subscribed to, so a resumed or forked session is not marked as such.## Deployment notes