@dodopayments/opencode-plugin 0.2.0 → 0.3.1

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/README.md CHANGED
@@ -26,13 +26,30 @@ The API MCP server uses browser OAuth by default, so no keys are required at ins
26
26
 
27
27
  ### Codex CLI
28
28
 
29
- Codex reads `.claude-plugin/marketplace.json` natively, so the same repo works:
29
+ Codex installs plugins in two steps: register the marketplace from your shell, then install the plugin from inside the Codex TUI.
30
+
31
+ 1. Register the marketplace:
32
+
33
+ ```bash
34
+ codex plugin marketplace add dodopayments/dodo-agent-plugin
35
+ ```
36
+
37
+ 2. Open Codex and run the `/plugins` slash command:
38
+
39
+ ```bash
40
+ codex
41
+ ```
42
+
43
+ Then type `/plugins`, switch to the **Dodo Payments** marketplace, select the **dodopayments** plugin, and choose **Install plugin**.
44
+
45
+ If you previously added the marketplace before this fix landed and the plugin doesn't appear under `/plugins`, refresh it:
30
46
 
31
47
  ```bash
32
- codex plugin marketplace add dodopayments/dodo-agent-plugin
33
- codex plugin install dodopayments@dodopayments
48
+ codex plugin marketplace upgrade dodopayments
34
49
  ```
35
50
 
