@dodopayments/opencode-plugin 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.mcp.json CHANGED
@@ -7,7 +7,8 @@
7
7
  "-y",
8
8
  "mcp-remote@latest",
9
9
  "https://mcp.dodopayments.com/sse"
10
- ]
10
+ ],
11
+ "enabled": true
11
12
  },
12
13
  "dodo-knowledge": {
13
14
  "type": "stdio",
@@ -16,7 +17,8 @@
16
17
  "-y",
17
18
  "mcp-remote@latest",
18
19
  "https://knowledge.dodopayments.com/mcp"
19
- ]
20
+ ],
21
+ "enabled": true
20
22
  }
21
23
  }
22
24
  }
package/README.md CHANGED
@@ -146,6 +146,50 @@ Then edit `.mcp.json` to point `dodopayments-api` at the local stdio server:
146
146
 
147
147
  Run `/reload-plugins` to apply changes to your current session.
148
148
 
149
+ ## Enable / disable individual MCP servers
150
+
151
+ Both MCPs ship enabled by default. You can turn either one off independently.
152
+
153
+ ### OpenCode
154
+
155
+ The npm plugin reads two environment variables before registering MCPs:
156
+
157
+ | Env var | Effect |
158
+ |---|---|
159
+ | `DODO_DISABLE_API_MCP=1` | Skips registering `dodopayments-api` |
160
+ | `DODO_DISABLE_KNOWLEDGE_MCP=1` | Skips registering `dodo-knowledge` |
161
+
162
+ Truthy values: `1`, `true`, `yes`, `on` (case-insensitive). Export the var in your shell profile or set it inline:
163
+
164
+ ```bash
165
+ DODO_DISABLE_API_MCP=1 opencode
166
+ ```
167
+
168
+ ### Claude Code, Codex CLI, Cursor
169
+
170
+ These clients load MCPs from the static `.mcp.json` shipped with the plugin. To disable a server, override its entry in your own project-level config and set `"enabled": false`.
171
+
172
+ **Claude Code** - edit `.mcp.json` at your project root (or run `claude mcp disable dodopayments-api`):
173
+
174
+ ```json
175
+ {
176
+ "mcpServers": {
177
+ "dodopayments-api": {
178
+ "type": "stdio",
179
+ "command": "npx",
180
+ "args": ["-y", "mcp-remote@latest", "https://mcp.dodopayments.com/sse"],
181
+ "enabled": false
182
+ }
183
+ }
184
+ }
185
+ ```
186
+
187
+ Run `/reload-plugins` to apply.
188
+
189
+ **Codex CLI / Cursor** - the same `enabled: false` pattern works in any project-level `.mcp.json` that overrides the plugin's bundled file. Restart the client after editing.
190
+
191
+ > Per-MCP toggles inside the Claude Code `/plugin` UI are tracked upstream in [anthropics/claude-code#27105](https://github.com/anthropics/claude-code/issues/27105) and [#46373](https://github.com/anthropics/claude-code/issues/46373). Until those land, the `enabled: false` override above is the supported path.
192
+
149
193
  ## A prompt to try first
150
194
 
151
195
  Once the plugin is active, try:
@@ -32,6 +32,25 @@ Two MCP servers (registered automatically):
32
32
  | `dodopayments-api` | Live API access (payments, subscriptions, customers, products, refunds, licenses, usage) | OAuth (browser) on first call |
33
33
  | `dodo-knowledge` | Semantic search over the Dodo Payments documentation | None |
34
34
 
35
+ ## Enable / disable individual MCP servers
36
+
37
+ Both MCPs ship enabled. To disable either one, set the matching env var to `1` (or `true`) before launching OpenCode:
38
+
39
+ | Env var | Effect |
40
+ |---|---|
41
+ | `DODO_DISABLE_API_MCP=1` | Skips registering `dodopayments-api` |
42
+ | `DODO_DISABLE_KNOWLEDGE_MCP=1` | Skips registering `dodo-knowledge` |
43
+
44
+ ```bash
45
+ # Disable just the API server (keep docs search)
46
+ DODO_DISABLE_API_MCP=1 opencode
47
+
48
+ # Disable both
49
+ DODO_DISABLE_API_MCP=1 DODO_DISABLE_KNOWLEDGE_MCP=1 opencode
50
+ ```
51
+
52
+ Persist the toggle by exporting the var in your shell profile or a project `.env` file your shell auto-loads. Truthy values: `1`, `true`, `yes`, `on` (case-insensitive). Anything else - including unset - keeps the MCP enabled.
53
+
35
54
  ## Overriding the defaults
36
55
 
37
56
  The plugin registers MCPs with nullish-assign semantics, so anything you declare in your own `opencode.json` wins. Example - swap the default remote OAuth server for the local stdio server with your own API key:
@@ -1,22 +1,13 @@
1
1
  // @dodopayments/opencode-plugin
2
- //
3
- // Registers the Dodo Payments MCP servers via OpenCode's `config` plugin
4
- // hook so users do not need to paste an `mcp: { ... }` block into their
5
- // `opencode.json`. The bundled skills/ directory is auto-discovered by
6
- // OpenCode separately.
7
- //
2
+ // Registers Dodo Payments MCP servers via OpenCode's `config` hook.
8
3
  // @see https://opencode.ai/docs/plugins
9
- // @see https://docs.dodopayments.com/developer-resources/agent-skills
10
4
 
11
5
  /**
12
6
  * @typedef {import("@opencode-ai/plugin").Plugin} Plugin
13
7
  */
14
8
 
15
- // OpenCode loads the user's opencode.json before invoking plugin `config`
16
- // hooks on the same mutable config object. Nullish-assign (`??=`) therefore
17
- // lets a user override any entry here by declaring the same key in their
18
- // own opencode.json - e.g. swapping the default remote OAuth server for the
19
- // local stdio `dodopayments-mcp` with their own API key.
9
+ // Nullish-assign (`??=`) lets users override any entry by declaring the
10
+ // same MCP key in their own opencode.json.
20
11
  const DODO_MCP_SERVERS = {
21
12
  "dodopayments-api": {
22
13
  type: "local",
@@ -30,11 +21,27 @@ const DODO_MCP_SERVERS = {
30
21
  },
31
22
  };
32
23
 
24
+ // Env vars chosen over opencode.json config because OpenCode's top-level
25
+ // schema is strict and rejects unknown keys (anomalyco/opencode#9161).
26
+ const DISABLE_FLAGS = {
27
+ "dodopayments-api": "DODO_DISABLE_API_MCP",
28
+ "dodo-knowledge": "DODO_DISABLE_KNOWLEDGE_MCP",
29
+ };
30
+
31
+ const TRUTHY = new Set(["1", "true", "yes", "on"]);
32
+
33
+ function isDisabled(envVarName) {
34
+ const raw = process.env[envVarName];
35
+ if (raw === undefined || raw === null || raw === "") return false;
36
+ return TRUTHY.has(String(raw).trim().toLowerCase());
37
+ }
38
+
33
39
  /** @type {Plugin} */
34
40
  const dodopayments = async () => ({
35
41
  config: async (config) => {
36
42
  config.mcp ??= {};
37
43
  for (const [name, entry] of Object.entries(DODO_MCP_SERVERS)) {
44
+ if (isDisabled(DISABLE_FLAGS[name])) continue;
38
45
  config.mcp[name] ??= entry;
39
46
  }
40
47
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dodopayments/opencode-plugin",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "Dodo Payments skills and MCP server hints for OpenCode.",
5
5
  "type": "module",
6
6
  "main": "opencode-plugin/index.js",