tiny-http-mcp-server 0.1.1 → 0.1.3
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/dist/composition.json +6 -1
- package/dist/express-middleware.d.ts +1 -1
- package/dist/express-middleware.js +9 -10
- package/dist/http-server.d.ts +1 -0
- package/dist/http-server.js +1 -0
- package/dist/server.d.ts +9 -0
- package/dist/server.js +4 -0
- package/node_modules/auth-store/package.json +0 -2
- package/node_modules/jose/LICENSE.md +21 -0
- package/node_modules/jose/README.md +153 -0
- package/node_modules/jose/dist/types/index.d.ts +55 -0
- package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +31 -0
- package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +65 -0
- package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +31 -0
- package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +83 -0
- package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +38 -0
- package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +74 -0
- package/node_modules/jose/dist/types/jwk/embedded.d.ts +17 -0
- package/node_modules/jose/dist/types/jwk/thumbprint.d.ts +32 -0
- package/node_modules/jose/dist/types/jwks/local.d.ts +29 -0
- package/node_modules/jose/dist/types/jwks/remote.d.ts +237 -0
- package/node_modules/jose/dist/types/jws/compact/sign.d.ts +36 -0
- package/node_modules/jose/dist/types/jws/compact/verify.d.ts +33 -0
- package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +42 -0
- package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +33 -0
- package/node_modules/jose/dist/types/jws/general/sign.d.ts +53 -0
- package/node_modules/jose/dist/types/jws/general/verify.d.ts +41 -0
- package/node_modules/jose/dist/types/jwt/decrypt.d.ts +35 -0
- package/node_modules/jose/dist/types/jwt/encrypt.d.ts +91 -0
- package/node_modules/jose/dist/types/jwt/sign.d.ts +43 -0
- package/node_modules/jose/dist/types/jwt/unsecured.d.ts +43 -0
- package/node_modules/jose/dist/types/jwt/verify.d.ts +37 -0
- package/node_modules/jose/dist/types/key/export.d.ts +33 -0
- package/node_modules/jose/dist/types/key/generate_key_pair.d.ts +47 -0
- package/node_modules/jose/dist/types/key/generate_secret.d.ts +35 -0
- package/node_modules/jose/dist/types/key/import.d.ts +83 -0
- package/node_modules/jose/dist/types/types.d.ts +852 -0
- package/node_modules/jose/dist/types/util/base64url.d.ts +9 -0
- package/node_modules/jose/dist/types/util/decode_jwt.d.ts +18 -0
- package/node_modules/jose/dist/types/util/decode_protected_header.d.ts +17 -0
- package/node_modules/jose/dist/types/util/errors.d.ts +213 -0
- package/node_modules/jose/dist/webapi/index.js +32 -0
- package/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +27 -0
- package/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +27 -0
- package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +159 -0
- package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +167 -0
- package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +31 -0
- package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +182 -0
- package/node_modules/jose/dist/webapi/jwk/embedded.js +17 -0
- package/node_modules/jose/dist/webapi/jwk/thumbprint.js +68 -0
- package/node_modules/jose/dist/webapi/jwks/local.js +119 -0
- package/node_modules/jose/dist/webapi/jwks/remote.js +179 -0
- package/node_modules/jose/dist/webapi/jws/compact/sign.js +18 -0
- package/node_modules/jose/dist/webapi/jws/compact/verify.js +21 -0
- package/node_modules/jose/dist/webapi/jws/flattened/sign.js +89 -0
- package/node_modules/jose/dist/webapi/jws/flattened/verify.js +110 -0
- package/node_modules/jose/dist/webapi/jws/general/sign.js +70 -0
- package/node_modules/jose/dist/webapi/jws/general/verify.js +24 -0
- package/node_modules/jose/dist/webapi/jwt/decrypt.js +23 -0
- package/node_modules/jose/dist/webapi/jwt/encrypt.js +101 -0
- package/node_modules/jose/dist/webapi/jwt/sign.js +52 -0
- package/node_modules/jose/dist/webapi/jwt/unsecured.js +63 -0
- package/node_modules/jose/dist/webapi/jwt/verify.js +15 -0
- package/node_modules/jose/dist/webapi/key/export.js +11 -0
- package/node_modules/jose/dist/webapi/key/generate_key_pair.js +97 -0
- package/node_modules/jose/dist/webapi/key/generate_secret.js +40 -0
- package/node_modules/jose/dist/webapi/key/import.js +57 -0
- package/node_modules/jose/dist/webapi/lib/aesgcmkw.js +15 -0
- package/node_modules/jose/dist/webapi/lib/aeskw.js +25 -0
- package/node_modules/jose/dist/webapi/lib/asn1.js +243 -0
- package/node_modules/jose/dist/webapi/lib/base64.js +22 -0
- package/node_modules/jose/dist/webapi/lib/buffer_utils.js +43 -0
- package/node_modules/jose/dist/webapi/lib/check_key_type.js +122 -0
- package/node_modules/jose/dist/webapi/lib/content_encryption.js +217 -0
- package/node_modules/jose/dist/webapi/lib/crypto_key.js +136 -0
- package/node_modules/jose/dist/webapi/lib/deflate.js +44 -0
- package/node_modules/jose/dist/webapi/lib/ecdhes.js +52 -0
- package/node_modules/jose/dist/webapi/lib/helpers.js +19 -0
- package/node_modules/jose/dist/webapi/lib/invalid_key_input.js +27 -0
- package/node_modules/jose/dist/webapi/lib/is_key_like.js +17 -0
- package/node_modules/jose/dist/webapi/lib/jwk_to_key.js +107 -0
- package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +238 -0
- package/node_modules/jose/dist/webapi/lib/key_management.js +186 -0
- package/node_modules/jose/dist/webapi/lib/key_to_jwk.js +31 -0
- package/node_modules/jose/dist/webapi/lib/normalize_key.js +166 -0
- package/node_modules/jose/dist/webapi/lib/pbes2kw.js +42 -0
- package/node_modules/jose/dist/webapi/lib/rsaes.js +24 -0
- package/node_modules/jose/dist/webapi/lib/signing.js +68 -0
- package/node_modules/jose/dist/webapi/lib/type_checks.js +40 -0
- package/node_modules/jose/dist/webapi/lib/validate_algorithms.js +10 -0
- package/node_modules/jose/dist/webapi/lib/validate_crit.js +33 -0
- package/node_modules/jose/dist/webapi/util/base64url.js +30 -0
- package/node_modules/jose/dist/webapi/util/decode_jwt.js +32 -0
- package/node_modules/jose/dist/webapi/util/decode_protected_header.js +34 -0
- package/node_modules/jose/dist/webapi/util/errors.js +99 -0
- package/node_modules/jose/package.json +200 -0
- package/node_modules/mcp-oauth/package.json +0 -5
- package/node_modules/tiny-mcp-client/package.json +0 -2
- package/package.json +11 -6
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { JOSENotSupported } from '../util/errors.js';
|
|
2
|
+
import { checkSigCryptoKey } from './crypto_key.js';
|
|
3
|
+
import { invalidKeyInput } from './invalid_key_input.js';
|
|
4
|
+
export function checkKeyLength(alg, key) {
|
|
5
|
+
if (alg.startsWith('RS') || alg.startsWith('PS')) {
|
|
6
|
+
const { modulusLength } = key.algorithm;
|
|
7
|
+
if (typeof modulusLength !== 'number' || modulusLength < 2048) {
|
|
8
|
+
throw new TypeError(`${alg} requires key modulusLength to be 2048 bits or larger`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function subtleAlgorithm(alg, algorithm) {
|
|
13
|
+
const hash = `SHA-${alg.slice(-3)}`;
|
|
14
|
+
switch (alg) {
|
|
15
|
+
case 'HS256':
|
|
16
|
+
case 'HS384':
|
|
17
|
+
case 'HS512':
|
|
18
|
+
return { hash, name: 'HMAC' };
|
|
19
|
+
case 'PS256':
|
|
20
|
+
case 'PS384':
|
|
21
|
+
case 'PS512':
|
|
22
|
+
return { hash, name: 'RSA-PSS', saltLength: parseInt(alg.slice(-3), 10) >> 3 };
|
|
23
|
+
case 'RS256':
|
|
24
|
+
case 'RS384':
|
|
25
|
+
case 'RS512':
|
|
26
|
+
return { hash, name: 'RSASSA-PKCS1-v1_5' };
|
|
27
|
+
case 'ES256':
|
|
28
|
+
case 'ES384':
|
|
29
|
+
case 'ES512':
|
|
30
|
+
return { hash, name: 'ECDSA', namedCurve: algorithm.namedCurve };
|
|
31
|
+
case 'Ed25519':
|
|
32
|
+
case 'EdDSA':
|
|
33
|
+
return { name: 'Ed25519' };
|
|
34
|
+
case 'ML-DSA-44':
|
|
35
|
+
case 'ML-DSA-65':
|
|
36
|
+
case 'ML-DSA-87':
|
|
37
|
+
return { name: alg };
|
|
38
|
+
default:
|
|
39
|
+
throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async function getSigKey(alg, key, usage) {
|
|
43
|
+
if (key instanceof Uint8Array) {
|
|
44
|
+
if (!alg.startsWith('HS')) {
|
|
45
|
+
throw new TypeError(invalidKeyInput(key, 'CryptoKey', 'KeyObject', 'JSON Web Key'));
|
|
46
|
+
}
|
|
47
|
+
return crypto.subtle.importKey('raw', key, { hash: `SHA-${alg.slice(-3)}`, name: 'HMAC' }, false, [usage]);
|
|
48
|
+
}
|
|
49
|
+
checkSigCryptoKey(key, alg, usage);
|
|
50
|
+
return key;
|
|
51
|
+
}
|
|
52
|
+
export async function sign(alg, key, data) {
|
|
53
|
+
const cryptoKey = await getSigKey(alg, key, 'sign');
|
|
54
|
+
checkKeyLength(alg, cryptoKey);
|
|
55
|
+
const signature = await crypto.subtle.sign(subtleAlgorithm(alg, cryptoKey.algorithm), cryptoKey, data);
|
|
56
|
+
return new Uint8Array(signature);
|
|
57
|
+
}
|
|
58
|
+
export async function verify(alg, key, signature, data) {
|
|
59
|
+
const cryptoKey = await getSigKey(alg, key, 'verify');
|
|
60
|
+
checkKeyLength(alg, cryptoKey);
|
|
61
|
+
const algorithm = subtleAlgorithm(alg, cryptoKey.algorithm);
|
|
62
|
+
try {
|
|
63
|
+
return await crypto.subtle.verify(algorithm, cryptoKey, signature, data);
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const isObjectLike = (value) => typeof value === 'object' && value !== null;
|
|
2
|
+
export function isObject(input) {
|
|
3
|
+
if (!isObjectLike(input) || Object.prototype.toString.call(input) !== '[object Object]') {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
if (Object.getPrototypeOf(input) === null) {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
let proto = input;
|
|
10
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
11
|
+
proto = Object.getPrototypeOf(proto);
|
|
12
|
+
}
|
|
13
|
+
return Object.getPrototypeOf(input) === proto;
|
|
14
|
+
}
|
|
15
|
+
export function isDisjoint(...headers) {
|
|
16
|
+
const sources = headers.filter(Boolean);
|
|
17
|
+
if (sources.length === 0 || sources.length === 1) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
let acc;
|
|
21
|
+
for (const header of sources) {
|
|
22
|
+
const parameters = Object.keys(header);
|
|
23
|
+
if (!acc || acc.size === 0) {
|
|
24
|
+
acc = new Set(parameters);
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
for (const parameter of parameters) {
|
|
28
|
+
if (acc.has(parameter)) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
acc.add(parameter);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
export const isJWK = (key) => isObject(key) && typeof key.kty === 'string';
|
|
37
|
+
export const isPrivateJWK = (key) => key.kty !== 'oct' &&
|
|
38
|
+
((key.kty === 'AKP' && typeof key.priv === 'string') || typeof key.d === 'string');
|
|
39
|
+
export const isPublicJWK = (key) => key.kty !== 'oct' && key.d === undefined && key.priv === undefined;
|
|
40
|
+
export const isSecretJWK = (key) => key.kty === 'oct' && typeof key.k === 'string';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function validateAlgorithms(option, algorithms) {
|
|
2
|
+
if (algorithms !== undefined &&
|
|
3
|
+
(!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== 'string'))) {
|
|
4
|
+
throw new TypeError(`"${option}" option must be an array of strings`);
|
|
5
|
+
}
|
|
6
|
+
if (!algorithms) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
return new Set(algorithms);
|
|
10
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { JOSENotSupported, JWEInvalid, JWSInvalid } from '../util/errors.js';
|
|
2
|
+
export function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
|
|
3
|
+
if (joseHeader.crit !== undefined && protectedHeader?.crit === undefined) {
|
|
4
|
+
throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
5
|
+
}
|
|
6
|
+
if (!protectedHeader || protectedHeader.crit === undefined) {
|
|
7
|
+
return new Set();
|
|
8
|
+
}
|
|
9
|
+
if (!Array.isArray(protectedHeader.crit) ||
|
|
10
|
+
protectedHeader.crit.length === 0 ||
|
|
11
|
+
protectedHeader.crit.some((input) => typeof input !== 'string' || input.length === 0)) {
|
|
12
|
+
throw new Err('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
|
|
13
|
+
}
|
|
14
|
+
let recognized;
|
|
15
|
+
if (recognizedOption !== undefined) {
|
|
16
|
+
recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
recognized = recognizedDefault;
|
|
20
|
+
}
|
|
21
|
+
for (const parameter of protectedHeader.crit) {
|
|
22
|
+
if (!recognized.has(parameter)) {
|
|
23
|
+
throw new JOSENotSupported(`Extension Header Parameter "${parameter}" is not recognized`);
|
|
24
|
+
}
|
|
25
|
+
if (joseHeader[parameter] === undefined) {
|
|
26
|
+
throw new Err(`Extension Header Parameter "${parameter}" is missing`);
|
|
27
|
+
}
|
|
28
|
+
if (recognized.get(parameter) && protectedHeader[parameter] === undefined) {
|
|
29
|
+
throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return new Set(protectedHeader.crit);
|
|
33
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { encoder, decoder } from '../lib/buffer_utils.js';
|
|
2
|
+
import { encodeBase64, decodeBase64 } from '../lib/base64.js';
|
|
3
|
+
export function decode(input) {
|
|
4
|
+
if (Uint8Array.fromBase64) {
|
|
5
|
+
return Uint8Array.fromBase64(typeof input === 'string' ? input : decoder.decode(input), {
|
|
6
|
+
alphabet: 'base64url',
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
let encoded = input;
|
|
10
|
+
if (encoded instanceof Uint8Array) {
|
|
11
|
+
encoded = decoder.decode(encoded);
|
|
12
|
+
}
|
|
13
|
+
encoded = encoded.replace(/-/g, '+').replace(/_/g, '/');
|
|
14
|
+
try {
|
|
15
|
+
return decodeBase64(encoded);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
throw new TypeError('The input to be decoded is not correctly encoded.');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function encode(input) {
|
|
22
|
+
let unencoded = input;
|
|
23
|
+
if (typeof unencoded === 'string') {
|
|
24
|
+
unencoded = encoder.encode(unencoded);
|
|
25
|
+
}
|
|
26
|
+
if (Uint8Array.prototype.toBase64) {
|
|
27
|
+
return unencoded.toBase64({ alphabet: 'base64url', omitPadding: true });
|
|
28
|
+
}
|
|
29
|
+
return encodeBase64(unencoded).replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
|
|
30
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { decode as b64u } from './base64url.js';
|
|
2
|
+
import { decoder } from '../lib/buffer_utils.js';
|
|
3
|
+
import { isObject } from '../lib/type_checks.js';
|
|
4
|
+
import { JWTInvalid } from './errors.js';
|
|
5
|
+
export function decodeJwt(jwt) {
|
|
6
|
+
if (typeof jwt !== 'string')
|
|
7
|
+
throw new JWTInvalid('JWTs must use Compact JWS serialization, JWT must be a string');
|
|
8
|
+
const { 1: payload, length } = jwt.split('.');
|
|
9
|
+
if (length === 5)
|
|
10
|
+
throw new JWTInvalid('Only JWTs using Compact JWS serialization can be decoded');
|
|
11
|
+
if (length !== 3)
|
|
12
|
+
throw new JWTInvalid('Invalid JWT');
|
|
13
|
+
if (!payload)
|
|
14
|
+
throw new JWTInvalid('JWTs must contain a payload');
|
|
15
|
+
let decoded;
|
|
16
|
+
try {
|
|
17
|
+
decoded = b64u(payload);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
throw new JWTInvalid('Failed to base64url decode the payload');
|
|
21
|
+
}
|
|
22
|
+
let result;
|
|
23
|
+
try {
|
|
24
|
+
result = JSON.parse(decoder.decode(decoded));
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
throw new JWTInvalid('Failed to parse the decoded payload as JSON');
|
|
28
|
+
}
|
|
29
|
+
if (!isObject(result))
|
|
30
|
+
throw new JWTInvalid('Invalid JWT Claims Set');
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { decode as b64u } from './base64url.js';
|
|
2
|
+
import { decoder } from '../lib/buffer_utils.js';
|
|
3
|
+
import { isObject } from '../lib/type_checks.js';
|
|
4
|
+
export function decodeProtectedHeader(token) {
|
|
5
|
+
let protectedB64u;
|
|
6
|
+
if (typeof token === 'string') {
|
|
7
|
+
const parts = token.split('.');
|
|
8
|
+
if (parts.length === 3 || parts.length === 5) {
|
|
9
|
+
;
|
|
10
|
+
[protectedB64u] = parts;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
else if (typeof token === 'object' && token) {
|
|
14
|
+
if ('protected' in token) {
|
|
15
|
+
protectedB64u = token.protected;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
throw new TypeError('Token does not contain a Protected Header');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
if (typeof protectedB64u !== 'string' || !protectedB64u) {
|
|
23
|
+
throw new Error();
|
|
24
|
+
}
|
|
25
|
+
const result = JSON.parse(decoder.decode(b64u(protectedB64u)));
|
|
26
|
+
if (!isObject(result)) {
|
|
27
|
+
throw new Error();
|
|
28
|
+
}
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
throw new TypeError('Invalid Token or Protected Header formatting');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export class JOSEError extends Error {
|
|
2
|
+
static code = 'ERR_JOSE_GENERIC';
|
|
3
|
+
code = 'ERR_JOSE_GENERIC';
|
|
4
|
+
constructor(message, options) {
|
|
5
|
+
super(message, options);
|
|
6
|
+
this.name = this.constructor.name;
|
|
7
|
+
Error.captureStackTrace?.(this, this.constructor);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export class JWTClaimValidationFailed extends JOSEError {
|
|
11
|
+
static code = 'ERR_JWT_CLAIM_VALIDATION_FAILED';
|
|
12
|
+
code = 'ERR_JWT_CLAIM_VALIDATION_FAILED';
|
|
13
|
+
claim;
|
|
14
|
+
reason;
|
|
15
|
+
payload;
|
|
16
|
+
constructor(message, payload, claim = 'unspecified', reason = 'unspecified') {
|
|
17
|
+
super(message, { cause: { claim, reason, payload } });
|
|
18
|
+
this.claim = claim;
|
|
19
|
+
this.reason = reason;
|
|
20
|
+
this.payload = payload;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export class JWTExpired extends JOSEError {
|
|
24
|
+
static code = 'ERR_JWT_EXPIRED';
|
|
25
|
+
code = 'ERR_JWT_EXPIRED';
|
|
26
|
+
claim;
|
|
27
|
+
reason;
|
|
28
|
+
payload;
|
|
29
|
+
constructor(message, payload, claim = 'unspecified', reason = 'unspecified') {
|
|
30
|
+
super(message, { cause: { claim, reason, payload } });
|
|
31
|
+
this.claim = claim;
|
|
32
|
+
this.reason = reason;
|
|
33
|
+
this.payload = payload;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export class JOSEAlgNotAllowed extends JOSEError {
|
|
37
|
+
static code = 'ERR_JOSE_ALG_NOT_ALLOWED';
|
|
38
|
+
code = 'ERR_JOSE_ALG_NOT_ALLOWED';
|
|
39
|
+
}
|
|
40
|
+
export class JOSENotSupported extends JOSEError {
|
|
41
|
+
static code = 'ERR_JOSE_NOT_SUPPORTED';
|
|
42
|
+
code = 'ERR_JOSE_NOT_SUPPORTED';
|
|
43
|
+
}
|
|
44
|
+
export class JWEDecryptionFailed extends JOSEError {
|
|
45
|
+
static code = 'ERR_JWE_DECRYPTION_FAILED';
|
|
46
|
+
code = 'ERR_JWE_DECRYPTION_FAILED';
|
|
47
|
+
constructor(message = 'decryption operation failed', options) {
|
|
48
|
+
super(message, options);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export class JWEInvalid extends JOSEError {
|
|
52
|
+
static code = 'ERR_JWE_INVALID';
|
|
53
|
+
code = 'ERR_JWE_INVALID';
|
|
54
|
+
}
|
|
55
|
+
export class JWSInvalid extends JOSEError {
|
|
56
|
+
static code = 'ERR_JWS_INVALID';
|
|
57
|
+
code = 'ERR_JWS_INVALID';
|
|
58
|
+
}
|
|
59
|
+
export class JWTInvalid extends JOSEError {
|
|
60
|
+
static code = 'ERR_JWT_INVALID';
|
|
61
|
+
code = 'ERR_JWT_INVALID';
|
|
62
|
+
}
|
|
63
|
+
export class JWKInvalid extends JOSEError {
|
|
64
|
+
static code = 'ERR_JWK_INVALID';
|
|
65
|
+
code = 'ERR_JWK_INVALID';
|
|
66
|
+
}
|
|
67
|
+
export class JWKSInvalid extends JOSEError {
|
|
68
|
+
static code = 'ERR_JWKS_INVALID';
|
|
69
|
+
code = 'ERR_JWKS_INVALID';
|
|
70
|
+
}
|
|
71
|
+
export class JWKSNoMatchingKey extends JOSEError {
|
|
72
|
+
static code = 'ERR_JWKS_NO_MATCHING_KEY';
|
|
73
|
+
code = 'ERR_JWKS_NO_MATCHING_KEY';
|
|
74
|
+
constructor(message = 'no applicable key found in the JSON Web Key Set', options) {
|
|
75
|
+
super(message, options);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export class JWKSMultipleMatchingKeys extends JOSEError {
|
|
79
|
+
[Symbol.asyncIterator];
|
|
80
|
+
static code = 'ERR_JWKS_MULTIPLE_MATCHING_KEYS';
|
|
81
|
+
code = 'ERR_JWKS_MULTIPLE_MATCHING_KEYS';
|
|
82
|
+
constructor(message = 'multiple matching keys found in the JSON Web Key Set', options) {
|
|
83
|
+
super(message, options);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export class JWKSTimeout extends JOSEError {
|
|
87
|
+
static code = 'ERR_JWKS_TIMEOUT';
|
|
88
|
+
code = 'ERR_JWKS_TIMEOUT';
|
|
89
|
+
constructor(message = 'request timed out', options) {
|
|
90
|
+
super(message, options);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
export class JWSSignatureVerificationFailed extends JOSEError {
|
|
94
|
+
static code = 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED';
|
|
95
|
+
code = 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED';
|
|
96
|
+
constructor(message = 'signature verification failed', options) {
|
|
97
|
+
super(message, options);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jose",
|
|
3
|
+
"version": "6.2.3",
|
|
4
|
+
"description": "JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"akp",
|
|
7
|
+
"browser",
|
|
8
|
+
"bun",
|
|
9
|
+
"cloudflare",
|
|
10
|
+
"compact",
|
|
11
|
+
"decode",
|
|
12
|
+
"decrypt",
|
|
13
|
+
"deno",
|
|
14
|
+
"detached",
|
|
15
|
+
"ec",
|
|
16
|
+
"ecdsa",
|
|
17
|
+
"ed25519",
|
|
18
|
+
"eddsa",
|
|
19
|
+
"edge",
|
|
20
|
+
"electron",
|
|
21
|
+
"embedded",
|
|
22
|
+
"encrypt",
|
|
23
|
+
"flattened",
|
|
24
|
+
"general",
|
|
25
|
+
"jose",
|
|
26
|
+
"json web token",
|
|
27
|
+
"jsonwebtoken",
|
|
28
|
+
"jwa",
|
|
29
|
+
"jwe",
|
|
30
|
+
"jwk",
|
|
31
|
+
"jwks",
|
|
32
|
+
"jws",
|
|
33
|
+
"jwt-decode",
|
|
34
|
+
"jwt",
|
|
35
|
+
"ml-dsa",
|
|
36
|
+
"netlify",
|
|
37
|
+
"next",
|
|
38
|
+
"nextjs",
|
|
39
|
+
"oct",
|
|
40
|
+
"okp",
|
|
41
|
+
"payload",
|
|
42
|
+
"pem",
|
|
43
|
+
"pkcs8",
|
|
44
|
+
"rsa",
|
|
45
|
+
"sign",
|
|
46
|
+
"signature",
|
|
47
|
+
"spki",
|
|
48
|
+
"validate",
|
|
49
|
+
"vercel",
|
|
50
|
+
"verify",
|
|
51
|
+
"webcrypto",
|
|
52
|
+
"workerd",
|
|
53
|
+
"workers",
|
|
54
|
+
"x509"
|
|
55
|
+
],
|
|
56
|
+
"homepage": "https://github.com/panva/jose",
|
|
57
|
+
"repository": "panva/jose",
|
|
58
|
+
"funding": {
|
|
59
|
+
"url": "https://github.com/sponsors/panva"
|
|
60
|
+
},
|
|
61
|
+
"license": "MIT",
|
|
62
|
+
"author": "Filip Skokan <panva.ip@gmail.com>",
|
|
63
|
+
"sideEffects": false,
|
|
64
|
+
"type": "module",
|
|
65
|
+
"exports": {
|
|
66
|
+
".": {
|
|
67
|
+
"types": "./dist/types/index.d.ts",
|
|
68
|
+
"default": "./dist/webapi/index.js"
|
|
69
|
+
},
|
|
70
|
+
"./jwk/embedded": {
|
|
71
|
+
"types": "./dist/types/jwk/embedded.d.ts",
|
|
72
|
+
"default": "./dist/webapi/jwk/embedded.js"
|
|
73
|
+
},
|
|
74
|
+
"./jwk/thumbprint": {
|
|
75
|
+
"types": "./dist/types/jwk/thumbprint.d.ts",
|
|
76
|
+
"default": "./dist/webapi/jwk/thumbprint.js"
|
|
77
|
+
},
|
|
78
|
+
"./key/import": {
|
|
79
|
+
"types": "./dist/types/key/import.d.ts",
|
|
80
|
+
"default": "./dist/webapi/key/import.js"
|
|
81
|
+
},
|
|
82
|
+
"./key/export": {
|
|
83
|
+
"types": "./dist/types/key/export.d.ts",
|
|
84
|
+
"default": "./dist/webapi/key/export.js"
|
|
85
|
+
},
|
|
86
|
+
"./key/generate/keypair": {
|
|
87
|
+
"types": "./dist/types/key/generate_key_pair.d.ts",
|
|
88
|
+
"default": "./dist/webapi/key/generate_key_pair.js"
|
|
89
|
+
},
|
|
90
|
+
"./key/generate/secret": {
|
|
91
|
+
"types": "./dist/types/key/generate_secret.d.ts",
|
|
92
|
+
"default": "./dist/webapi/key/generate_secret.js"
|
|
93
|
+
},
|
|
94
|
+
"./jwks/remote": {
|
|
95
|
+
"types": "./dist/types/jwks/remote.d.ts",
|
|
96
|
+
"default": "./dist/webapi/jwks/remote.js"
|
|
97
|
+
},
|
|
98
|
+
"./jwks/local": {
|
|
99
|
+
"types": "./dist/types/jwks/local.d.ts",
|
|
100
|
+
"default": "./dist/webapi/jwks/local.js"
|
|
101
|
+
},
|
|
102
|
+
"./jwt/sign": {
|
|
103
|
+
"types": "./dist/types/jwt/sign.d.ts",
|
|
104
|
+
"default": "./dist/webapi/jwt/sign.js"
|
|
105
|
+
},
|
|
106
|
+
"./jwt/verify": {
|
|
107
|
+
"types": "./dist/types/jwt/verify.d.ts",
|
|
108
|
+
"default": "./dist/webapi/jwt/verify.js"
|
|
109
|
+
},
|
|
110
|
+
"./jwt/encrypt": {
|
|
111
|
+
"types": "./dist/types/jwt/encrypt.d.ts",
|
|
112
|
+
"default": "./dist/webapi/jwt/encrypt.js"
|
|
113
|
+
},
|
|
114
|
+
"./jwt/decrypt": {
|
|
115
|
+
"types": "./dist/types/jwt/decrypt.d.ts",
|
|
116
|
+
"default": "./dist/webapi/jwt/decrypt.js"
|
|
117
|
+
},
|
|
118
|
+
"./jwt/unsecured": {
|
|
119
|
+
"types": "./dist/types/jwt/unsecured.d.ts",
|
|
120
|
+
"default": "./dist/webapi/jwt/unsecured.js"
|
|
121
|
+
},
|
|
122
|
+
"./jwt/decode": {
|
|
123
|
+
"types": "./dist/types/util/decode_jwt.d.ts",
|
|
124
|
+
"default": "./dist/webapi/util/decode_jwt.js"
|
|
125
|
+
},
|
|
126
|
+
"./decode/protected_header": {
|
|
127
|
+
"types": "./dist/types/util/decode_protected_header.d.ts",
|
|
128
|
+
"default": "./dist/webapi/util/decode_protected_header.js"
|
|
129
|
+
},
|
|
130
|
+
"./jws/compact/sign": {
|
|
131
|
+
"types": "./dist/types/jws/compact/sign.d.ts",
|
|
132
|
+
"default": "./dist/webapi/jws/compact/sign.js"
|
|
133
|
+
},
|
|
134
|
+
"./jws/compact/verify": {
|
|
135
|
+
"types": "./dist/types/jws/compact/verify.d.ts",
|
|
136
|
+
"default": "./dist/webapi/jws/compact/verify.js"
|
|
137
|
+
},
|
|
138
|
+
"./jws/flattened/sign": {
|
|
139
|
+
"types": "./dist/types/jws/flattened/sign.d.ts",
|
|
140
|
+
"default": "./dist/webapi/jws/flattened/sign.js"
|
|
141
|
+
},
|
|
142
|
+
"./jws/flattened/verify": {
|
|
143
|
+
"types": "./dist/types/jws/flattened/verify.d.ts",
|
|
144
|
+
"default": "./dist/webapi/jws/flattened/verify.js"
|
|
145
|
+
},
|
|
146
|
+
"./jws/general/sign": {
|
|
147
|
+
"types": "./dist/types/jws/general/sign.d.ts",
|
|
148
|
+
"default": "./dist/webapi/jws/general/sign.js"
|
|
149
|
+
},
|
|
150
|
+
"./jws/general/verify": {
|
|
151
|
+
"types": "./dist/types/jws/general/verify.d.ts",
|
|
152
|
+
"default": "./dist/webapi/jws/general/verify.js"
|
|
153
|
+
},
|
|
154
|
+
"./jwe/compact/encrypt": {
|
|
155
|
+
"types": "./dist/types/jwe/compact/encrypt.d.ts",
|
|
156
|
+
"default": "./dist/webapi/jwe/compact/encrypt.js"
|
|
157
|
+
},
|
|
158
|
+
"./jwe/compact/decrypt": {
|
|
159
|
+
"types": "./dist/types/jwe/compact/decrypt.d.ts",
|
|
160
|
+
"default": "./dist/webapi/jwe/compact/decrypt.js"
|
|
161
|
+
},
|
|
162
|
+
"./jwe/flattened/encrypt": {
|
|
163
|
+
"types": "./dist/types/jwe/flattened/encrypt.d.ts",
|
|
164
|
+
"default": "./dist/webapi/jwe/flattened/encrypt.js"
|
|
165
|
+
},
|
|
166
|
+
"./jwe/flattened/decrypt": {
|
|
167
|
+
"types": "./dist/types/jwe/flattened/decrypt.d.ts",
|
|
168
|
+
"default": "./dist/webapi/jwe/flattened/decrypt.js"
|
|
169
|
+
},
|
|
170
|
+
"./jwe/general/encrypt": {
|
|
171
|
+
"types": "./dist/types/jwe/general/encrypt.d.ts",
|
|
172
|
+
"default": "./dist/webapi/jwe/general/encrypt.js"
|
|
173
|
+
},
|
|
174
|
+
"./jwe/general/decrypt": {
|
|
175
|
+
"types": "./dist/types/jwe/general/decrypt.d.ts",
|
|
176
|
+
"default": "./dist/webapi/jwe/general/decrypt.js"
|
|
177
|
+
},
|
|
178
|
+
"./errors": {
|
|
179
|
+
"types": "./dist/types/util/errors.d.ts",
|
|
180
|
+
"default": "./dist/webapi/util/errors.js"
|
|
181
|
+
},
|
|
182
|
+
"./base64url": {
|
|
183
|
+
"types": "./dist/types/util/base64url.d.ts",
|
|
184
|
+
"default": "./dist/webapi/util/base64url.js"
|
|
185
|
+
},
|
|
186
|
+
"./package.json": "./package.json"
|
|
187
|
+
},
|
|
188
|
+
"main": "./dist/webapi/index.js",
|
|
189
|
+
"types": "./dist/types/index.d.ts",
|
|
190
|
+
"files": [
|
|
191
|
+
"dist/webapi/**/*.js",
|
|
192
|
+
"dist/types/**/*.d.ts",
|
|
193
|
+
"!dist/**/*.bundle.js",
|
|
194
|
+
"!dist/**/*.umd.js",
|
|
195
|
+
"!dist/**/*.min.js",
|
|
196
|
+
"!dist/types/runtime/*",
|
|
197
|
+
"!dist/types/lib/*",
|
|
198
|
+
"!dist/deno/**/*"
|
|
199
|
+
]
|
|
200
|
+
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "mcp-oauth",
|
|
3
|
-
"version": "0.0.1",
|
|
4
2
|
"license": "MIT",
|
|
5
3
|
"private": true,
|
|
6
4
|
"type": "module",
|
|
@@ -15,9 +13,6 @@
|
|
|
15
13
|
"scripts": {
|
|
16
14
|
"build": "tsc"
|
|
17
15
|
},
|
|
18
|
-
"dependencies": {
|
|
19
|
-
"jose": "^6.1.2"
|
|
20
|
-
},
|
|
21
16
|
"devDependencies": {
|
|
22
17
|
"tiny-oauth-test-server": "*"
|
|
23
18
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tiny-http-mcp-server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Minimal MCP server over HTTP built on tiny-stdio-mcp-server",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
14
|
"import": "./dist/index.js"
|
|
15
15
|
},
|
|
16
|
+
"./server": {
|
|
17
|
+
"types": "./dist/server.d.ts",
|
|
18
|
+
"import": "./dist/server.js"
|
|
19
|
+
},
|
|
16
20
|
"./testing": {
|
|
17
21
|
"types": "./dist/testing.d.ts",
|
|
18
22
|
"import": "./dist/testing.js"
|
|
@@ -24,8 +28,8 @@
|
|
|
24
28
|
},
|
|
25
29
|
"scripts": {
|
|
26
30
|
"build": "node ../../scripts/guard-package-dist.mjs && tsc",
|
|
27
|
-
"prepack": "node ../../scripts/set-bin-executable.mjs && node ../../scripts/manage-bundled-workspace-deps.mjs prepare . mcp-oauth auth-store tiny-mcp-client",
|
|
28
|
-
"postpack": "node ../../scripts/manage-bundled-workspace-deps.mjs cleanup . mcp-oauth auth-store tiny-mcp-client",
|
|
31
|
+
"prepack": "node ../../scripts/set-bin-executable.mjs && node ../../scripts/manage-bundled-workspace-deps.mjs prepare . mcp-oauth auth-store tiny-mcp-client jose",
|
|
32
|
+
"postpack": "node ../../scripts/manage-bundled-workspace-deps.mjs cleanup . mcp-oauth auth-store tiny-mcp-client jose",
|
|
29
33
|
"prepublishOnly": "tsc"
|
|
30
34
|
},
|
|
31
35
|
"files": [
|
|
@@ -42,14 +46,14 @@
|
|
|
42
46
|
},
|
|
43
47
|
"license": "MIT",
|
|
44
48
|
"dependencies": {
|
|
45
|
-
"express": "^5.1.0",
|
|
46
49
|
"jose": "^6.1.2",
|
|
47
50
|
"tiny-stdio-mcp-server": "^0.1.0"
|
|
48
51
|
},
|
|
49
52
|
"bundleDependencies": [
|
|
50
53
|
"mcp-oauth",
|
|
51
54
|
"auth-store",
|
|
52
|
-
"tiny-mcp-client"
|
|
55
|
+
"tiny-mcp-client",
|
|
56
|
+
"jose"
|
|
53
57
|
],
|
|
54
58
|
"optionalDependencies": {
|
|
55
59
|
"mcp-oauth": "*",
|
|
@@ -58,6 +62,7 @@
|
|
|
58
62
|
},
|
|
59
63
|
"devDependencies": {
|
|
60
64
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
61
|
-
"@types/express": "^5.0.6"
|
|
65
|
+
"@types/express": "^5.0.6",
|
|
66
|
+
"express": "^5.1.0"
|
|
62
67
|
}
|
|
63
68
|
}
|