@reveldigital/mcp-graphql-proxy 1.0.0
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/bin/cli.d.ts +6 -0
- package/dist/bin/cli.d.ts.map +1 -0
- package/dist/bin/cli.js +7 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/core/cache.d.ts +61 -0
- package/dist/core/cache.d.ts.map +1 -0
- package/dist/core/cache.js +147 -0
- package/dist/core/cache.js.map +1 -0
- package/dist/core/graphql-client.d.ts +48 -0
- package/dist/core/graphql-client.d.ts.map +1 -0
- package/dist/core/graphql-client.js +210 -0
- package/dist/core/graphql-client.js.map +1 -0
- package/dist/core/query-builder.d.ts +90 -0
- package/dist/core/query-builder.d.ts.map +1 -0
- package/dist/core/query-builder.js +259 -0
- package/dist/core/query-builder.js.map +1 -0
- package/dist/core/response-optimizer.d.ts +59 -0
- package/dist/core/response-optimizer.d.ts.map +1 -0
- package/dist/core/response-optimizer.js +197 -0
- package/dist/core/response-optimizer.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +377 -0
- package/dist/index.js.map +1 -0
- package/dist/types/auth.d.ts +146 -0
- package/dist/types/auth.d.ts.map +1 -0
- package/dist/types/auth.js +22 -0
- package/dist/types/auth.js.map +1 -0
- package/dist/types/cache.d.ts +162 -0
- package/dist/types/cache.d.ts.map +1 -0
- package/dist/types/cache.js +34 -0
- package/dist/types/cache.js.map +1 -0
- package/dist/types/config.d.ts +108 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +37 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/graphql-proxy.d.ts +243 -0
- package/dist/types/graphql-proxy.d.ts.map +1 -0
- package/dist/types/graphql-proxy.js +142 -0
- package/dist/types/graphql-proxy.js.map +1 -0
- package/dist/types/index.d.ts +15 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +16 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/logging.d.ts +223 -0
- package/dist/types/logging.d.ts.map +1 -0
- package/dist/types/logging.js +67 -0
- package/dist/types/logging.js.map +1 -0
- package/dist/types/mcp.d.ts +160 -0
- package/dist/types/mcp.d.ts.map +1 -0
- package/dist/types/mcp.js +126 -0
- package/dist/types/mcp.js.map +1 -0
- package/dist/types/metrics.d.ts +237 -0
- package/dist/types/metrics.d.ts.map +1 -0
- package/dist/types/metrics.js +26 -0
- package/dist/types/metrics.js.map +1 -0
- package/dist/types/rate-limit.d.ts +144 -0
- package/dist/types/rate-limit.d.ts.map +1 -0
- package/dist/types/rate-limit.js +43 -0
- package/dist/types/rate-limit.js.map +1 -0
- package/dist/types/tenant.d.ts +176 -0
- package/dist/types/tenant.d.ts.map +1 -0
- package/dist/types/tenant.js +63 -0
- package/dist/types/tenant.js.map +1 -0
- package/dist/types/transformation.d.ts +198 -0
- package/dist/types/transformation.d.ts.map +1 -0
- package/dist/types/transformation.js +51 -0
- package/dist/types/transformation.js.map +1 -0
- package/package.json +77 -0
- package/src/types/schema.graphql +2712 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GraphQL Proxy Types
|
|
3
|
+
*
|
|
4
|
+
* Simple types for the GraphQL proxy implementation.
|
|
5
|
+
* These are separate from the enterprise proxy types.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
/**
|
|
9
|
+
* Default configuration values
|
|
10
|
+
*/
|
|
11
|
+
export const defaultGraphQLProxyConfig = {
|
|
12
|
+
endpoint: process.env.REVELDIGITAL_GRAPHQL_ENDPOINT || 'https://api.reveldigital.com/graphql',
|
|
13
|
+
authToken: process.env.REVELDIGITAL_AUTH_TOKEN,
|
|
14
|
+
timeout: parseInt(process.env.REQUEST_TIMEOUT || '30000', 10),
|
|
15
|
+
enableCache: process.env.ENABLE_CACHE !== 'false',
|
|
16
|
+
cacheTtl: parseInt(process.env.CACHE_TTL || '300', 10),
|
|
17
|
+
maxResponseSize: parseInt(process.env.MAX_RESPONSE_SIZE || '50000', 10),
|
|
18
|
+
debug: process.env.DEBUG === 'true',
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Create a successful tool result
|
|
22
|
+
*/
|
|
23
|
+
export function createToolResult(data, pretty = true) {
|
|
24
|
+
return {
|
|
25
|
+
content: [{
|
|
26
|
+
type: 'text',
|
|
27
|
+
text: typeof data === 'string' ? data : JSON.stringify(data, null, pretty ? 2 : 0),
|
|
28
|
+
}],
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Create an error tool result
|
|
33
|
+
*/
|
|
34
|
+
export function createErrorResult(error) {
|
|
35
|
+
return {
|
|
36
|
+
content: [{
|
|
37
|
+
type: 'text',
|
|
38
|
+
text: `Error: ${error instanceof Error ? error.message : error}`,
|
|
39
|
+
}],
|
|
40
|
+
isError: true,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
// ============================================
|
|
44
|
+
// Zod Schemas for Tool Validation
|
|
45
|
+
// ============================================
|
|
46
|
+
/**
|
|
47
|
+
* Schema for execute_query tool arguments
|
|
48
|
+
*/
|
|
49
|
+
export const ExecuteQuerySchema = z.object({
|
|
50
|
+
query: z.string().describe('GraphQL query string'),
|
|
51
|
+
variables: z.record(z.unknown()).optional().describe('Query variables'),
|
|
52
|
+
operationName: z.string().optional().describe('Operation name for multi-query documents'),
|
|
53
|
+
useCache: z.boolean().default(true).describe('Use cached response if available'),
|
|
54
|
+
authHeader: z.string().optional().describe('Optional auth header override'),
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* Schema for build_query tool arguments
|
|
58
|
+
*/
|
|
59
|
+
export const BuildQuerySchema = z.object({
|
|
60
|
+
operation: z.enum(['device', 'media', 'schedule', 'audienceMetrics', 'playLogs'])
|
|
61
|
+
.describe('The GraphQL operation type'),
|
|
62
|
+
fields: z.array(z.string()).optional()
|
|
63
|
+
.describe('Specific fields to include (defaults to preset)'),
|
|
64
|
+
preset: z.enum(['basic', 'detailed', 'location', 'metrics', 'minimal']).optional()
|
|
65
|
+
.describe('Field preset to use'),
|
|
66
|
+
filter: z.record(z.unknown()).optional()
|
|
67
|
+
.describe('Filter conditions'),
|
|
68
|
+
orderBy: z.string().optional()
|
|
69
|
+
.describe('Field to order results by'),
|
|
70
|
+
orderDirection: z.enum(['ASC', 'DESC']).optional()
|
|
71
|
+
.describe('Order direction'),
|
|
72
|
+
limit: z.number().min(1).max(1000).optional()
|
|
73
|
+
.describe('Maximum number of results'),
|
|
74
|
+
offset: z.number().min(0).optional()
|
|
75
|
+
.describe('Results offset for pagination'),
|
|
76
|
+
startDate: z.string().optional()
|
|
77
|
+
.describe('Start date for date-range queries (ISO 8601)'),
|
|
78
|
+
endDate: z.string().optional()
|
|
79
|
+
.describe('End date for date-range queries (ISO 8601)'),
|
|
80
|
+
deviceId: z.union([z.string(), z.array(z.string())]).optional()
|
|
81
|
+
.describe('Device ID(s) for device-specific queries'),
|
|
82
|
+
});
|
|
83
|
+
/**
|
|
84
|
+
* Schema for introspect_schema tool arguments
|
|
85
|
+
*/
|
|
86
|
+
export const IntrospectSchemaSchema = z.object({
|
|
87
|
+
typeName: z.string().optional()
|
|
88
|
+
.describe('Specific type to introspect (returns all types if not specified)'),
|
|
89
|
+
includeFields: z.boolean().default(true)
|
|
90
|
+
.describe('Include field definitions in output'),
|
|
91
|
+
includeDescriptions: z.boolean().default(true)
|
|
92
|
+
.describe('Include descriptions in output'),
|
|
93
|
+
});
|
|
94
|
+
/**
|
|
95
|
+
* Schema for quick_query tool arguments
|
|
96
|
+
*/
|
|
97
|
+
export const QuickQuerySchema = z.object({
|
|
98
|
+
queryType: z.enum([
|
|
99
|
+
'devices_status',
|
|
100
|
+
'online_devices',
|
|
101
|
+
'offline_devices',
|
|
102
|
+
'recent_media',
|
|
103
|
+
'active_schedules',
|
|
104
|
+
'play_logs',
|
|
105
|
+
]).describe('Pre-built query type'),
|
|
106
|
+
limit: z.number().min(1).max(500).default(100)
|
|
107
|
+
.describe('Maximum results to return'),
|
|
108
|
+
startDate: z.string().optional()
|
|
109
|
+
.describe('Start date for time-based queries'),
|
|
110
|
+
endDate: z.string().optional()
|
|
111
|
+
.describe('End date for time-based queries'),
|
|
112
|
+
authHeader: z.string().optional()
|
|
113
|
+
.describe('Optional auth header override'),
|
|
114
|
+
});
|
|
115
|
+
/**
|
|
116
|
+
* Schema for manage_cache tool arguments
|
|
117
|
+
*/
|
|
118
|
+
export const ManageCacheSchema = z.object({
|
|
119
|
+
action: z.enum(['stats', 'clear', 'cleanup'])
|
|
120
|
+
.describe('Cache management action'),
|
|
121
|
+
});
|
|
122
|
+
/**
|
|
123
|
+
* Schema for set_auth tool arguments
|
|
124
|
+
*/
|
|
125
|
+
export const SetAuthSchema = z.object({
|
|
126
|
+
apiKey: z.string().optional()
|
|
127
|
+
.describe('API key for X-RevelDigital-API header'),
|
|
128
|
+
bearerToken: z.string().optional()
|
|
129
|
+
.describe('OAuth bearer token'),
|
|
130
|
+
clear: z.boolean().optional()
|
|
131
|
+
.describe('Clear all authentication'),
|
|
132
|
+
});
|
|
133
|
+
/**
|
|
134
|
+
* Schema for optimize_response tool arguments
|
|
135
|
+
*/
|
|
136
|
+
export const OptimizeResponseSchema = z.object({
|
|
137
|
+
data: z.unknown().describe('Data to optimize'),
|
|
138
|
+
maxSize: z.number().optional().describe('Maximum size in characters'),
|
|
139
|
+
strategy: z.enum(['truncate', 'summarize', 'paginate']).optional()
|
|
140
|
+
.describe('Optimization strategy'),
|
|
141
|
+
});
|
|
142
|
+
//# sourceMappingURL=graphql-proxy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-proxy.js","sourceRoot":"","sources":["../../src/types/graphql-proxy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgCxB;;GAEG;AACH,MAAM,CAAC,MAAM,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E,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;SAC/B,QAAQ,CAAC,oBAAoB,CAAC;IACjC,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;SAC1B,QAAQ,CAAC,0BAA0B,CAAC;CACxC,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC;IAC9C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;IACrE,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,EAAE;SAC/D,QAAQ,CAAC,uBAAuB,CAAC;CACrC,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Revel Digital MCP Proxy - Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* This module exports all TypeScript interfaces for the proxy system.
|
|
5
|
+
*/
|
|
6
|
+
export * from './config.js';
|
|
7
|
+
export * from './auth.js';
|
|
8
|
+
export * from './cache.js';
|
|
9
|
+
export * from './rate-limit.js';
|
|
10
|
+
export * from './logging.js';
|
|
11
|
+
export * from './metrics.js';
|
|
12
|
+
export * from './transformation.js';
|
|
13
|
+
export * from './tenant.js';
|
|
14
|
+
export * from './mcp.js';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Revel Digital MCP Proxy - Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* This module exports all TypeScript interfaces for the proxy system.
|
|
5
|
+
*/
|
|
6
|
+
// Configuration Types
|
|
7
|
+
export * from './config.js';
|
|
8
|
+
export * from './auth.js';
|
|
9
|
+
export * from './cache.js';
|
|
10
|
+
export * from './rate-limit.js';
|
|
11
|
+
export * from './logging.js';
|
|
12
|
+
export * from './metrics.js';
|
|
13
|
+
export * from './transformation.js';
|
|
14
|
+
export * from './tenant.js';
|
|
15
|
+
export * from './mcp.js';
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,sBAAsB;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logging Types
|
|
3
|
+
*
|
|
4
|
+
* Logging configuration and log entry interfaces.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Logging configuration
|
|
8
|
+
*/
|
|
9
|
+
export interface LoggingConfig {
|
|
10
|
+
/** Enable logging */
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
/** Log level */
|
|
13
|
+
level: LogLevel;
|
|
14
|
+
/** Log output targets */
|
|
15
|
+
outputs: LogOutput[];
|
|
16
|
+
/** Request/response logging */
|
|
17
|
+
requestLogging: RequestLoggingConfig;
|
|
18
|
+
/** Sensitive data handling */
|
|
19
|
+
sensitiveData: SensitiveDataConfig;
|
|
20
|
+
/** Log rotation settings */
|
|
21
|
+
rotation: LogRotationConfig;
|
|
22
|
+
/** Correlation ID configuration */
|
|
23
|
+
correlationId: CorrelationIdConfig;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Log severity levels
|
|
27
|
+
*/
|
|
28
|
+
export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
|
29
|
+
/**
|
|
30
|
+
* Log level numeric values for comparison
|
|
31
|
+
*/
|
|
32
|
+
export declare const LOG_LEVEL_VALUES: Record<LogLevel, number>;
|
|
33
|
+
/**
|
|
34
|
+
* Log output target configuration
|
|
35
|
+
*/
|
|
36
|
+
export interface LogOutput {
|
|
37
|
+
/** Output type */
|
|
38
|
+
type: 'console' | 'file' | 'http' | 'syslog';
|
|
39
|
+
/** Minimum level for this output */
|
|
40
|
+
level: LogLevel;
|
|
41
|
+
/** Format for this output */
|
|
42
|
+
format: LogFormat;
|
|
43
|
+
/** Output-specific options */
|
|
44
|
+
options: LogOutputOptions;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Log format types
|
|
48
|
+
*/
|
|
49
|
+
export type LogFormat = 'json' | 'text' | 'structured' | 'pretty';
|
|
50
|
+
/**
|
|
51
|
+
* Output-specific options
|
|
52
|
+
*/
|
|
53
|
+
export interface LogOutputOptions {
|
|
54
|
+
/** File path for 'file' type */
|
|
55
|
+
path?: string;
|
|
56
|
+
/** HTTP endpoint for 'http' type */
|
|
57
|
+
endpoint?: string;
|
|
58
|
+
/** Syslog host for 'syslog' type */
|
|
59
|
+
host?: string;
|
|
60
|
+
/** Syslog port for 'syslog' type */
|
|
61
|
+
port?: number;
|
|
62
|
+
/** Include timestamps */
|
|
63
|
+
timestamp?: boolean;
|
|
64
|
+
/** Include colors (for 'pretty' format) */
|
|
65
|
+
colors?: boolean;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Request/response logging configuration
|
|
69
|
+
*/
|
|
70
|
+
export interface RequestLoggingConfig {
|
|
71
|
+
/** Log request headers */
|
|
72
|
+
logHeaders: boolean;
|
|
73
|
+
/** Log request body */
|
|
74
|
+
logBody: boolean;
|
|
75
|
+
/** Log response headers */
|
|
76
|
+
logResponseHeaders: boolean;
|
|
77
|
+
/** Log response body */
|
|
78
|
+
logResponseBody: boolean;
|
|
79
|
+
/** Maximum body size to log (bytes) */
|
|
80
|
+
maxBodySize: number;
|
|
81
|
+
/** Headers to exclude from logging */
|
|
82
|
+
excludeHeaders: string[];
|
|
83
|
+
/** Methods to exclude from body logging */
|
|
84
|
+
excludeBodyMethods: string[];
|
|
85
|
+
/** Log timing information */
|
|
86
|
+
logTiming: boolean;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Sensitive data handling configuration
|
|
90
|
+
*/
|
|
91
|
+
export interface SensitiveDataConfig {
|
|
92
|
+
/** Patterns to mask in logs (regex strings) */
|
|
93
|
+
maskPatterns: string[];
|
|
94
|
+
/** Fields to always mask (by name) */
|
|
95
|
+
maskFields: string[];
|
|
96
|
+
/** Replacement string for masked values */
|
|
97
|
+
maskReplacement: string;
|
|
98
|
+
/** Header names to mask */
|
|
99
|
+
maskHeaders: string[];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Log rotation configuration
|
|
103
|
+
*/
|
|
104
|
+
export interface LogRotationConfig {
|
|
105
|
+
/** Enable log rotation */
|
|
106
|
+
enabled: boolean;
|
|
107
|
+
/** Maximum file size before rotation (MB) */
|
|
108
|
+
maxSizeMb: number;
|
|
109
|
+
/** Maximum number of files to keep */
|
|
110
|
+
maxFiles: number;
|
|
111
|
+
/** Maximum age in days */
|
|
112
|
+
maxAgeDays?: number;
|
|
113
|
+
/** Compress rotated files */
|
|
114
|
+
compress: boolean;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Correlation ID configuration
|
|
118
|
+
*/
|
|
119
|
+
export interface CorrelationIdConfig {
|
|
120
|
+
/** Enable correlation ID tracking */
|
|
121
|
+
enabled: boolean;
|
|
122
|
+
/** Header name for incoming correlation ID */
|
|
123
|
+
headerName: string;
|
|
124
|
+
/** Generate if not provided */
|
|
125
|
+
generate: boolean;
|
|
126
|
+
/** Propagate to upstream */
|
|
127
|
+
propagate: boolean;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Structured log entry
|
|
131
|
+
*/
|
|
132
|
+
export interface LogEntry {
|
|
133
|
+
/** Log timestamp */
|
|
134
|
+
timestamp: Date;
|
|
135
|
+
/** Log level */
|
|
136
|
+
level: LogLevel;
|
|
137
|
+
/** Log message */
|
|
138
|
+
message: string;
|
|
139
|
+
/** Request correlation ID */
|
|
140
|
+
correlationId?: string;
|
|
141
|
+
/** Tenant ID */
|
|
142
|
+
tenantId?: string;
|
|
143
|
+
/** MCP method */
|
|
144
|
+
method?: string;
|
|
145
|
+
/** Duration in milliseconds */
|
|
146
|
+
durationMs?: number;
|
|
147
|
+
/** Request metadata */
|
|
148
|
+
request?: LogRequestMetadata;
|
|
149
|
+
/** Response metadata */
|
|
150
|
+
response?: LogResponseMetadata;
|
|
151
|
+
/** Additional context */
|
|
152
|
+
context?: Record<string, unknown>;
|
|
153
|
+
/** Error details if applicable */
|
|
154
|
+
error?: ErrorDetails;
|
|
155
|
+
/** Source component */
|
|
156
|
+
component?: string;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Request metadata for logging
|
|
160
|
+
*/
|
|
161
|
+
export interface LogRequestMetadata {
|
|
162
|
+
/** Request ID */
|
|
163
|
+
id?: string | number;
|
|
164
|
+
/** MCP method */
|
|
165
|
+
method: string;
|
|
166
|
+
/** Parameters (sanitized) */
|
|
167
|
+
params?: Record<string, unknown>;
|
|
168
|
+
/** Request size in bytes */
|
|
169
|
+
sizeBytes?: number;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Response metadata for logging
|
|
173
|
+
*/
|
|
174
|
+
export interface LogResponseMetadata {
|
|
175
|
+
/** Was successful */
|
|
176
|
+
success: boolean;
|
|
177
|
+
/** Error code if failed */
|
|
178
|
+
errorCode?: number;
|
|
179
|
+
/** Response size in bytes */
|
|
180
|
+
sizeBytes?: number;
|
|
181
|
+
/** From cache */
|
|
182
|
+
cached?: boolean;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Error details for logging
|
|
186
|
+
*/
|
|
187
|
+
export interface ErrorDetails {
|
|
188
|
+
/** Error name/type */
|
|
189
|
+
name: string;
|
|
190
|
+
/** Error message */
|
|
191
|
+
message: string;
|
|
192
|
+
/** Error code */
|
|
193
|
+
code?: string | number;
|
|
194
|
+
/** Stack trace (only in debug/trace level) */
|
|
195
|
+
stack?: string;
|
|
196
|
+
/** Original error if wrapped */
|
|
197
|
+
cause?: ErrorDetails;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Audit log entry for compliance
|
|
201
|
+
*/
|
|
202
|
+
export interface AuditLogEntry extends LogEntry {
|
|
203
|
+
/** Audit-specific fields */
|
|
204
|
+
audit: {
|
|
205
|
+
/** Action performed */
|
|
206
|
+
action: string;
|
|
207
|
+
/** Actor (tenant/user) */
|
|
208
|
+
actor: string;
|
|
209
|
+
/** Resource affected */
|
|
210
|
+
resource: string;
|
|
211
|
+
/** Outcome */
|
|
212
|
+
outcome: 'success' | 'failure';
|
|
213
|
+
/** IP address */
|
|
214
|
+
ipAddress?: string;
|
|
215
|
+
/** User agent */
|
|
216
|
+
userAgent?: string;
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Default logging configuration
|
|
221
|
+
*/
|
|
222
|
+
export declare const DEFAULT_LOGGING_CONFIG: LoggingConfig;
|
|
223
|
+
//# sourceMappingURL=logging.d.ts.map
|
|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IAEnB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,iBAAiB;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IAEb,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;IAEhB,iBAAiB;IACjB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAEvB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,gCAAgC;IAChC,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,QAAQ;IAC7C,4BAA4B;IAC5B,KAAK,EAAE;QACL,uBAAuB;QACvB,MAAM,EAAE,MAAM,CAAC;QAEf,0BAA0B;QAC1B,KAAK,EAAE,MAAM,CAAC;QAEd,wBAAwB;QACxB,QAAQ,EAAE,MAAM,CAAC;QAEjB,cAAc;QACd,OAAO,EAAE,SAAS,GAAG,SAAS,CAAC;QAE/B,iBAAiB;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;QAEnB,iBAAiB;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,aA8CpC,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logging Types
|
|
3
|
+
*
|
|
4
|
+
* Logging configuration and log entry interfaces.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Log level numeric values for comparison
|
|
8
|
+
*/
|
|
9
|
+
export const LOG_LEVEL_VALUES = {
|
|
10
|
+
trace: 10,
|
|
11
|
+
debug: 20,
|
|
12
|
+
info: 30,
|
|
13
|
+
warn: 40,
|
|
14
|
+
error: 50,
|
|
15
|
+
fatal: 60,
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Default logging configuration
|
|
19
|
+
*/
|
|
20
|
+
export const DEFAULT_LOGGING_CONFIG = {
|
|
21
|
+
enabled: true,
|
|
22
|
+
level: 'info',
|
|
23
|
+
outputs: [
|
|
24
|
+
{
|
|
25
|
+
type: 'console',
|
|
26
|
+
level: 'info',
|
|
27
|
+
format: 'json',
|
|
28
|
+
options: {
|
|
29
|
+
timestamp: true,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
requestLogging: {
|
|
34
|
+
logHeaders: false,
|
|
35
|
+
logBody: false,
|
|
36
|
+
logResponseHeaders: false,
|
|
37
|
+
logResponseBody: false,
|
|
38
|
+
maxBodySize: 10000,
|
|
39
|
+
excludeHeaders: ['authorization', 'x-api-key', 'x-reveldigital-api'],
|
|
40
|
+
excludeBodyMethods: ['tools/call'],
|
|
41
|
+
logTiming: true,
|
|
42
|
+
},
|
|
43
|
+
sensitiveData: {
|
|
44
|
+
maskPatterns: [
|
|
45
|
+
// API keys
|
|
46
|
+
'([a-zA-Z0-9]{32,})',
|
|
47
|
+
// Bearer tokens
|
|
48
|
+
'Bearer\\s+[a-zA-Z0-9\\-_.]+',
|
|
49
|
+
],
|
|
50
|
+
maskFields: ['apiKey', 'password', 'secret', 'token', 'authorization'],
|
|
51
|
+
maskReplacement: '[REDACTED]',
|
|
52
|
+
maskHeaders: ['authorization', 'x-api-key', 'x-reveldigital-api'],
|
|
53
|
+
},
|
|
54
|
+
rotation: {
|
|
55
|
+
enabled: false,
|
|
56
|
+
maxSizeMb: 100,
|
|
57
|
+
maxFiles: 10,
|
|
58
|
+
compress: true,
|
|
59
|
+
},
|
|
60
|
+
correlationId: {
|
|
61
|
+
enabled: true,
|
|
62
|
+
headerName: 'X-Correlation-ID',
|
|
63
|
+
generate: true,
|
|
64
|
+
propagate: true,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=logging.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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QACb,UAAU,EAAE,kBAAkB;QAC9B,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,IAAI;KAChB;CACF,CAAC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Protocol Types
|
|
3
|
+
*
|
|
4
|
+
* Extended MCP types with proxy metadata for request/response handling.
|
|
5
|
+
*/
|
|
6
|
+
import type { JSONRPCMessage } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
+
import type { AuthContext } from './auth.js';
|
|
8
|
+
import type { TenantContext } from './tenant.js';
|
|
9
|
+
import type { RateLimitState } from './rate-limit.js';
|
|
10
|
+
/**
|
|
11
|
+
* Extended MCP request with proxy metadata
|
|
12
|
+
*/
|
|
13
|
+
export interface ProxyMCPRequest {
|
|
14
|
+
/** Original JSON-RPC message */
|
|
15
|
+
message: JSONRPCMessage;
|
|
16
|
+
/** Request correlation ID */
|
|
17
|
+
correlationId: string;
|
|
18
|
+
/** Request timestamp */
|
|
19
|
+
timestamp: Date;
|
|
20
|
+
/** Resolved authentication context */
|
|
21
|
+
authContext?: AuthContext;
|
|
22
|
+
/** Resolved tenant context */
|
|
23
|
+
tenantContext?: TenantContext;
|
|
24
|
+
/** Proxy metadata */
|
|
25
|
+
proxyMetadata: ProxyRequestMetadata;
|
|
26
|
+
/** Raw message size in bytes */
|
|
27
|
+
sizeBytes: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Proxy-specific request metadata
|
|
31
|
+
*/
|
|
32
|
+
export interface ProxyRequestMetadata {
|
|
33
|
+
/** Request received timestamp */
|
|
34
|
+
receivedAt: Date;
|
|
35
|
+
/** Is this request cacheable? */
|
|
36
|
+
cacheable: boolean;
|
|
37
|
+
/** Cache key if cacheable */
|
|
38
|
+
cacheKey?: string;
|
|
39
|
+
/** Rate limit state at time of request */
|
|
40
|
+
rateLimitState?: RateLimitState;
|
|
41
|
+
/** Transformations applied to request */
|
|
42
|
+
transformationsApplied: string[];
|
|
43
|
+
/** Request source (for logging) */
|
|
44
|
+
source: 'stdio' | 'sse' | 'http';
|
|
45
|
+
/** Session ID if applicable */
|
|
46
|
+
sessionId?: string;
|
|
47
|
+
/** Client info if available */
|
|
48
|
+
clientInfo?: ClientInfo;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Client information
|
|
52
|
+
*/
|
|
53
|
+
export interface ClientInfo {
|
|
54
|
+
/** Client name */
|
|
55
|
+
name?: string;
|
|
56
|
+
/** Client version */
|
|
57
|
+
version?: string;
|
|
58
|
+
/** User agent */
|
|
59
|
+
userAgent?: string;
|
|
60
|
+
/** IP address (for HTTP/SSE) */
|
|
61
|
+
ipAddress?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Extended MCP response with proxy metadata
|
|
65
|
+
*/
|
|
66
|
+
export interface ProxyMCPResponse {
|
|
67
|
+
/** Original JSON-RPC message */
|
|
68
|
+
message: JSONRPCMessage;
|
|
69
|
+
/** Correlation ID from request */
|
|
70
|
+
correlationId: string;
|
|
71
|
+
/** Response timestamp */
|
|
72
|
+
timestamp: Date;
|
|
73
|
+
/** Proxy metadata */
|
|
74
|
+
proxyMetadata: ProxyResponseMetadata;
|
|
75
|
+
/** Raw message size in bytes */
|
|
76
|
+
sizeBytes: number;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Proxy-specific response metadata
|
|
80
|
+
*/
|
|
81
|
+
export interface ProxyResponseMetadata {
|
|
82
|
+
/** Total request duration in milliseconds */
|
|
83
|
+
durationMs: number;
|
|
84
|
+
/** Upstream response time in milliseconds */
|
|
85
|
+
upstreamDurationMs: number;
|
|
86
|
+
/** Was response served from cache? */
|
|
87
|
+
cached: boolean;
|
|
88
|
+
/** Cache TTL if cached (seconds) */
|
|
89
|
+
cacheTtl?: number;
|
|
90
|
+
/** Cache key if cached */
|
|
91
|
+
cacheKey?: string;
|
|
92
|
+
/** Transformations applied to response */
|
|
93
|
+
transformationsApplied: string[];
|
|
94
|
+
/** Was request rate limited? */
|
|
95
|
+
rateLimited: boolean;
|
|
96
|
+
/** Was successful response? */
|
|
97
|
+
success: boolean;
|
|
98
|
+
/** Error code if not successful */
|
|
99
|
+
errorCode?: number;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* MCP method categories for routing and metrics
|
|
103
|
+
*/
|
|
104
|
+
export type MCPMethodCategory = 'initialization' | 'tools' | 'resources' | 'prompts' | 'logging' | 'completion' | 'notification' | 'unknown';
|
|
105
|
+
/**
|
|
106
|
+
* Get category for an MCP method
|
|
107
|
+
*/
|
|
108
|
+
export declare function getMCPMethodCategory(method: string): MCPMethodCategory;
|
|
109
|
+
/**
|
|
110
|
+
* Check if an MCP method has side effects (should not be cached)
|
|
111
|
+
*/
|
|
112
|
+
export declare function hasSideEffects(method: string): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Check if an MCP method is a notification (no response expected)
|
|
115
|
+
*/
|
|
116
|
+
export declare function isNotification(method: string): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* MCP error codes
|
|
119
|
+
*/
|
|
120
|
+
export declare const MCP_ERROR_CODES: {
|
|
121
|
+
readonly PARSE_ERROR: -32700;
|
|
122
|
+
readonly INVALID_REQUEST: -32600;
|
|
123
|
+
readonly METHOD_NOT_FOUND: -32601;
|
|
124
|
+
readonly INVALID_PARAMS: -32602;
|
|
125
|
+
readonly INTERNAL_ERROR: -32603;
|
|
126
|
+
readonly RATE_LIMITED: -32001;
|
|
127
|
+
readonly AUTHENTICATION_FAILED: -32002;
|
|
128
|
+
readonly UPSTREAM_ERROR: -32003;
|
|
129
|
+
readonly TIMEOUT: -32004;
|
|
130
|
+
readonly CACHE_ERROR: -32005;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Create a JSON-RPC error response
|
|
134
|
+
*/
|
|
135
|
+
export declare function createErrorResponse(id: string | number | null, code: number, message: string, data?: unknown): JSONRPCMessage;
|
|
136
|
+
/**
|
|
137
|
+
* Create a JSON-RPC success response
|
|
138
|
+
*/
|
|
139
|
+
export declare function createSuccessResponse(id: string | number | null, result: unknown): JSONRPCMessage;
|
|
140
|
+
/**
|
|
141
|
+
* Extract method from JSON-RPC message
|
|
142
|
+
*/
|
|
143
|
+
export declare function extractMethod(message: JSONRPCMessage): string | undefined;
|
|
144
|
+
/**
|
|
145
|
+
* Extract ID from JSON-RPC message
|
|
146
|
+
*/
|
|
147
|
+
export declare function extractId(message: JSONRPCMessage): string | number | null;
|
|
148
|
+
/**
|
|
149
|
+
* Check if message is a request (has method and id)
|
|
150
|
+
*/
|
|
151
|
+
export declare function isRequest(message: JSONRPCMessage): boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Check if message is a response (has result or error)
|
|
154
|
+
*/
|
|
155
|
+
export declare function isResponse(message: JSONRPCMessage): boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Check if message is an error response
|
|
158
|
+
*/
|
|
159
|
+
export declare function isErrorResponse(message: JSONRPCMessage): boolean;
|
|
160
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/types/mcp.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,gCAAgC;IAChC,OAAO,EAAE,cAAc,CAAC;IAExB,6BAA6B;IAC7B,aAAa,EAAE,MAAM,CAAC;IAEtB,wBAAwB;IACxB,SAAS,EAAE,IAAI,CAAC;IAEhB,sCAAsC;IACtC,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B,8BAA8B;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