This commit is contained in:
Glen Maddern 2025-05-05 17:01:50 +10:00
commit 207fc8692e
5 changed files with 21 additions and 14 deletions

View file

@ -8,6 +8,11 @@
"LICENSE"
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"require": "./dist/index.js",
"import": "./dist/index.js"
},
"./react": {
"types": "./dist/react/index.d.ts",
"require": "./dist/react/index.js",
@ -20,7 +25,7 @@
"check": "prettier --check . && tsc"
},
"dependencies": {
"@modelcontextprotocol/sdk": "^1.7.0"
"@modelcontextprotocol/sdk": "^1.11.0"
},
"devDependencies": {
"@types/react": "^19.0.12",
@ -32,8 +37,7 @@
},
"tsup": {
"entry": [
"src/cli/client.ts",
"src/cli/proxy.ts",
"src/index.ts",
"src/react/index.ts"
],
"format": [

19
pnpm-lock.yaml generated
View file

@ -9,8 +9,8 @@ importers:
.:
dependencies:
'@modelcontextprotocol/sdk':
specifier: ^1.7.0
version: 1.7.0
specifier: ^1.11.0
version: 1.11.0
devDependencies:
'@types/react':
specifier: ^19.0.12
@ -205,8 +205,8 @@ packages:
'@jridgewell/trace-mapping@0.3.25':
resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==}
'@modelcontextprotocol/sdk@1.7.0':
resolution: {integrity: sha512-IYPe/FLpvF3IZrd/f5p5ffmWhMc3aEMuM2wGJASDqC2Ge7qatVCdbfPx3n/5xFeb19xN0j/911M2AaFuircsWA==}
'@modelcontextprotocol/sdk@1.11.0':
resolution: {integrity: sha512-k/1pb70eD638anoi0e8wUGAlbMJXyvdV4p62Ko+EZ7eBe1xMx8Uhak1R5DgfoofsK5IBBnRwsYGTaLZl+6/+RQ==}
engines: {node: '>=18'}
'@pkgjs/parseargs@0.11.0':
@ -717,8 +717,8 @@ packages:
resolution: {integrity: sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==}
engines: {node: '>= 6'}
pkce-challenge@4.1.0:
resolution: {integrity: sha512-ZBmhE1C9LcPoH9XZSdwiPtbPHZROwAnMy+kIFQVrnMCxY4Cudlz3gBOpzilgc0jOgRaiT3sIWfpMomW2ar2orQ==}
pkce-challenge@5.0.0:
resolution: {integrity: sha512-ueGLflrrnvwB3xuo/uGob5pd5FN7l0MsLf0Z87o/UQmRtwjvfylfc9MurIxRAWywCYTgrvpXBcqjV4OfCYGCIQ==}
engines: {node: '>=16.20.0'}
postcss-load-config@6.0.1:
@ -1072,14 +1072,15 @@ snapshots:
'@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.5.0
'@modelcontextprotocol/sdk@1.7.0':
'@modelcontextprotocol/sdk@1.11.0':
dependencies:
content-type: 1.0.5
cors: 2.8.5
cross-spawn: 7.0.6
eventsource: 3.0.5
express: 5.0.1
express-rate-limit: 7.5.0(express@5.0.1)
pkce-challenge: 4.1.0
pkce-challenge: 5.0.0
raw-body: 3.0.0
zod: 3.24.2
zod-to-json-schema: 3.24.5(zod@3.24.2)
@ -1543,7 +1544,7 @@ snapshots:
pirates@4.0.6: {}
pkce-challenge@4.1.0: {}
pkce-challenge@5.0.0: {}
postcss-load-config@6.0.1(tsx@4.19.3):
dependencies:

View file

@ -186,6 +186,7 @@ export class BrowserOAuthClientProvider implements OAuthClientProvider {
* @param options Configuration for the popup window.
* @returns An object indicating success, whether the popup was potentially blocked, and the URL used.
*/
// @ts-ignore
async redirectToAuthorization(
authorizationUrl: URL,
metadata: OAuthMetadata,

View file

@ -103,6 +103,7 @@ export async function onMcpAuthorization(
authorizationCode: code,
codeVerifier,
// redirectUrl is typically required by the token endpoint for verification
// @ts-ignore
redirectUrl: new URL('/oauth/callback', window.location.origin).toString(), // TODO: Make this configurable or get from provider instance?
});

View file

@ -53,7 +53,7 @@ export function useMcp(options: UseMcpOptions): UseMcpResult {
const addLog = useCallback(
(level: UseMcpResult['log'][0]['level'], message: string, ...args: unknown[]) => {
if (level === 'debug' && !debug) return;
// if (level === 'debug' && !debug) return;
const fullMessage = args.length > 0 ? `${message} ${args.map(arg => JSON.stringify(arg)).join(' ')}` : message;
console[level](`[useMcp] ${fullMessage}`);
@ -507,7 +507,7 @@ export function useMcp(options: UseMcpOptions): UseMcpResult {
addLog('debug', 'Auth callback message listener removed.');
clearTimeout(authTimeoutRef.current!);
};
}, [addLog, failConnection, disconnect, connect]); // Dependencies: functions that handle success/failure
}, [addLog, failConnection, disconnect, connect, authTimeoutRef, isMountedRef]); // Dependencies: functions that handle success/failure
// Effect for initial connection and auto-retry
useEffect(() => {