diff --git a/README.md b/README.md index 48888af..1c6cfaf 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,8 @@ each write — no auto-pruning, so they pile up. | --- | --- | --- | --- | | `jdtls-lombok` | LSP | replace | Makes jdtls lombok-aware via `-javaagent` flag | | `jdtls-clean-workspace` | LSP | replace | Stops jdtls from writing `.project`/`.classpath`/etc. into your project root | -| `mcp-remote-add` | MCP | replace | Add a remote MCP server with bearer-token auth (prompts for id, URL, token) | -| `mcp-remote-add-noauth` | MCP | replace | Add a remote MCP server without auth (prompts for id, URL) | +| `mcp-http` | MCP | replace | Add an HTTP MCP server (localhost or remote) with one custom header (prompts for id, URL, header name, header value) | +| `mcp-http-noauth` | MCP | replace | Add an HTTP MCP server (localhost or remote) without auth headers (prompts for id, URL) | | `mcp-intellij` | MCP | replace | Add the JetBrains IDE MCP server (loopback HTTP, default port 64342) | | `mcp-vscode` | MCP | replace | Add the VS Code MCP server via the `JuehangQin.vscode-mcp-server` extension (loopback HTTP, default port 3000) | | `permissions-git-safe` | Permissions | merge | Read-only git commands (status, diff, log, branch --list, fetch, etc.) | @@ -55,7 +55,7 @@ opencode-presets install jdtls-lombok jdtls-clean-workspace opencode-presets install permissions-git-safe permissions-shell-safe ``` -Presets whose path uses a prompt (like `mcp-remote-add`) can't be +Presets whose path uses a prompt (like `mcp-http`) can't be removed with `remove` — use `reset` instead: ```sh diff --git a/package-lock.json b/package-lock.json index c6f1a4d..ec41305 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "opencode-presets", - "version": "0.3.0", + "version": "0.3.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "opencode-presets", - "version": "0.3.0", + "version": "0.3.2", "license": "MIT", "dependencies": { "ajv": "8.20.0", diff --git a/package.json b/package.json index 4e7a8da..6ecaff2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "opencode-presets", - "version": "0.3.0", + "version": "0.3.2", "description": "Interactive CLI that patches opencode.json with curated config presets — LSP, MCP, permissions.", "type": "module", "bin": { diff --git a/presets/mcp-http-noauth.conf b/presets/mcp-http-noauth.conf new file mode 100644 index 0000000..76f2f50 --- /dev/null +++ b/presets/mcp-http-noauth.conf @@ -0,0 +1,16 @@ +// @name: mcp-http-noauth +// @description: Adds an HTTP MCP server to opencode (URL can be +// localhost or remote) with no auth headers. Use this for open +// servers or for OAuth (which opencode handles separately). For +// a single custom header (bearer token, upstream API token, etc.), +// use mcp-http instead. +// @author: Jan +// @version: 0.2.0 +// @path: mcp.{{prompt:name}} +// @prompt: name | text | server identifier (key under mcp) +// @prompt: url | text | server URL +{ + "type": "remote", + "url": "{{prompt:url}}", + "enabled": true +} diff --git a/presets/mcp-http.conf b/presets/mcp-http.conf new file mode 100644 index 0000000..75aef03 --- /dev/null +++ b/presets/mcp-http.conf @@ -0,0 +1,23 @@ +// @name: mcp-http +// @description: Adds an HTTP MCP server to opencode (URL can be +// localhost or remote) with one custom request header. Use this for +// bearer auth (header name "Authorization", value "Bearer ") +// or for upstream credentials the MCP server forwards to a backend +// service such as Bitbucket, GitHub, or Jira. For multi-header setups, +// run the preset and then edit opencode.json by hand. For servers +// without auth headers, use mcp-http-noauth. +// @author: Jan +// @version: 0.2.0 +// @path: mcp.{{prompt:name}} +// @prompt: name | text | server identifier (key under mcp, e.g. openrag-tom) +// @prompt: url | text | server URL (e.g. https://my-mcp.example.com/mcp or http://localhost:8080/mcp) +// @prompt: headerName | text | request header name (e.g. Authorization, X-Bitbucket-Token) +// @prompt: headerValue | secret | request header value (e.g. "Bearer " or a raw token) +{ + "type": "remote", + "url": "{{prompt:url}}", + "enabled": true, + "headers": { + "{{prompt:headerName}}": "{{prompt:headerValue}}" + } +} diff --git a/presets/mcp-remote-add-noauth.conf b/presets/mcp-remote-add-noauth.conf deleted file mode 100644 index 93496f0..0000000 --- a/presets/mcp-remote-add-noauth.conf +++ /dev/null @@ -1,16 +0,0 @@ -// @name: mcp-remote-add-noauth -// @description: Adds a remote (HTTP) MCP server to opencode WITHOUT -// any auth header. Prompts for the server identifier (the key under -// `mcp`, e.g. `my-server`) and the URL. Use this for MCP servers -// that are open or use OAuth (which opencode handles separately). -// For bearer-token auth, use mcp-remote-add instead. -// @author: Jan -// @version: 0.1.0 -// @path: mcp.{{prompt:name}} -// @prompt: name | text | server identifier (key under mcp) -// @prompt: url | text | server URL -{ - "type": "remote", - "url": "{{prompt:url}}", - "enabled": true -} diff --git a/presets/mcp-remote-add.conf b/presets/mcp-remote-add.conf deleted file mode 100644 index f03b117..0000000 --- a/presets/mcp-remote-add.conf +++ /dev/null @@ -1,21 +0,0 @@ -// @name: mcp-remote-add -// @description: Adds a remote (HTTP) MCP server to opencode and -// authenticates it with a bearer token. Prompts for the server -// identifier (the key under `mcp`, e.g. `openrag-tom`), the URL, -// and the bearer token. The token is written into opencode.json -// under the server's Authorization header. Re-running with the -// same identifier overwrites that server's entry. -// @author: Jan -// @version: 0.1.0 -// @path: mcp.{{prompt:name}} -// @prompt: name | text | server identifier (key under mcp, e.g. openrag-tom) -// @prompt: url | text | server URL (e.g. https://my-mcp.example.com/mcp) -// @prompt: token | secret | bearer token -{ - "type": "remote", - "url": "{{prompt:url}}", - "enabled": true, - "headers": { - "Authorization": "Bearer {{prompt:token}}" - } -}