mcp4openapi 0.3.1 → 0.3.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.
Files changed (152) hide show
  1. package/README.md +7 -0
  2. package/dist/src/core/cli-config.d.ts.map +1 -1
  3. package/dist/src/core/cli-config.js +2 -0
  4. package/dist/src/core/cli-config.js.map +1 -1
  5. package/dist/src/core/index.d.ts.map +1 -1
  6. package/dist/src/core/index.js +18 -3
  7. package/dist/src/core/index.js.map +1 -1
  8. package/dist/src/index.js +0 -0
  9. package/dist/src/profile/profile-allowlist.d.ts +18 -0
  10. package/dist/src/profile/profile-allowlist.d.ts.map +1 -0
  11. package/dist/src/profile/profile-allowlist.js +68 -0
  12. package/dist/src/profile/profile-allowlist.js.map +1 -0
  13. package/dist/src/profile/profile-registry.d.ts +5 -0
  14. package/dist/src/profile/profile-registry.d.ts.map +1 -1
  15. package/dist/src/profile/profile-registry.js +38 -14
  16. package/dist/src/profile/profile-registry.js.map +1 -1
  17. package/package.json +2 -2
  18. package/profiles/gitlab/developer-profile-oauth.json +243 -41
  19. package/profiles/gitlab/developer-profile-oauth.test.json +1009 -5
  20. package/profiles/gitlab/openapi.yaml +1419 -164
  21. package/profiles/gitlab/profile-optimized-oauth.json +785 -0
  22. package/profiles/gitlab/profile-optimized-oauth.test.json +1566 -0
  23. package/profiles/grafana/openapi.json +28078 -0
  24. package/profiles/grafana/profile.json +1083 -0
  25. package/profiles/grafana/profile.test.json +235 -0
  26. package/profiles/mattermost/openapi.yaml +27434 -0
  27. package/profiles/mattermost/profile.json +463 -0
  28. package/profiles/mattermost/profile.test.json +607 -0
  29. package/profiles/n8n/profile-optimized.json +1002 -364
  30. package/profiles/n8n/profile-optimized.test.json +43 -43
  31. package/dist/src/argument-normalizer.d.ts +0 -5
  32. package/dist/src/argument-normalizer.d.ts.map +0 -1
  33. package/dist/src/argument-normalizer.js +0 -61
  34. package/dist/src/argument-normalizer.js.map +0 -1
  35. package/dist/src/cli-config.d.ts +0 -9
  36. package/dist/src/cli-config.d.ts.map +0 -1
  37. package/dist/src/cli-config.js +0 -111
  38. package/dist/src/cli-config.js.map +0 -1
  39. package/dist/src/composite-executor.d.ts +0 -77
  40. package/dist/src/composite-executor.d.ts.map +0 -1
  41. package/dist/src/composite-executor.js +0 -193
  42. package/dist/src/composite-executor.js.map +0 -1
  43. package/dist/src/constants.d.ts +0 -85
  44. package/dist/src/constants.d.ts.map +0 -1
  45. package/dist/src/constants.js +0 -85
  46. package/dist/src/constants.js.map +0 -1
  47. package/dist/src/dag-executor.d.ts +0 -49
  48. package/dist/src/dag-executor.d.ts.map +0 -1
  49. package/dist/src/dag-executor.js +0 -138
  50. package/dist/src/dag-executor.js.map +0 -1
  51. package/dist/src/errors.d.ts +0 -59
  52. package/dist/src/errors.d.ts.map +0 -1
  53. package/dist/src/errors.js +0 -119
  54. package/dist/src/errors.js.map +0 -1
  55. package/dist/src/filtering.d.ts +0 -19
  56. package/dist/src/filtering.d.ts.map +0 -1
  57. package/dist/src/filtering.js +0 -292
  58. package/dist/src/filtering.js.map +0 -1
  59. package/dist/src/http-client-factory.d.ts +0 -62
  60. package/dist/src/http-client-factory.d.ts.map +0 -1
  61. package/dist/src/http-client-factory.js +0 -133
  62. package/dist/src/http-client-factory.js.map +0 -1
  63. package/dist/src/http-transport-config.d.ts +0 -6
  64. package/dist/src/http-transport-config.d.ts.map +0 -1
  65. package/dist/src/http-transport-config.js +0 -47
  66. package/dist/src/http-transport-config.js.map +0 -1
  67. package/dist/src/http-transport.d.ts +0 -316
  68. package/dist/src/http-transport.d.ts.map +0 -1
  69. package/dist/src/http-transport.js +0 -2412
  70. package/dist/src/http-transport.js.map +0 -1
  71. package/dist/src/interceptors.d.ts +0 -116
  72. package/dist/src/interceptors.d.ts.map +0 -1
  73. package/dist/src/interceptors.js +0 -392
  74. package/dist/src/interceptors.js.map +0 -1
  75. package/dist/src/jsonrpc-validator.d.ts +0 -27
  76. package/dist/src/jsonrpc-validator.d.ts.map +0 -1
  77. package/dist/src/jsonrpc-validator.js +0 -58
  78. package/dist/src/jsonrpc-validator.js.map +0 -1
  79. package/dist/src/logger.d.ts +0 -59
  80. package/dist/src/logger.d.ts.map +0 -1
  81. package/dist/src/logger.js +0 -177
  82. package/dist/src/logger.js.map +0 -1
  83. package/dist/src/mcp-server-manager.d.ts +0 -20
  84. package/dist/src/mcp-server-manager.d.ts.map +0 -1
  85. package/dist/src/mcp-server-manager.js +0 -38
  86. package/dist/src/mcp-server-manager.js.map +0 -1
  87. package/dist/src/mcp-server.d.ts +0 -203
  88. package/dist/src/mcp-server.d.ts.map +0 -1
  89. package/dist/src/mcp-server.js +0 -1369
  90. package/dist/src/mcp-server.js.map +0 -1
  91. package/dist/src/metrics.d.ts +0 -97
  92. package/dist/src/metrics.d.ts.map +0 -1
  93. package/dist/src/metrics.js +0 -273
  94. package/dist/src/metrics.js.map +0 -1
  95. package/dist/src/naming-warnings.d.ts +0 -23
  96. package/dist/src/naming-warnings.d.ts.map +0 -1
  97. package/dist/src/naming-warnings.js +0 -83
  98. package/dist/src/naming-warnings.js.map +0 -1
  99. package/dist/src/naming.d.ts +0 -58
  100. package/dist/src/naming.d.ts.map +0 -1
  101. package/dist/src/naming.js +0 -510
  102. package/dist/src/naming.js.map +0 -1
  103. package/dist/src/oauth-provider.d.ts +0 -131
  104. package/dist/src/oauth-provider.d.ts.map +0 -1
  105. package/dist/src/oauth-provider.js +0 -836
  106. package/dist/src/oauth-provider.js.map +0 -1
  107. package/dist/src/openapi-parser.d.ts +0 -70
  108. package/dist/src/openapi-parser.d.ts.map +0 -1
  109. package/dist/src/openapi-parser.js +0 -436
  110. package/dist/src/openapi-parser.js.map +0 -1
  111. package/dist/src/profile-loader.d.ts +0 -78
  112. package/dist/src/profile-loader.d.ts.map +0 -1
  113. package/dist/src/profile-loader.js +0 -483
  114. package/dist/src/profile-loader.js.map +0 -1
  115. package/dist/src/profile-registry.d.ts +0 -18
  116. package/dist/src/profile-registry.d.ts.map +0 -1
  117. package/dist/src/profile-registry.js +0 -26
  118. package/dist/src/profile-registry.js.map +0 -1
  119. package/dist/src/profile-resolver.d.ts +0 -19
  120. package/dist/src/profile-resolver.d.ts.map +0 -1
  121. package/dist/src/profile-resolver.js +0 -167
  122. package/dist/src/profile-resolver.js.map +0 -1
  123. package/dist/src/proxy-executor.d.ts +0 -86
  124. package/dist/src/proxy-executor.d.ts.map +0 -1
  125. package/dist/src/proxy-executor.js +0 -497
  126. package/dist/src/proxy-executor.js.map +0 -1
  127. package/dist/src/schema-validator.d.ts +0 -30
  128. package/dist/src/schema-validator.d.ts.map +0 -1
  129. package/dist/src/schema-validator.js +0 -128
  130. package/dist/src/schema-validator.js.map +0 -1
  131. package/dist/src/startup-profile.d.ts +0 -17
  132. package/dist/src/startup-profile.d.ts.map +0 -1
  133. package/dist/src/startup-profile.js +0 -30
  134. package/dist/src/startup-profile.js.map +0 -1
  135. package/dist/src/startup-validation.d.ts +0 -11
  136. package/dist/src/startup-validation.d.ts.map +0 -1
  137. package/dist/src/startup-validation.js +0 -21
  138. package/dist/src/startup-validation.js.map +0 -1
  139. package/dist/src/tool-filter.d.ts +0 -65
  140. package/dist/src/tool-filter.d.ts.map +0 -1
  141. package/dist/src/tool-filter.js +0 -471
  142. package/dist/src/tool-filter.js.map +0 -1
  143. package/dist/src/tool-generator.d.ts +0 -67
  144. package/dist/src/tool-generator.d.ts.map +0 -1
  145. package/dist/src/tool-generator.js +0 -182
  146. package/dist/src/tool-generator.js.map +0 -1
  147. package/dist/src/validation-utils.d.ts +0 -49
  148. package/dist/src/validation-utils.d.ts.map +0 -1
  149. package/dist/src/validation-utils.js +0 -138
  150. package/dist/src/validation-utils.js.map +0 -1
  151. package/profiles/gitlab/developer-profile.json +0 -1508
  152. package/profiles/gitlab/developer-profile.test.json +0 -3432
