@imenam/mcp-http-gateway 2.0.6 → 2.0.7
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/auth.js +6 -2
- package/package.json +1 -1
package/auth.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createRemoteJWKSet, jwtVerify } from 'jose';
|
|
2
|
+
import { InvalidTokenError } from '@modelcontextprotocol/sdk/server/auth/errors.js';
|
|
2
3
|
|
|
3
4
|
const OAUTH_ENABLED = process.env.MCP_OAUTH_ENABLED === 'true';
|
|
4
5
|
|
|
@@ -19,8 +20,11 @@ export function createMcpTokenVerifier() {
|
|
|
19
20
|
audience: process.env.MCP_PUBLIC_URL,
|
|
20
21
|
}));
|
|
21
22
|
} catch (err) {
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
const ts = new Date().toISOString();
|
|
24
|
+
console.error(`[auth] ${ts} jwtVerify FAILED:`, err.code ?? err.constructor.name, err.message);
|
|
25
|
+
throw new InvalidTokenError(
|
|
26
|
+
err.code === 'ERR_JWT_EXPIRED' ? 'Token has expired' : 'Invalid token'
|
|
27
|
+
);
|
|
24
28
|
}
|
|
25
29
|
return {
|
|
26
30
|
token,
|
package/package.json
CHANGED