oauth-callback 1.1.0 → 1.2.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
@@ -42,12 +42,7 @@ npm install oauth-callback
42
42
  ## Quick Start
43
43
 
44
44
  ```typescript
45
- import {
46
- getAuthCode,
47
- OAuthError,
48
- browserAuth,
49
- fileStore,
50
- } from "oauth-callback";
45
+ import { getAuthCode, OAuthError } from "oauth-callback";
51
46
 
52
47
  // Simple usage
53
48
  const result = await getAuthCode(
@@ -55,8 +50,13 @@ const result = await getAuthCode(
55
50
  );
56
51
  console.log("Authorization code:", result.code);
57
52
 
58
- // MCP SDK integration
53
+ // MCP SDK integration - use specific import
54
+ import { browserAuth, fileStore } from "oauth-callback/mcp";
59
55
  const authProvider = browserAuth({ store: fileStore() });
56
+
57
+ // Or via namespace import
58
+ import { mcp } from "oauth-callback";
59
+ const authProvider = mcp.browserAuth({ store: mcp.fileStore() });
60
60
  ```
61
61
 
62
62
  ## Usage Examples
@@ -139,7 +139,7 @@ const microsoftAuth = await getAuthCode(
139
139
  The `browserAuth()` function provides a drop-in OAuth provider for the Model Context Protocol SDK:
140
140
 
141
141
  ```typescript
142
- import { browserAuth, inMemoryStore } from "oauth-callback";
142
+ import { browserAuth, inMemoryStore } from "oauth-callback/mcp";
143
143
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
144
144
  import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
145
145
 
@@ -167,7 +167,7 @@ await client.connect(transport);
167
167
  #### Token Storage Options
168
168
 
169
169
  ```typescript
170
- import { browserAuth, inMemoryStore, fileStore } from "oauth-callback";
170
+ import { browserAuth, inMemoryStore, fileStore } from "oauth-callback/mcp";
171
171
 
172
172
  // Ephemeral storage (tokens lost on restart)
173
173
  const ephemeralAuth = browserAuth({
@@ -283,7 +283,7 @@ class OAuthError extends Error {
283
283
 
284
284
  ### `browserAuth(options)`
285
285
 
286
- Creates an MCP SDK-compatible OAuth provider for browser-based flows. Handles Dynamic Client Registration (DCR), token storage, and automatic refresh.
286
+ Available from `oauth-callback/mcp`. Creates an MCP SDK-compatible OAuth provider for browser-based flows. Handles Dynamic Client Registration (DCR), token storage, and automatic refresh.
287
287
 
288
288
  #### Parameters
289
289
 
@@ -307,7 +307,7 @@ OAuthClientProvider compatible with MCP SDK transports.
307
307
 
308
308
  ### `inMemoryStore()`
309
309
 
310
- Creates an ephemeral in-memory token store. Tokens are lost when the process exits.
310
+ Available from `oauth-callback/mcp`. Creates an ephemeral in-memory token store. Tokens are lost when the process exits.
311
311
 
312
312
  #### Returns
313
313
 
@@ -315,7 +315,7 @@ TokenStore implementation for temporary token storage.
315
315
 
316
316
  ### `fileStore(filepath?)`
317
317
 
318
- Creates a persistent file-based token store.
318
+ Available from `oauth-callback/mcp`. Creates a persistent file-based token store.
319
319
 
320
320
  #### Parameters
321
321
 
@@ -413,6 +413,9 @@ bun test
413
413
  # Build
414
414
  bun run build
415
415
 
416
+ # Run documentation locally
417
+ bun run docs:dev # Start VitePress dev server at http://localhost:5173
418
+
416
419
  # Run examples
417
420
  bun run example:demo # Interactive demo
418
421
  bun run example:github # GitHub OAuth example
package/dist/index.d.ts CHANGED
@@ -3,10 +3,10 @@ import type { GetAuthCodeOptions } from "./types";
3
3
  export type { CallbackResult, CallbackServer, ServerOptions } from "./server";
4
4
  export { OAuthError } from "./errors";
5
5
  export type { GetAuthCodeOptions } from "./types";
6
- export { browserAuth } from "./auth/browser-auth";
7
6
  export { inMemoryStore } from "./storage/memory";
8
7
  export { fileStore } from "./storage/file";
9
- export type { BrowserAuthOptions, Tokens, TokenStore } from "./mcp-types";
8
+ import * as mcp from "./mcp";
9
+ export { mcp };
10
10
  /**
11
11
  * Captures OAuth authorization code via localhost callback.
12
12
  * Opens browser to auth URL, waits for provider redirect to localhost.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":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