@@ -1,128 +0,0 @@
1
- /**
2
- * Request body schema validator
3
- *
4
- * Why: Catch invalid requests before sending to API. Better error messages for users.
5
- * Validates against OpenAPI schema definitions.
6
- */
7
- import { isEmail, isUri } from './validation-utils.js';
8
- export class SchemaValidator {
9
- /**
10
- * Validate request body against OpenAPI schema
11
- *
12
- * Why: Prevents sending malformed requests. OpenAPI schema is the source of truth.
13
- */
14
- validateRequestBody(operation, body) {
15
- if (!operation.requestBody?.content['application/json']?.schema) {
16
- return { valid: true };
17
- }
18
- const schema = operation.requestBody.content['application/json'].schema;
19
- const errors = [];
20
- this.validateAgainstSchema(body, schema, '', errors);
21
- return {
22
- valid: errors.length === 0,
23
- errors: errors.length > 0 ? errors : undefined,
24
- };
25
- }
26
- /**
27
- * Recursively validate data against schema
28
- */
29
- validateAgainstSchema(data, schema, path, errors) {
30
- // Null/undefined handling
31
- if (data === null || data === undefined) {
32
- if (schema.type && schema.type !== 'null') {
33
- errors.push({
34
- path: path || '(root)',
35
- message: `Expected ${schema.type}, got ${data}`,
36
- schema,
37
- value: data,
38
- });
39
- }
40
- return;
41
- }
42
- // Type validation
43
- if (schema.type) {
44
- const actualType = Array.isArray(data) ? 'array' : typeof data;
45
- // OpenAPI 'integer' is a subtype of 'number' with format constraint
46
- const expectedType = schema.type === 'integer' ? 'number' : schema.type;
47
- if (actualType !== expectedType) {
48
- errors.push({
49
- path: path || '(root)',
50
- message: `Expected ${schema.type}, got ${actualType}`,
51
- schema,
52
- value: data,
53
- });
54
- return; // Stop validation if type is wrong
55
- }
56
- // Additional integer validation: check it's actually an integer
57
- if (schema.type === 'integer' && typeof data === 'number') {
58
- if (!Number.isInteger(data)) {
59
- errors.push({
60
- path: path || '(root)',
61
- message: `Expected integer, got number`,
62
- schema,
63
- value: data,
64
- });
65
- }
66
- }
67
- }
68
- // Enum validation
69
- // Note: Using 'as any' here is safe - we're checking if value exists in enum array
70
- // TypeScript doesn't know the enum values at compile time
71
- if (schema.enum && !schema.enum.includes(data)) {
72
- errors.push({
73
- path: path || '(root)',
74
- message: `Value must be one of: ${schema.enum.join(', ')}`,
75
- schema,
76
- value: data,
77
- });
78
- }
79
- // Object properties validation
80
- if (schema.type === 'object' && schema.properties) {
81
- const obj = data;
82
- // Check required properties
83
- for (const required of schema.required || []) {
84
- if (obj[required] === undefined) {
85
- errors.push({
86
- path: path ? `${path}.${required}` : required,
87
- message: 'Required property is missing',
88
- schema,
89
- value: undefined,
90
- });
91
- }
92
- }
93
- // Validate each property
94
- for (const [key, value] of Object.entries(obj)) {
95
- if (schema.properties[key]) {
96
- this.validateAgainstSchema(value, schema.properties[key], path ? `${path}.${key}` : key, errors);
97
- }
98
- // Note: Not validating additionalProperties (too strict for most APIs)
99
- }
100
- }
101
- // Array items validation
102
- if (schema.type === 'array' && schema.items && Array.isArray(data)) {
103
- data.forEach((item, index) => {
104
- this.validateAgainstSchema(item, schema.items, `${path}[${index}]`, errors);
105
- });
106
- }
107
- // String format validation (basic)
108
- if (schema.type === 'string' && schema.format && typeof data === 'string') {
109
- if (schema.format === 'email' && !isEmail(data)) {
110
- errors.push({
111
- path: path || '(root)',
112
- message: 'Invalid email format',
113
- schema,
114
- value: data,
115
- });
116
- }
117
- if (schema.format === 'uri' && !isUri(data)) {
118
- errors.push({
119
- path: path || '(root)',
120
- message: 'Invalid URI format',
121
- schema,
122
- value: data,
123
- });
124
- }
125
- }
126
- }
127
- }
128
- //# sourceMappingURL=schema-validator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-validator.js","sourceRoot":"","sources":["../../src/schema-validator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAcvD,MAAM,OAAO,eAAe;IAC1B;;;;OAIG;IACH,mBAAmB,CACjB,SAAwB,EACxB,IAA6B;QAE7B,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;YAChE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAED,MAAM,MAAM,GAAG,SAAS,CAAC,W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QAAQ;oBACtB,OAAO,EAAE,sBAAsB;oBAC/B,MAAM;oBACN,KAAK,EAAE,IAAI;iBACZ,CAAC,CAAC;YACL,CAAC;YACD,IAAI,MAAM,CAAC,MAAM,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC5C,MAAM,CAAC,IAAI,CAAC;oBACV,IAAI,EAAE,IAAI,IAAI,QAAQ;oBACtB,OAAO,EAAE,oBAAoB;oBAC7B,MAAM;oBACN,KAAK,EAAE,IAAI;iBACZ,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;CAEF"}
@@ -1,17 +0,0 @@
1
- import { type ResolvedProfile } from './profile-resolver.js';
2
- interface StartupProfileOptions {
3
- specPathEnv?: string;
4
- profilePath?: string;
5
- profileId?: string;
6
- profilesDir?: string;
7
- }
8
- interface StartupProfileResult {
9
- specPath?: string;
10
- profilePath?: string;
11
- profileId?: string;
12
- defaultProfile?: ResolvedProfile;
13
- hasExplicitSpecPath: boolean;
14
- }
15
- export declare function resolveStartupProfile(options: StartupProfileOptions): Promise<StartupProfileResult>;
16
- export {};
17
- //# sourceMappingURL=startup-profile.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"startup-profile.d.ts","sourceRoot":"","sources":["../../src/startup-profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAEzG,UAAU,qBAAqB;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,eAAe,CAAC;IACjC,mBAAmB,EAAE,OAAO,CAAC;CAC9B;AAED,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA4BzG"}
@@ -1,30 +0,0 @@
1
- import { resolveProfileById, resolveProfileFromPath } from './profile-resolver.js';
2
- export async function resolveStartupProfile(options) {
3
- const hasExplicitSpecPath = !!options.specPathEnv;
4
- let specPath = options.specPathEnv;
5
- let profilePath = options.profilePath;
6
- let profileId = options.profileId;
7
- let defaultProfile;
8
- if (!profilePath && profileId) {
9
- const resolved = await resolveProfileById(profileId, options.profilesDir, { specPathOverride: specPath });
10
- defaultProfile = resolved;
11
- profilePath = resolved.profilePath;
12
- profileId = resolved.profileId;
13
- specPath = resolved.specPath;
14
- }
15
- else if (profilePath) {
16
- const resolved = await resolveProfileFromPath(profilePath, { specPathOverride: specPath });
17
- defaultProfile = resolved;
18
- profilePath = resolved.profilePath;
19
- profileId = resolved.profileId;
20
- specPath = resolved.specPath;
21
- }
22
- return {
23
- specPath,
24
- profilePath,
25
- profileId,
26
- defaultProfile,
27
- hasExplicitSpecPath,
28
- };
29
- }
30
- //# sourceMappingURL=startup-profile.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"startup-profile.js","sourceRoot":"","sources":["../../src/startup-profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAwB,MAAM,uBAAuB,CAAC;AAiBzG,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAA8B;IACxE,MAAM,mBAAmB,GAAG,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;IAClD,IAAI,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC;IACnC,IAAI,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IACtC,IAAI,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IAClC,IAAI,cAA2C,CAAC;IAEhD,IAAI,CAAC,WAAW,IAAI,SAAS,EAAE,CAAC;QAC9B,MAAM,QAAQ,GAAG,MAAM,kBAAkB,CAAC,SAAS,EAAE,OAAO,CAAC,WAAW,EAAE,EAAE,gBAAgB,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC1G,cAAc,GAAG,QAAQ,CAAC;QAC1B,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC;QACnC,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;QAC/B,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;IAC/B,CAAC;SAAM,IAAI,WAAW,EAAE,CAAC;QACvB,MAAM,QAAQ,GAAG,MAAM,sBAAsB,CAAC,WAAW,EAAE,EAAE,gBAAgB,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC3F,cAAc,GAAG,QAAQ,CAAC;QAC1B,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC;QACnC,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;QAC/B,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;IAC/B,CAAC;IAED,OAAO;QACL,QAAQ;QACR,WAAW;QACX,SAAS;QACT,cAAc;QACd,mBAAmB;KACpB,CAAC;AACJ,CAAC"}
@@ -1,11 +0,0 @@
1
- /**
2
- * Startup validation helpers for CLI.
3
- */
4
- export declare const HTTP_PROFILE_ROUTING_ERROR: string;
5
- export declare function getHttpProfileRoutingErrorMessage(options: {
6
- transport: string;
7
- profileRoutingEnabled: boolean;
8
- hasDefaultProfile: boolean;
9
- hasSpecPath: boolean;
10
- }): string | null;
11
- //# sourceMappingURL=startup-validation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"startup-validation.d.ts","sourceRoot":"","sources":["../../src/startup-validation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,0BAA0B,QAEkG,CAAC;AAE1I,wBAAgB,iCAAiC,CAAC,OAAO,EAAE;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,WAAW,EAAE,OAAO,CAAC;CACtB,GAAG,MAAM,GAAG,IAAI,CAchB"}
@@ -1,21 +0,0 @@
1
- /**
2
- * Startup validation helpers for CLI.
3
- */
4
- export const HTTP_PROFILE_ROUTING_ERROR = 'HTTP profile routing is disabled and no default profile is configured.\n' +
5
- 'Set MCP4_HTTP_PROFILE_ROUTING=true to enable /profile/:id/mcp routes, or provide MCP4_PROFILE_PATH (or --profile-path) to serve /mcp.';
6
- export function getHttpProfileRoutingErrorMessage(options) {
7
- if (options.transport !== 'http') {
8
- return null;
9
- }
10
- if (options.hasDefaultProfile) {
11
- return null;
12
- }
13
- if (options.hasSpecPath) {
14
- return null;
15
- }
16
- if (options.profileRoutingEnabled) {
17
- return null;
18
- }
19
- return HTTP_PROFILE_ROUTING_ERROR;
20
- }
21
- //# sourceMappingURL=startup-validation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"startup-validation.js","sourceRoot":"","sources":["../../src/startup-validation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,0BAA0B,GACrC,0EAA0E;IAC1E,uIAAuI,CAAC;AAE1I,MAAM,UAAU,iCAAiC,CAAC,OAKjD;IACC,IAAI,OAAO,CAAC,SAAS,KAAK,MAAM,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,OAAO,CAAC,qBAAqB,EAAE,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,0BAA0B,CAAC;AACpC,CAAC"}
@@ -1,65 +0,0 @@
1
- import type { ToolDefinition } from './types/profile.js';
2
- import type { OperationInfo } from './types/openapi.js';
3
- export interface ToolFilterConfig {
4
- allowList: Set<string>;
5
- denyList: Set<string>;
6
- allowRegex: RegExp[];
7
- denyRegex: RegExp[];
8
- allowCategories: Set<'list' | 'read'>;
9
- hasAllowRules: boolean;
10
- sources: {
11
- allowList: string[];
12
- allowRegex: string[];
13
- denyList: string[];
14
- denyRegex: string[];
15
- allowCategories: string[];
16
- };
17
- }
18
- export interface ToolFilterResult {
19
- allowed: ToolDefinition[];
20
- removed: ToolDefinition[];
21
- reasons: Map<string, string[]>;
22
- }
23
- export interface SessionToolFilterRequest {
24
- exactNames: Set<string>;
25
- regexPatterns: RegExp[];
26
- allowComposite: {
27
- allowList: boolean;
28
- allowRead: boolean;
29
- };
30
- normalizedHeader: string;
31
- rawEntries: string[];
32
- hasRules: boolean;
33
- }
34
- export interface SessionToolFilter {
35
- allowedToolNames: Set<string>;
36
- reasons: Map<string, string[]>;
37
- patterns: {
38
- allow: RegExp[];
39
- };
40
- allowComposite: {
41
- allowList: boolean;
42
- allowRead: boolean;
43
- };
44
- normalizedHeader: string;
45
- }
46
- export interface ToolFilterOperationResolver {
47
- getOperationById?: (operationId: string) => OperationInfo | undefined;
48
- getOperationForCall?: (call: string) => OperationInfo | undefined;
49
- }
50
- export declare function normalizeToolName(name: string): string;
51
- export declare function normalizeToolFilterHeaderValue(value?: string): string | undefined;
52
- export declare function parseToolFilterConfig(env: NodeJS.ProcessEnv): ToolFilterConfig | undefined;
53
- export declare function parseSessionToolFilterHeader(headerValue: string, maxEntries?: number): SessionToolFilterRequest;
54
- export declare function applyToolFilter(tools: ToolDefinition[], config: ToolFilterConfig, resolver?: ToolFilterOperationResolver): ToolFilterResult;
55
- export declare function applySessionToolFilter(tools: ToolDefinition[], request: SessionToolFilterRequest, resolver?: ToolFilterOperationResolver): SessionToolFilter;
56
- export declare function detectListReadOperations(tool: ToolDefinition, resolver?: ToolFilterOperationResolver): {
57
- isList: boolean;
58
- isRead: boolean;
59
- };
60
- export declare function validateRegexPattern(pattern: string): {
61
- valid: boolean;
62
- error?: string;
63
- };
64
- export declare function getSessionToolFilterMaxEntries(): number;
65
- //# sourceMappingURL=tool-filter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tool-filter.d.ts","sourceRoot":"","sources":["../../src/tool-filter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAOxD,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,eAAe,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IACtC,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE;QACP,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,UAAU,EAAE,MAAM,EAAE,CAAC;QACrB,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,eAAe,EAAE,MAAM,EAAE,CAAC;KAC3B,CAAC;CACH;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACxB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,cAAc,EAAE;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC;IAC3D,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;CAC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