51
+ > Codex CLI does not have a `codex plugin install` subcommand. Plugin installation always happens through the in-TUI `/plugins` flow ([official docs](https://developers.openai.com/codex/plugins)).
52
+
36
53
  ### Cursor
37
54
 
38
55
  Manual install:
@@ -45,29 +62,37 @@ Restart Cursor. The plugin loads skills from `.claude/skills/` (via Cursor's Cla
45
62
 
46
63
  ### OpenCode
47
64
 
48
- OpenCode distributes via npm. Add to your `opencode.json`:
65
+ OpenCode distributes via npm. Add the plugin to your `opencode.json`:
49
66
 
50
67
  ```jsonc
51
68
  {
52
69
  "$schema": "https://opencode.ai/config.json",
70
+ "plugin": ["@dodopayments/opencode-plugin"]
71
+ }
72
+ ```
73
+
74
+ Restart OpenCode. Both MCP servers (`dodopayments-api`, `dodo-knowledge`) are registered automatically via the plugin's `config` hook, and the eight skills are auto-discovered from the installed package. No manual `mcp` block required.
75
+
76
+ If you prefer the local stdio API server with your own API key instead of the default remote OAuth server, declare `dodopayments-api` yourself in `opencode.json` - your entry wins over the plugin default:
77
+
78
+ ```jsonc
79
+ {
53
80
  "plugin": ["@dodopayments/opencode-plugin"],
54
81
  "mcp": {
55
82
  "dodopayments-api": {
56
83
  "type": "local",
57
- "command": ["npx", "-y", "mcp-remote@latest", "https://mcp.dodopayments.com/sse"],
58
- "enabled": true
59
- },
60
- "dodo-knowledge": {
61
- "type": "local",
62
- "command": ["npx", "-y", "mcp-remote@latest", "https://knowledge.dodopayments.com/mcp"],
84
+ "command": ["npx", "-y", "dodopayments-mcp@latest"],
85
+ "environment": {
86
+ "DODO_PAYMENTS_API_KEY": "dodo_test_...",
87
+ "DODO_PAYMENTS_WEBHOOK_KEY": "whsec_...",
88
+ "DODO_PAYMENTS_ENVIRONMENT": "test_mode"
89
+ },
63
90
  "enabled": true
64
91
  }
65
92
  }
66
93
  }
67
94
  ```
68
95
 
69
- OpenCode auto-discovers the eight skills from the installed package. Restart OpenCode to pick up the new config.
70
-
71
96
  ## Included Skills
72
97
 
73
98
  | Skill | Description |
@@ -1,6 +1,6 @@
1
1
  # @dodopayments/opencode-plugin
2
2
 
3
- OpenCode plugin that ships the Dodo Payments agent skills and references the Dodo Payments API and docs MCP servers.
3
+ Official OpenCode plugin for Dodo Payments. Ships eight integration skills and auto-registers two MCP servers.
4
4
 
5
5
  This package is part of [`dodopayments/dodo-agent-plugin`](https://github.com/dodopayments/dodo-agent-plugin) - the universal Dodo Payments plugin that also installs into Claude Code, Codex, and Cursor.
6
6
 
@@ -11,31 +11,50 @@ Add to your `opencode.json`:
11
11
  ```jsonc
12
12
  {
13
13
  "$schema": "https://opencode.ai/config.json",
14
+ "plugin": ["@dodopayments/opencode-plugin"]
15
+ }
16
+ ```
17
+
18
+ Restart OpenCode. That's it.
19
+
20
+ - Both MCP servers are registered automatically via the plugin's `config` hook.
21
+ - The eight skills are auto-discovered from this package's `skills/` directory.
22
+ - The first call to `dodopayments-api` opens a browser for OAuth. `dodo-knowledge` needs no auth.
23
+
24
+ ## What you get
25
+
26
+ Eight agent skills (auto-loaded when relevant): `best-practices`, `checkout-integration`, `subscription-integration`, `webhook-integration`, `usage-based-billing`, `credit-based-billing`, `license-keys`, `billing-sdk`.
27
+
28
+ Two MCP servers (registered automatically):
29
+
30
+ | Server | Purpose | Auth |
31
+ |--------|---------|------|
32
+ | `dodopayments-api` | Live API access (payments, subscriptions, customers, products, refunds, licenses, usage) | OAuth (browser) on first call |
33
+ | `dodo-knowledge` | Semantic search over the Dodo Payments documentation | None |
34
+
35
+ ## Overriding the defaults
36
+
37
+ 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:
38
+
39
+ ```jsonc
40
+ {
14
41
  "plugin": ["@dodopayments/opencode-plugin"],
15
42
  "mcp": {
16
43
  "dodopayments-api": {
17
44
  "type": "local",
18
- "command": ["npx", "-y", "mcp-remote@latest", "https://mcp.dodopayments.com/sse"],
19
- "enabled": true
20
- },
21
- "dodo-knowledge": {
22
- "type": "local",
23
- "command": ["npx", "-y", "mcp-remote@latest", "https://knowledge.dodopayments.com/mcp"],
45
+ "command": ["npx", "-y", "dodopayments-mcp@latest"],
46
+ "environment": {
47
+ "DODO_PAYMENTS_API_KEY": "dodo_test_...",
48
+ "DODO_PAYMENTS_WEBHOOK_KEY": "whsec_...",
49
+ "DODO_PAYMENTS_ENVIRONMENT": "test_mode"
50
+ },
24
51
  "enabled": true
25
52
  }
26
53
  }
27
54
  }
28
55
  ```
29
56
 
30
- Then restart OpenCode. The eight Dodo Payments skills are auto-discovered from this package's `skills/` directory.
31
-
32
- ## What you get
33
-
34
- - **Eight agent skills** (auto-loaded by OpenCode when relevant):
35
- - `best-practices`, `checkout-integration`, `subscription-integration`, `webhook-integration`, `usage-based-billing`, `credit-based-billing`, `license-keys`, `billing-sdk`.
36
- - **Two referenced MCP servers** (you configure them in `opencode.json` as shown above):
37
- - `dodopayments-api` - live API access via OAuth.
38
- - `dodo-knowledge` - semantic search over Dodo Payments documentation.
57
+ `dodo-knowledge` continues to be registered by the plugin unless you declare it explicitly too.
39
58
 
40
59
  ## License
41
60
 
@@ -1,21 +1,9 @@
1
1
  // @dodopayments/opencode-plugin
2
2
  //
3
- // OpenCode plugin entry point for Dodo Payments.
4
- //
5
- // This plugin exists to make `@dodopayments/opencode-plugin` installable
6
- // from npm so users can reference it in their `opencode.json` "plugin" array.
7
- // It registers no runtime hooks - the value of this package is:
8
- //
9
- // 1. The bundled skills/ directory (OpenCode auto-discovers SKILL.md files
10
- // from installed packages, so the 8 Dodo Payments skills become
11
- // available once this package is installed).
12
- //
13
- // 2. The documented .mcp.json and opencode.json reference snippets, so
14
- // users know exactly which MCP servers to add to their config.
15
- //
16
- // If future versions of this plugin need runtime behavior (e.g. injecting
17
- // Dodo-specific tools, hooking chat.message, etc.), add them to the returned
18
- // Hooks object. All Hooks fields are optional - see @opencode-ai/plugin types.
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.
19
7
  //
20
8
  // @see https://opencode.ai/docs/plugins
21
9
  // @see https://docs.dodopayments.com/developer-resources/agent-skills
@@ -24,7 +12,32 @@
24
12
  * @typedef {import("@opencode-ai/plugin").Plugin} Plugin
25
13
  */
26
14
 
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.
20
+ const DODO_MCP_SERVERS = {
21
+ "dodopayments-api": {
22
+ type: "local",
23
+ command: ["npx", "-y", "mcp-remote@latest", "https://mcp.dodopayments.com/sse"],
24
+ enabled: true,
25
+ },
26
+ "dodo-knowledge": {
27
+ type: "local",
28
+ command: ["npx", "-y", "mcp-remote@latest", "https://knowledge.dodopayments.com/mcp"],
29
+ enabled: true,
30
+ },
31
+ };
32
+
27
33
  /** @type {Plugin} */
28
- const dodopayments = async () => ({});
34
+ const dodopayments = async () => ({
35
+ config: async (config) => {
36
+ config.mcp ??= {};
37
+ for (const [name, entry] of Object.entries(DODO_MCP_SERVERS)) {
38
+ config.mcp[name] ??= entry;
39
+ }
40
+ },
41
+ });
29
42
 
30
43
  export default dodopayments;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dodopayments/opencode-plugin",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "Dodo Payments skills and MCP server hints for OpenCode.",
5
5
  "type": "module",
6
6
  "main": "opencode-plugin/index.js",
@@ -11,7 +11,6 @@
11
11
  "opencode-plugin/",
12
12
  "skills/",
13
13
  ".mcp.json",
14
- "opencode.json",
15
14
  "LICENSE"
16
15
  ],
17
16
  "scripts": {
@@ -36,7 +35,7 @@
36
35
  "type": "git",
37
36
  "url": "git+https://github.com/dodopayments/dodo-agent-plugin.git"
38
37
  },
39
- "homepage": "https://docs.dodopayments.com/developer-resources/agent-skills",
38
+ "homepage": "https://docs.dodopayments.com",
40
39
  "bugs": "https://github.com/dodopayments/dodo-agent-plugin/issues",
41
40
  "peerDependencies": {
42
41
  "@opencode-ai/plugin": ">=1.0.0"
package/opencode.json DELETED
@@ -1,28 +0,0 @@
1
- {
2
- "$schema": "https://opencode.ai/config.json",
3
- "plugin": [
4
- "@dodopayments/opencode-plugin"
5
- ],
6
- "mcp": {
7
- "dodopayments-api": {
8
- "type": "local",
9
- "command": [
10
- "npx",
11
- "-y",
12
- "mcp-remote@latest",
13
- "https://mcp.dodopayments.com/sse"
14
- ],
15
- "enabled": true
16
- },
17
- "dodo-knowledge": {
18
- "type": "local",
19
- "command": [
20
- "npx",
21
- "-y",
22
- "mcp-remote@latest",
23
- "https://knowledge.dodopayments.com/mcp"
24
- ],
25
- "enabled": true
26
- }
27
- }
28
- }