wip
This commit is contained in:
parent
c990df469f
commit
207fc8692e
5 changed files with 21 additions and 14 deletions
10
package.json
10
package.json
|
|
@ -8,6 +8,11 @@
|
||||||
"LICENSE"
|
"LICENSE"
|
||||||
],
|
],
|
||||||
"exports": {
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"require": "./dist/index.js",
|
||||||
|
"import": "./dist/index.js"
|
||||||
|
},
|
||||||
"./react": {
|
"./react": {
|
||||||
"types": "./dist/react/index.d.ts",
|
"types": "./dist/react/index.d.ts",
|
||||||
"require": "./dist/react/index.js",
|
"require": "./dist/react/index.js",
|
||||||
|
|
@ -20,7 +25,7 @@
|
||||||
"check": "prettier --check . && tsc"
|
"check": "prettier --check . && tsc"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@modelcontextprotocol/sdk": "^1.7.0"
|
"@modelcontextprotocol/sdk": "^1.11.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react": "^19.0.12",
|
"@types/react": "^19.0.12",
|
||||||
|
|
@ -32,8 +37,7 @@
|
||||||
},
|
},
|
||||||
"tsup": {
|
"tsup": {
|
||||||
"entry": [
|
"entry": [
|
||||||
"src/cli/client.ts",
|
"src/index.ts",
|
||||||
"src/cli/proxy.ts",
|
|
||||||
"src/react/index.ts"
|
"src/react/index.ts"
|
||||||
],
|
],
|
||||||
"format": [
|
"format": [
|
||||||
|
|
|
||||||
19
pnpm-lock.yaml
generated
19
pnpm-lock.yaml
generated
|
|
@ -9,8 +9,8 @@ importers:
|
||||||
.:
|
.:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@modelcontextprotocol/sdk':
|
'@modelcontextprotocol/sdk':
|
||||||
specifier: ^1.7.0
|
specifier: ^1.11.0
|
||||||
version: 1.7.0
|
version: 1.11.0
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@types/react':
|
'@types/react':
|
||||||
specifier: ^19.0.12
|
specifier: ^19.0.12
|
||||||
|
|
@ -205,8 +205,8 @@ packages:
|
||||||
'@jridgewell/trace-mapping@0.3.25':
|
'@jridgewell/trace-mapping@0.3.25':
|
||||||
resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==}
|
resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==}
|
||||||
|
|
||||||
'@modelcontextprotocol/sdk@1.7.0':
|
'@modelcontextprotocol/sdk@1.11.0':
|
||||||
resolution: {integrity: sha512-IYPe/FLpvF3IZrd/f5p5ffmWhMc3aEMuM2wGJASDqC2Ge7qatVCdbfPx3n/5xFeb19xN0j/911M2AaFuircsWA==}
|
resolution: {integrity: sha512-k/1pb70eD638anoi0e8wUGAlbMJXyvdV4p62Ko+EZ7eBe1xMx8Uhak1R5DgfoofsK5IBBnRwsYGTaLZl+6/+RQ==}
|
||||||
engines: {node: '>=18'}
|
engines: {node: '>=18'}
|
||||||
|
|
||||||
'@pkgjs/parseargs@0.11.0':
|
'@pkgjs/parseargs@0.11.0':
|
||||||
|
|
@ -717,8 +717,8 @@ packages:
|
||||||
resolution: {integrity: sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==}
|
resolution: {integrity: sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==}
|
||||||
engines: {node: '>= 6'}
|
engines: {node: '>= 6'}
|
||||||
|
|
||||||
pkce-challenge@4.1.0:
|
pkce-challenge@5.0.0:
|
||||||
resolution: {integrity: sha512-ZBmhE1C9LcPoH9XZSdwiPtbPHZROwAnMy+kIFQVrnMCxY4Cudlz3gBOpzilgc0jOgRaiT3sIWfpMomW2ar2orQ==}
|
resolution: {integrity: sha512-ueGLflrrnvwB3xuo/uGob5pd5FN7l0MsLf0Z87o/UQmRtwjvfylfc9MurIxRAWywCYTgrvpXBcqjV4OfCYGCIQ==}
|
||||||
engines: {node: '>=16.20.0'}
|
engines: {node: '>=16.20.0'}
|
||||||
|
|
||||||
postcss-load-config@6.0.1:
|
postcss-load-config@6.0.1:
|
||||||
|
|
@ -1072,14 +1072,15 @@ snapshots:
|
||||||
'@jridgewell/resolve-uri': 3.1.2
|
'@jridgewell/resolve-uri': 3.1.2
|
||||||
'@jridgewell/sourcemap-codec': 1.5.0
|
'@jridgewell/sourcemap-codec': 1.5.0
|
||||||
|
|
||||||
'@modelcontextprotocol/sdk@1.7.0':
|
'@modelcontextprotocol/sdk@1.11.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
content-type: 1.0.5
|
content-type: 1.0.5
|
||||||
cors: 2.8.5
|
cors: 2.8.5
|
||||||
|
cross-spawn: 7.0.6
|
||||||
eventsource: 3.0.5
|
eventsource: 3.0.5
|
||||||
express: 5.0.1
|
express: 5.0.1
|
||||||
express-rate-limit: 7.5.0(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
|
raw-body: 3.0.0
|
||||||
zod: 3.24.2
|
zod: 3.24.2
|
||||||
zod-to-json-schema: 3.24.5(zod@3.24.2)
|
zod-to-json-schema: 3.24.5(zod@3.24.2)
|
||||||
|
|
@ -1543,7 +1544,7 @@ snapshots:
|
||||||
|
|
||||||
pirates@4.0.6: {}
|
pirates@4.0.6: {}
|
||||||
|
|
||||||
pkce-challenge@4.1.0: {}
|
pkce-challenge@5.0.0: {}
|
||||||
|
|
||||||
postcss-load-config@6.0.1(tsx@4.19.3):
|
postcss-load-config@6.0.1(tsx@4.19.3):
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
|
||||||
|
|
@ -186,6 +186,7 @@ export class BrowserOAuthClientProvider implements OAuthClientProvider {
|
||||||
* @param options Configuration for the popup window.
|
* @param options Configuration for the popup window.
|
||||||
* @returns An object indicating success, whether the popup was potentially blocked, and the URL used.
|
* @returns An object indicating success, whether the popup was potentially blocked, and the URL used.
|
||||||
*/
|
*/
|
||||||
|
// @ts-ignore
|
||||||
async redirectToAuthorization(
|
async redirectToAuthorization(
|
||||||
authorizationUrl: URL,
|
authorizationUrl: URL,
|
||||||
metadata: OAuthMetadata,
|
metadata: OAuthMetadata,
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,7 @@ export async function onMcpAuthorization(
|
||||||
authorizationCode: code,
|
authorizationCode: code,
|
||||||
codeVerifier,
|
codeVerifier,
|
||||||
// redirectUrl is typically required by the token endpoint for verification
|
// 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?
|
redirectUrl: new URL('/oauth/callback', window.location.origin).toString(), // TODO: Make this configurable or get from provider instance?
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ export function useMcp(options: UseMcpOptions): UseMcpResult {
|
||||||
|
|
||||||
const addLog = useCallback(
|
const addLog = useCallback(
|
||||||
(level: UseMcpResult['log'][0]['level'], message: string, ...args: unknown[]) => {
|
(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;
|
const fullMessage = args.length > 0 ? `${message} ${args.map(arg => JSON.stringify(arg)).join(' ')}` : message;
|
||||||
console[level](`[useMcp] ${fullMessage}`);
|
console[level](`[useMcp] ${fullMessage}`);
|
||||||
|
|
@ -507,7 +507,7 @@ export function useMcp(options: UseMcpOptions): UseMcpResult {
|
||||||
addLog('debug', 'Auth callback message listener removed.');
|
addLog('debug', 'Auth callback message listener removed.');
|
||||||
clearTimeout(authTimeoutRef.current!);
|
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
|
// Effect for initial connection and auto-retry
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue