Skip to content

Commit c490fe8

Browse files
chore: Update README with adapter library details (#71)
* docs: Update README with adapter library usage & recommended setup * chore: Update copy from CX review Co-authored-by: Claire Riley <[email protected]> Signed-off-by: Zane Whitfield <[email protected]> --------- Signed-off-by: Zane Whitfield <[email protected]> Co-authored-by: Claire Riley <[email protected]>
1 parent b07e5ae commit c490fe8

File tree

1 file changed

+56
-5
lines changed

1 file changed

+56
-5
lines changed

README.md

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,6 @@ heroku config:set \
113113
IDENTITY_SCOPE=global
114114
```
115115

116-
#### Non-OIDC Providers
117-
118-
Optionally, for identity providers that don't support OIDC discovery,
119-
reference a [ServerMetadata JSON file](https://github.com/panva/openid-client/blob/v6.x/docs/interfaces/ServerMetadata.md) that contains the `"issuer"`, `"authorization_endpoint"`, `"token_endpoint"`, and `"scopes_supported"` fields.
120-
121116
### Deployment
122117

123118
Your Heroku app is now ready to deploy. Start a new deployment for the app in your [Heroku Dashboard](https://dashboard.heroku.com/).
@@ -126,6 +121,62 @@ Your Heroku app is now ready to deploy. Start a new deployment for the app in yo
126121

127122
Install the [Remote MCP Auth Proxy Buildpack](https://github.com/heroku/heroku-buildpack-mcp-auth-proxy) to deploy this repository as a buildpack alongside a remote MCP server.
128123

124+
## Using the OAuth Provider Adapter Library
125+
126+
Use the [OAuth Provider Adapter Library](https://github.com/heroku/oauth-provider-adapters-for-mcp) to implement the authorization flow for a remote MCP server. The OAuth Provider Adapter Library ensures your authorization implementation is consistent, and includes robust logging and validation features.
127+
128+
We recommend using OIDC discovery. If OIDC discovery isn't possible in your environment, configure static metadata using the adapter library. The adapter supports pointing `IDENTITY_SERVER_METADATA_FILE` to a JSON file that includes fields like `"issuer"`, `"authorization_endpoint"`, `"token_endpoint"`, and `"jwks_uri"`. This auth proxy no longer supports static OpenID Provider metadata directly.
129+
130+
### Install in Remote Server
131+
132+
- npm:
133+
134+
```bash
135+
npm install @heroku/oauth-provider-adapters-for-mcp
136+
```
137+
138+
- pnpm:
139+
140+
```bash
141+
pnpm add @heroku/oauth-provider-adapters-for-mcp
142+
```
143+
144+
### Configure with Environment Variables
145+
146+
The adapter supports discovery or static metadata:
147+
148+
- `IDENTITY_CLIENT_ID`: OAuth client ID
149+
- `IDENTITY_CLIENT_SECRET`: OAuth client secret
150+
- `IDENTITY_SERVER_URL`: Issuer URL (for OIDC discovery)
151+
- `IDENTITY_REDIRECT_URI`: Redirect URI registered with your IdP
152+
- `IDENTITY_SCOPE`: Space or comma separated scopes (for example, `openid profile email offline_access`)
153+
- `IDENTITY_SERVER_METADATA_FILE`: Absolute path to JSON with static metadata (adapter-only)
154+
155+
> Note: Static metadata is handled by the adapter library, not by this proxy.
156+
157+
### Usage with Discovery (Recommended)
158+
159+
```ts
160+
import { fromEnvironmentAsync } from '@heroku/oauth-provider-adapters-for-mcp';
161+
162+
// Provide a durable storageHook in production to store PKCE state between steps
163+
const oidc = await fromEnvironmentAsync({
164+
env: process.env,
165+
storageHook, // for example, Redis or your DB
166+
});
167+
168+
await oidc.initialize();
169+
170+
// Begin the login flow
171+
const state = crypto.randomUUID();
172+
const authUrl = await oidc.generateAuthUrl(state, process.env.IDENTITY_REDIRECT_URI!);
173+
// Redirect the user to authUrl
174+
175+
// Handle callback
176+
const tokens = await oidc.exchangeCode(code, codeVerifier, process.env.IDENTITY_REDIRECT_URI!);
177+
// Optionally refresh later
178+
// const refreshed = await oidc.refreshToken(tokens.refreshToken!);
179+
```
129180
# Development
130181

131182
* Use the [JSON Web Key Generator](https://github.com/rakutentech/jwkgen) to generate [jwks](https://github.com/panva/node-oidc-provider/tree/main/docs#jwks).

0 commit comments

Comments
 (0)