@decnutz/mcpgateway 0.0.0-stage → 0.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/LICENSE +21 -0
- package/README.md +339 -2
- package/dist/src/admin.d.ts +32 -0
- package/dist/src/admin.js +123 -0
- package/dist/src/audit.d.ts +62 -0
- package/dist/src/audit.js +185 -0
- package/dist/src/cli.d.ts +34 -0
- package/dist/src/cli.js +374 -0
- package/dist/src/config.d.ts +124 -0
- package/dist/src/config.js +599 -0
- package/dist/src/downstream.d.ts +59 -0
- package/dist/src/downstream.js +279 -0
- package/dist/src/gateway.d.ts +44 -0
- package/dist/src/gateway.js +194 -0
- package/dist/src/hiddenchars.d.ts +31 -0
- package/dist/src/hiddenchars.js +77 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +7 -0
- package/dist/src/metrics.d.ts +58 -0
- package/dist/src/metrics.js +138 -0
- package/dist/src/namespace.d.ts +65 -0
- package/dist/src/namespace.js +131 -0
- package/dist/src/pinning.d.ts +35 -0
- package/dist/src/pinning.js +131 -0
- package/dist/src/policy.d.ts +31 -0
- package/dist/src/policy.js +116 -0
- package/dist/src/ratelimit.d.ts +19 -0
- package/dist/src/ratelimit.js +62 -0
- package/dist/src/upstream.d.ts +107 -0
- package/dist/src/upstream.js +546 -0
- package/dist/src/util.d.ts +19 -0
- package/dist/src/util.js +47 -0
- package/dist/src/version.d.ts +2 -0
- package/dist/src/version.js +16 -0
- package/mcpgateway.example.yaml +90 -0
- package/package.json +49 -4
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { globMatch } from './util.js';
|
|
2
|
+
export declare class ConfigError extends Error {
|
|
3
|
+
readonly problems: string[];
|
|
4
|
+
constructor(problems: string[]);
|
|
5
|
+
}
|
|
6
|
+
export interface ServerConfig {
|
|
7
|
+
name: string;
|
|
8
|
+
transport: 'stdio' | 'http';
|
|
9
|
+
command?: string;
|
|
10
|
+
args?: string[];
|
|
11
|
+
env?: Record<string, string>;
|
|
12
|
+
cwd?: string;
|
|
13
|
+
url?: string;
|
|
14
|
+
headers?: Record<string, string>;
|
|
15
|
+
timeoutMs: number;
|
|
16
|
+
concurrency: number;
|
|
17
|
+
failureThreshold: number;
|
|
18
|
+
breakerCooldownMs: number;
|
|
19
|
+
healthCheckMs: number;
|
|
20
|
+
}
|
|
21
|
+
export type NamespaceStrategy = 'prefix' | 'priority' | 'explicit';
|
|
22
|
+
export interface NamespaceConfig {
|
|
23
|
+
strategy: NamespaceStrategy;
|
|
24
|
+
separator: string;
|
|
25
|
+
priority: string[];
|
|
26
|
+
mappings: Record<string, string>;
|
|
27
|
+
aliases: Record<string, string>;
|
|
28
|
+
}
|
|
29
|
+
export interface RateLimitRule {
|
|
30
|
+
rps: number;
|
|
31
|
+
burst: number;
|
|
32
|
+
}
|
|
33
|
+
export interface ArgRule {
|
|
34
|
+
allow?: string[];
|
|
35
|
+
deny?: string[];
|
|
36
|
+
}
|
|
37
|
+
export interface PolicyConfig {
|
|
38
|
+
mode: 'enforce' | 'observe';
|
|
39
|
+
allowTools: string[];
|
|
40
|
+
denyTools: string[];
|
|
41
|
+
hideTools: string[];
|
|
42
|
+
argRules: Record<string, ArgRule>;
|
|
43
|
+
responseRedact: string[];
|
|
44
|
+
responseBlock: string[];
|
|
45
|
+
responseWarn: string[];
|
|
46
|
+
scanWindowChars: number;
|
|
47
|
+
/** hide + deny tools whose metadata contains invisible characters */
|
|
48
|
+
hideSuspicious: boolean;
|
|
49
|
+
}
|
|
50
|
+
export interface AuthKey {
|
|
51
|
+
id: string;
|
|
52
|
+
key: string;
|
|
53
|
+
scopes: string[];
|
|
54
|
+
/** glob patterns over public tool names this key may list/call; absent = all */
|
|
55
|
+
tools?: string[];
|
|
56
|
+
}
|
|
57
|
+
export interface AuditConfig {
|
|
58
|
+
path: string;
|
|
59
|
+
logArgs: boolean;
|
|
60
|
+
redactKeys: string[];
|
|
61
|
+
maxArgsChars: number;
|
|
62
|
+
maxSizeMB: number;
|
|
63
|
+
keepFiles: number;
|
|
64
|
+
}
|
|
65
|
+
export interface AdminConfig {
|
|
66
|
+
enabled: boolean;
|
|
67
|
+
host: string;
|
|
68
|
+
port: number;
|
|
69
|
+
allowPublicAdmin: boolean;
|
|
70
|
+
}
|
|
71
|
+
export interface UpstreamConfig {
|
|
72
|
+
stdio: {
|
|
73
|
+
enabled: boolean;
|
|
74
|
+
};
|
|
75
|
+
http: {
|
|
76
|
+
enabled: boolean;
|
|
77
|
+
host: string;
|
|
78
|
+
port: number;
|
|
79
|
+
maxSessions: number;
|
|
80
|
+
/** exact Origin values accepted; a request with any other Origin gets 403 */
|
|
81
|
+
allowedOrigins: string[];
|
|
82
|
+
/** accepted Host header names (port optional); empty = no Host check */
|
|
83
|
+
allowedHosts: string[];
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export interface PinningConfig {
|
|
87
|
+
mode: 'off' | 'warn' | 'quarantine';
|
|
88
|
+
file?: string;
|
|
89
|
+
}
|
|
90
|
+
export interface GatewayConfig {
|
|
91
|
+
name: string;
|
|
92
|
+
servers: ServerConfig[];
|
|
93
|
+
namespace: NamespaceConfig;
|
|
94
|
+
defaultRateLimit: RateLimitRule;
|
|
95
|
+
perToolRateLimits: Record<string, RateLimitRule>;
|
|
96
|
+
policy: PolicyConfig;
|
|
97
|
+
auth: {
|
|
98
|
+
disabled: boolean;
|
|
99
|
+
keys: AuthKey[];
|
|
100
|
+
};
|
|
101
|
+
audit: AuditConfig;
|
|
102
|
+
admin: AdminConfig;
|
|
103
|
+
upstream: UpstreamConfig;
|
|
104
|
+
globalMaxInflight: number;
|
|
105
|
+
maxResultChars: number;
|
|
106
|
+
pinning: PinningConfig;
|
|
107
|
+
}
|
|
108
|
+
export declare const DEFAULT_REDACT_KEYS: string[];
|
|
109
|
+
export declare const VALID_SCOPES: readonly ["tools:call", "tools:list", "resources:*", "prompts:*", "admin"];
|
|
110
|
+
/** Expand ${VAR} and ${VAR:-default}; throws naming the variable when unset. */
|
|
111
|
+
export declare function interpolateEnv(value: string, context: string): string;
|
|
112
|
+
export type Raw = Record<string, unknown>;
|
|
113
|
+
export interface LoadOptions {
|
|
114
|
+
/** Skip reachability/command-exists checks (offline validation). */
|
|
115
|
+
noNetwork?: boolean;
|
|
116
|
+
}
|
|
117
|
+
export declare function loadConfigFile(path: string, opts?: LoadOptions): GatewayConfig;
|
|
118
|
+
export declare function validateConfig(raw: Raw, source: string, opts?: LoadOptions): GatewayConfig;
|
|
119
|
+
/** Warnings collected during validation (unknown keys etc.). Non-fatal. */
|
|
120
|
+
export declare function configWarnings(cfg: GatewayConfig): string[];
|
|
121
|
+
/** Does this public tool name match any allow/deny-style glob list? Exported for policy use. */
|
|
122
|
+
export declare function matchesAny(patterns: string[], value: string): boolean;
|
|
123
|
+
export { globMatch };
|
|
124
|
+
//# sourceMappingURL=config.d.ts.map
|