mcp4openapi 0.1.0 → 0.2.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/README.md +134 -95
- package/dist/scripts/validate-profile.js +3 -3
- package/dist/scripts/validate-profile.js.map +1 -1
- package/dist/src/composite-executor.d.ts +3 -1
- package/dist/src/composite-executor.d.ts.map +1 -1
- package/dist/src/composite-executor.js +16 -5
- package/dist/src/composite-executor.js.map +1 -1
- package/dist/src/constants.d.ts +49 -0
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +49 -0
- package/dist/src/constants.js.map +1 -1
- package/dist/src/errors.d.ts +6 -0
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/errors.js +13 -0
- package/dist/src/errors.js.map +1 -1
- package/dist/src/generated-schemas.d.ts +832 -52
- package/dist/src/generated-schemas.d.ts.map +1 -1
- package/dist/src/generated-schemas.js +31 -8
- package/dist/src/generated-schemas.js.map +1 -1
- package/dist/src/http-client-factory.d.ts.map +1 -1
- package/dist/src/http-client-factory.js +14 -3
- package/dist/src/http-client-factory.js.map +1 -1
- package/dist/src/http-transport.d.ts +65 -0
- package/dist/src/http-transport.d.ts.map +1 -1
- package/dist/src/http-transport.js +921 -77
- package/dist/src/http-transport.js.map +1 -1
- package/dist/src/index.js +108 -8
- package/dist/src/index.js.map +1 -1
- package/dist/src/interceptors.d.ts +3 -0
- package/dist/src/interceptors.d.ts.map +1 -1
- package/dist/src/interceptors.js +50 -8
- package/dist/src/interceptors.js.map +1 -1
- package/dist/src/logger.d.ts +1 -1
- package/dist/src/logger.js +3 -3
- package/dist/src/logger.js.map +1 -1
- package/dist/src/mcp-server.d.ts +33 -0
- package/dist/src/mcp-server.d.ts.map +1 -1
- package/dist/src/mcp-server.js +263 -54
- package/dist/src/mcp-server.js.map +1 -1
- package/dist/src/oauth-provider.d.ts +92 -0
- package/dist/src/oauth-provider.d.ts.map +1 -0
- package/dist/src/oauth-provider.js +588 -0
- package/dist/src/oauth-provider.js.map +1 -0
- package/dist/src/openapi-parser.d.ts +16 -0
- package/dist/src/openapi-parser.d.ts.map +1 -1
- package/dist/src/openapi-parser.js +141 -6
- package/dist/src/openapi-parser.js.map +1 -1
- package/dist/src/profile-loader.d.ts +2 -2
- package/dist/src/profile-loader.d.ts.map +1 -1
- package/dist/src/profile-loader.js +45 -24
- package/dist/src/profile-loader.js.map +1 -1
- package/dist/src/testing/fixtures.d.ts +32 -0
- package/dist/src/testing/fixtures.d.ts.map +1 -1
- package/dist/src/testing/fixtures.js +26 -0
- package/dist/src/testing/fixtures.js.map +1 -1
- package/dist/src/testing/mock-gitlab-server.d.ts.map +1 -1
- package/dist/src/testing/mock-gitlab-server.js +131 -1
- package/dist/src/testing/mock-gitlab-server.js.map +1 -1
- package/dist/src/types/http-transport.d.ts +16 -0
- package/dist/src/types/http-transport.d.ts.map +1 -1
- package/dist/src/types/openapi.d.ts +5 -0
- package/dist/src/types/openapi.d.ts.map +1 -1
- package/dist/src/types/profile.d.ts +112 -3
- package/dist/src/types/profile.d.ts.map +1 -1
- package/dist/src/validation-utils.d.ts +12 -0
- package/dist/src/validation-utils.d.ts.map +1 -1
- package/dist/src/validation-utils.js +17 -0
- package/dist/src/validation-utils.js.map +1 -1
- package/package.json +7 -3
- package/profile-schema.json +169 -7
- package/dist/composite-executor.d.ts +0 -65
- package/dist/composite-executor.d.ts.map +0 -1
- package/dist/composite-executor.js +0 -147
- package/dist/composite-executor.js.map +0 -1
- package/dist/constants.d.ts +0 -36
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -36
- package/dist/constants.js.map +0 -1
- package/dist/http-transport.d.ts +0 -195
- package/dist/http-transport.d.ts.map +0 -1
- package/dist/http-transport.js +0 -760
- package/dist/http-transport.js.map +0 -1
- package/dist/interceptors.d.ts +0 -74
- package/dist/interceptors.d.ts.map +0 -1
- package/dist/interceptors.js +0 -220
- package/dist/interceptors.js.map +0 -1
- package/dist/logger.d.ts +0 -81
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -264
- package/dist/logger.js.map +0 -1
- package/dist/mcp-server.d.ts +0 -110
- package/dist/mcp-server.d.ts.map +0 -1
- package/dist/mcp-server.js +0 -568
- package/dist/mcp-server.js.map +0 -1
- package/dist/metrics.d.ts +0 -86
- package/dist/metrics.d.ts.map +0 -1
- package/dist/metrics.js +0 -229
- package/dist/metrics.js.map +0 -1
- package/dist/openapi-parser.d.ts +0 -35
- package/dist/openapi-parser.d.ts.map +0 -1
- package/dist/openapi-parser.js +0 -160
- package/dist/openapi-parser.js.map +0 -1
- package/dist/profile-loader.d.ts +0 -25
- package/dist/profile-loader.d.ts.map +0 -1
- package/dist/profile-loader.js +0 -134
- package/dist/profile-loader.js.map +0 -1
- package/dist/schema-validator.d.ts +0 -32
- package/dist/schema-validator.d.ts.map +0 -1
- package/dist/schema-validator.js +0 -126
- package/dist/schema-validator.js.map +0 -1
- package/dist/testing/fixtures.d.ts +0 -186
- package/dist/testing/fixtures.d.ts.map +0 -1
- package/dist/testing/fixtures.js +0 -135
- package/dist/testing/fixtures.js.map +0 -1
- package/dist/testing/http-integration.test.d.ts +0 -7
- package/dist/testing/http-integration.test.d.ts.map +0 -1
- package/dist/testing/http-integration.test.js +0 -383
- package/dist/testing/http-integration.test.js.map +0 -1
- package/dist/testing/http-multiuser.test.d.ts +0 -10
- package/dist/testing/http-multiuser.test.d.ts.map +0 -1
- package/dist/testing/http-multiuser.test.js +0 -255
- package/dist/testing/http-multiuser.test.js.map +0 -1
- package/dist/testing/integration.test.d.ts +0 -8
- package/dist/testing/integration.test.d.ts.map +0 -1
- package/dist/testing/integration.test.js +0 -247
- package/dist/testing/integration.test.js.map +0 -1
- package/dist/testing/mock-gitlab-server.d.ts +0 -34
- package/dist/testing/mock-gitlab-server.d.ts.map +0 -1
- package/dist/testing/mock-gitlab-server.js +0 -224
- package/dist/testing/mock-gitlab-server.js.map +0 -1
- package/dist/testing/test-types.d.ts +0 -59
- package/dist/testing/test-types.d.ts.map +0 -1
- package/dist/testing/test-types.js +0 -7
- package/dist/testing/test-types.js.map +0 -1
- package/dist/tool-generator.d.ts +0 -43
- package/dist/tool-generator.d.ts.map +0 -1
- package/dist/tool-generator.js +0 -123
- package/dist/tool-generator.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/types/http-transport.d.ts +0 -39
- package/dist/types/http-transport.d.ts.map +0 -1
- package/dist/types/http-transport.js +0 -8
- package/dist/types/http-transport.js.map +0 -1
- package/dist/types/openapi.d.ts +0 -50
- package/dist/types/openapi.d.ts.map +0 -1
- package/dist/types/openapi.js +0 -9
- package/dist/types/openapi.js.map +0 -1
- package/dist/types/profile.d.ts +0 -76
- package/dist/types/profile.d.ts.map +0 -1
- package/dist/types/profile.js +0 -9
- package/dist/types/profile.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-types.js","sourceRoot":"","sources":["../../src/testing/test-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/dist/tool-generator.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP tool generator from profile definitions
|
|
3
|
-
*
|
|
4
|
-
* Why: Translates profile config into MCP SDK tool definitions. Handles both
|
|
5
|
-
* simple (single operation) and composite (multi-step) tools.
|
|
6
|
-
*/
|
|
7
|
-
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
8
|
-
import type { ToolDefinition } from './types/profile.js';
|
|
9
|
-
import type { OpenAPIParser } from './openapi-parser.js';
|
|
10
|
-
export declare class ToolGenerator {
|
|
11
|
-
private parser;
|
|
12
|
-
constructor(parser: OpenAPIParser);
|
|
13
|
-
/**
|
|
14
|
-
* Generate MCP tool from profile definition
|
|
15
|
-
*/
|
|
16
|
-
generateTool(toolDef: ToolDefinition): Tool;
|
|
17
|
-
/**
|
|
18
|
-
* Generate JSON Schema for tool parameters
|
|
19
|
-
*
|
|
20
|
-
* Why JSON Schema: MCP SDK expects JSON Schema for parameter validation.
|
|
21
|
-
* LLM uses schema to understand what parameters are needed.
|
|
22
|
-
*/
|
|
23
|
-
private generateInputSchema;
|
|
24
|
-
/**
|
|
25
|
-
* Convert parameter definition to JSON Schema
|
|
26
|
-
*/
|
|
27
|
-
private parameterToJsonSchema;
|
|
28
|
-
/**
|
|
29
|
-
* Validate tool arguments against parameter definitions
|
|
30
|
-
*
|
|
31
|
-
* Why manual validation: Checks conditional requirements (required_for)
|
|
32
|
-
* which JSON Schema can't express directly.
|
|
33
|
-
*/
|
|
34
|
-
validateArguments(toolDef: ToolDefinition, args: Record<string, unknown>): void;
|
|
35
|
-
/**
|
|
36
|
-
* Map tool action to OpenAPI operation ID
|
|
37
|
-
*
|
|
38
|
-
* Why: Single tool with 'action' parameter maps to multiple operations.
|
|
39
|
-
* Example: manage_badges + action=create => postApiV4ProjectsIdBadges
|
|
40
|
-
*/
|
|
41
|
-
mapActionToOperation(toolDef: ToolDefinition, args: Record<string, unknown>): string | undefined;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=tool-generator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool-generator.d.ts","sourceRoot":"","sources":["../src/tool-generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAuB,MAAM,oBAAoB,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,qBAAa,aAAa;IACZ,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAEzC;;OAEG;IACH,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAU3C;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IA2B3B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAqB7B;;;;;OAKG;IACH,iBAAiB,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IA4B/E;;;;;OAKG;IACH,oBAAoB,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS;CAwBjG"}
|
package/dist/tool-generator.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP tool generator from profile definitions
|
|
3
|
-
*
|
|
4
|
-
* Why: Translates profile config into MCP SDK tool definitions. Handles both
|
|
5
|
-
* simple (single operation) and composite (multi-step) tools.
|
|
6
|
-
*/
|
|
7
|
-
export class ToolGenerator {
|
|
8
|
-
parser;
|
|
9
|
-
constructor(parser) {
|
|
10
|
-
this.parser = parser;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Generate MCP tool from profile definition
|
|
14
|
-
*/
|
|
15
|
-
generateTool(toolDef) {
|
|
16
|
-
const inputSchema = this.generateInputSchema(toolDef);
|
|
17
|
-
return {
|
|
18
|
-
name: toolDef.name,
|
|
19
|
-
description: toolDef.description,
|
|
20
|
-
inputSchema,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Generate JSON Schema for tool parameters
|
|
25
|
-
*
|
|
26
|
-
* Why JSON Schema: MCP SDK expects JSON Schema for parameter validation.
|
|
27
|
-
* LLM uses schema to understand what parameters are needed.
|
|
28
|
-
*/
|
|
29
|
-
generateInputSchema(toolDef) {
|
|
30
|
-
const properties = {};
|
|
31
|
-
const required = [];
|
|
32
|
-
for (const [name, param] of Object.entries(toolDef.parameters)) {
|
|
33
|
-
properties[name] = this.parameterToJsonSchema(param);
|
|
34
|
-
// Add to required if unconditionally required
|
|
35
|
-
if (param.required) {
|
|
36
|
-
required.push(name);
|
|
37
|
-
}
|
|
38
|
-
// Add conditional requirement hints in description
|
|
39
|
-
if (param.required_for && param.required_for.length > 0) {
|
|
40
|
-
const existing = properties[name].description || '';
|
|
41
|
-
properties[name].description = existing +
|
|
42
|
-
` Required when action is: ${param.required_for.join(', ')}.`;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
type: 'object',
|
|
47
|
-
properties,
|
|
48
|
-
required: required.length > 0 ? required : undefined,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Convert parameter definition to JSON Schema
|
|
53
|
-
*/
|
|
54
|
-
parameterToJsonSchema(param) {
|
|
55
|
-
const schema = {
|
|
56
|
-
type: param.type,
|
|
57
|
-
description: param.description,
|
|
58
|
-
};
|
|
59
|
-
if (param.enum) {
|
|
60
|
-
schema.enum = param.enum;
|
|
61
|
-
}
|
|
62
|
-
if (param.default !== undefined) {
|
|
63
|
-
schema.default = param.default;
|
|
64
|
-
}
|
|
65
|
-
if (param.type === 'array' && param.items) {
|
|
66
|
-
schema.items = { type: param.items.type };
|
|
67
|
-
}
|
|
68
|
-
return schema;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Validate tool arguments against parameter definitions
|
|
72
|
-
*
|
|
73
|
-
* Why manual validation: Checks conditional requirements (required_for)
|
|
74
|
-
* which JSON Schema can't express directly.
|
|
75
|
-
*/
|
|
76
|
-
validateArguments(toolDef, args) {
|
|
77
|
-
for (const [name, param] of Object.entries(toolDef.parameters)) {
|
|
78
|
-
const value = args[name];
|
|
79
|
-
// Check unconditional required
|
|
80
|
-
if (param.required && value === undefined) {
|
|
81
|
-
throw new Error(`Missing required parameter: ${name}`);
|
|
82
|
-
}
|
|
83
|
-
// Check conditional required
|
|
84
|
-
if (param.required_for && param.required_for.length > 0) {
|
|
85
|
-
const action = args['action'];
|
|
86
|
-
if (action && param.required_for.includes(action) && value === undefined) {
|
|
87
|
-
throw new Error(`Parameter '${name}' is required for action '${action}'`);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
// Validate enum
|
|
91
|
-
if (value !== undefined && param.enum && !param.enum.includes(String(value))) {
|
|
92
|
-
throw new Error(`Invalid value for ${name}. Must be one of: ${param.enum.join(', ')}`);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Map tool action to OpenAPI operation ID
|
|
98
|
-
*
|
|
99
|
-
* Why: Single tool with 'action' parameter maps to multiple operations.
|
|
100
|
-
* Example: manage_badges + action=create => postApiV4ProjectsIdBadges
|
|
101
|
-
*/
|
|
102
|
-
mapActionToOperation(toolDef, args) {
|
|
103
|
-
if (!toolDef.operations)
|
|
104
|
-
return undefined;
|
|
105
|
-
const action = args['action'];
|
|
106
|
-
if (!action) {
|
|
107
|
-
// If single operation, use it directly
|
|
108
|
-
const operations = Object.values(toolDef.operations);
|
|
109
|
-
return operations.length === 1 ? operations[0] : undefined;
|
|
110
|
-
}
|
|
111
|
-
// For resource_type discrimination (e.g., project vs group)
|
|
112
|
-
const resourceType = args['resource_type'];
|
|
113
|
-
if (resourceType) {
|
|
114
|
-
// Try resource-specific operation first
|
|
115
|
-
const key = `${action}_${resourceType}`;
|
|
116
|
-
if (toolDef.operations[key]) {
|
|
117
|
-
return toolDef.operations[key];
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return toolDef.operations[action];
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
//# sourceMappingURL=tool-generator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool-generator.js","sourceRoot":"","sources":["../src/tool-generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,OAAO,aAAa;IACJ;IAApB,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C;;OAEG;IACH,YAAY,CAAC,OAAuB;QAClC,MAAM,WAAW,GAAG,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAEtD,OAAO;YACL,IAAI,E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CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;gBAC7E,MAAM,IAAI,KAAK,CACb,qBAAqB,IAAI,qBAAqB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACtE,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,oBAAoB,CAAC,OAAuB,EAAE,IAA6B;QACzE,IAAI,CAAC,OAAO,CAAC,UAAU;YAAE,OAAO,SAAS,CAAC;QAE1C,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAuB,CAAC;QAEpD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,uCAAuC;YACvC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YACrD,OAAO,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC7D,CAAC;QAED,4DAA4D;QAC5D,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,CAAuB,CAAC;QAEjE,IAAI,YAAY,EAAE,CAAC;YACjB,wCAAwC;YACxC,MAAM,GAAG,GAAG,GAAG,MAAM,IAAI,YAAY,EAAE,CAAC;YACxC,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC5B,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;YACjC,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"root":["../src/composite-executor.ts","../src/constants.ts","../src/http-transport.ts","../src/index.ts","../src/interceptors.ts","../src/logger.ts","../src/mcp-server.ts","../src/metrics.ts","../src/openapi-parser.ts","../src/profile-loader.ts","../src/schema-validator.ts","../src/tool-generator.ts","../src/testing/fixtures.ts","../src/testing/mock-gitlab-server.ts","../src/testing/test-types.ts","../src/types/http-transport.ts","../src/types/openapi.ts","../src/types/profile.ts","../scripts/validate-profile.ts","../scripts/validate-schema.ts"],"errors":true,"version":"5.9.3"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type definitions for HTTP transport
|
|
3
|
-
*
|
|
4
|
-
* Based on MCP Specification 2025-03-26
|
|
5
|
-
* https://modelcontextprotocol.io/specification/2025-03-26/basic/transports
|
|
6
|
-
*/
|
|
7
|
-
import type { Request as ExpressRequest } from 'express';
|
|
8
|
-
export interface SessionData {
|
|
9
|
-
id: string;
|
|
10
|
-
createdAt: number;
|
|
11
|
-
lastActivityAt: number;
|
|
12
|
-
sseStreams: Map<string, SSEStreamState>;
|
|
13
|
-
authToken?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface SSEStreamState {
|
|
16
|
-
streamId: string;
|
|
17
|
-
lastEventId: number;
|
|
18
|
-
messageQueue: QueuedMessage[];
|
|
19
|
-
active: boolean;
|
|
20
|
-
}
|
|
21
|
-
export interface QueuedMessage {
|
|
22
|
-
eventId: number;
|
|
23
|
-
data: unknown;
|
|
24
|
-
timestamp: number;
|
|
25
|
-
}
|
|
26
|
-
export interface HttpTransportConfig {
|
|
27
|
-
host: string;
|
|
28
|
-
port: number;
|
|
29
|
-
sessionTimeoutMs: number;
|
|
30
|
-
heartbeatEnabled: boolean;
|
|
31
|
-
heartbeatIntervalMs: number;
|
|
32
|
-
metricsEnabled: boolean;
|
|
33
|
-
metricsPath: string;
|
|
34
|
-
allowedOrigins?: string[];
|
|
35
|
-
}
|
|
36
|
-
export interface McpRequest extends ExpressRequest {
|
|
37
|
-
sessionId?: string;
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=http-transport.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-transport.d.ts","sourceRoot":"","sources":["../../src/types/http-transport.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzD,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,aAAa,EAAE,CAAC;IAC9B,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-transport.js","sourceRoot":"","sources":["../../src/types/http-transport.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/dist/types/openapi.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OpenAPI operational types
|
|
3
|
-
*
|
|
4
|
-
* Why simplified: We only need subset of OpenAPI spec for our use case
|
|
5
|
-
* (operation lookup, parameter extraction, request building). Full OpenAPI
|
|
6
|
-
* types from openapi-types are too verbose for runtime usage.
|
|
7
|
-
*/
|
|
8
|
-
import type { OpenAPIV3 } from 'openapi-types';
|
|
9
|
-
export interface OpenAPIIndex {
|
|
10
|
-
spec: OpenAPIV3.Document;
|
|
11
|
-
operations: Map<string, OperationInfo>;
|
|
12
|
-
paths: Map<string, PathInfo>;
|
|
13
|
-
}
|
|
14
|
-
export interface OperationInfo {
|
|
15
|
-
operationId: string;
|
|
16
|
-
method: string;
|
|
17
|
-
path: string;
|
|
18
|
-
summary?: string;
|
|
19
|
-
description?: string;
|
|
20
|
-
parameters: ParameterInfo[];
|
|
21
|
-
requestBody?: RequestBodyInfo;
|
|
22
|
-
tags?: string[];
|
|
23
|
-
}
|
|
24
|
-
export interface PathInfo {
|
|
25
|
-
path: string;
|
|
26
|
-
operations: Record<string, OperationInfo>;
|
|
27
|
-
}
|
|
28
|
-
export interface ParameterInfo {
|
|
29
|
-
name: string;
|
|
30
|
-
in: 'path' | 'query' | 'header' | 'cookie';
|
|
31
|
-
required: boolean;
|
|
32
|
-
schema: SchemaInfo;
|
|
33
|
-
description?: string;
|
|
34
|
-
}
|
|
35
|
-
export interface RequestBodyInfo {
|
|
36
|
-
required: boolean;
|
|
37
|
-
content: Record<string, {
|
|
38
|
-
schema: SchemaInfo;
|
|
39
|
-
}>;
|
|
40
|
-
}
|
|
41
|
-
export interface SchemaInfo {
|
|
42
|
-
type?: string;
|
|
43
|
-
format?: string;
|
|
44
|
-
enum?: unknown[];
|
|
45
|
-
items?: SchemaInfo;
|
|
46
|
-
properties?: Record<string, SchemaInfo>;
|
|
47
|
-
required?: string[];
|
|
48
|
-
default?: unknown;
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=openapi.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../src/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AAC;IACjB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
|
package/dist/types/openapi.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OpenAPI operational types
|
|
3
|
-
*
|
|
4
|
-
* Why simplified: We only need subset of OpenAPI spec for our use case
|
|
5
|
-
* (operation lookup, parameter extraction, request building). Full OpenAPI
|
|
6
|
-
* types from openapi-types are too verbose for runtime usage.
|
|
7
|
-
*/
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=openapi.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.js","sourceRoot":"","sources":["../../src/types/openapi.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
package/dist/types/profile.d.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Profile configuration types
|
|
3
|
-
*
|
|
4
|
-
* Why these types: Profiles define which MCP tools are exposed and how they map
|
|
5
|
-
* to OpenAPI operations. This enables same server to serve different use cases
|
|
6
|
-
* (admin vs developer vs readonly) without code changes.
|
|
7
|
-
*/
|
|
8
|
-
export interface Profile {
|
|
9
|
-
profile_name: string;
|
|
10
|
-
description?: string;
|
|
11
|
-
tools: ToolDefinition[];
|
|
12
|
-
interceptors?: InterceptorConfig;
|
|
13
|
-
parameter_aliases?: Record<string, string[]>;
|
|
14
|
-
}
|
|
15
|
-
export interface ToolDefinition {
|
|
16
|
-
name: string;
|
|
17
|
-
description: string;
|
|
18
|
-
operations?: Record<string, string> | {
|
|
19
|
-
[key: string]: string;
|
|
20
|
-
};
|
|
21
|
-
composite?: boolean;
|
|
22
|
-
steps?: CompositeStep[];
|
|
23
|
-
partial_results?: boolean;
|
|
24
|
-
parameters: Record<string, ParameterDefinition>;
|
|
25
|
-
metadata_params?: string[];
|
|
26
|
-
response_fields?: Record<string, string[]>;
|
|
27
|
-
}
|
|
28
|
-
export interface ParameterDefinition {
|
|
29
|
-
type: 'string' | 'integer' | 'number' | 'boolean' | 'array' | 'object';
|
|
30
|
-
description: string;
|
|
31
|
-
required?: boolean;
|
|
32
|
-
required_for?: string[];
|
|
33
|
-
enum?: string[];
|
|
34
|
-
items?: {
|
|
35
|
-
type: string;
|
|
36
|
-
};
|
|
37
|
-
default?: unknown;
|
|
38
|
-
example?: unknown;
|
|
39
|
-
}
|
|
40
|
-
export interface CompositeStep {
|
|
41
|
-
call: string;
|
|
42
|
-
store_as: string;
|
|
43
|
-
}
|
|
44
|
-
export interface InterceptorConfig {
|
|
45
|
-
auth?: AuthInterceptor;
|
|
46
|
-
base_url?: BaseUrlConfig;
|
|
47
|
-
rate_limit?: RateLimitConfig;
|
|
48
|
-
retry?: RetryConfig;
|
|
49
|
-
array_format?: 'brackets' | 'indices' | 'repeat' | 'comma';
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Auth interceptor configuration
|
|
53
|
-
*
|
|
54
|
-
* - bearer: Standard HTTP Bearer token (Authorization: Bearer <token>)
|
|
55
|
-
* - query: API key in query string (?api_key=<token>)
|
|
56
|
-
* - custom-header: Custom header name (e.g., X-API-Key: <token>)
|
|
57
|
-
*/
|
|
58
|
-
export interface AuthInterceptor {
|
|
59
|
-
type: 'bearer' | 'query' | 'custom-header';
|
|
60
|
-
header_name?: string;
|
|
61
|
-
query_param?: string;
|
|
62
|
-
value_from_env: string;
|
|
63
|
-
}
|
|
64
|
-
export interface BaseUrlConfig {
|
|
65
|
-
value_from_env: string;
|
|
66
|
-
default?: string;
|
|
67
|
-
}
|
|
68
|
-
export interface RateLimitConfig {
|
|
69
|
-
max_requests_per_minute: number;
|
|
70
|
-
}
|
|
71
|
-
export interface RetryConfig {
|
|
72
|
-
max_attempts: number;
|
|
73
|
-
backoff_ms: number[];
|
|
74
|
-
retry_on_status: number[];
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=profile.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/types/profile.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,OAAO;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAC9C;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IAGpB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAGhE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,aAAa,EAAE,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAGhD,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAG3B,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;IACvE,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,YAAY,CAAC,EAAE,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;CAC5D;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,eAAe,CAAC;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,uBAAuB,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B"}
|
package/dist/types/profile.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Profile configuration types
|
|
3
|
-
*
|
|
4
|
-
* Why these types: Profiles define which MCP tools are exposed and how they map
|
|
5
|
-
* to OpenAPI operations. This enables same server to serve different use cases
|
|
6
|
-
* (admin vs developer vs readonly) without code changes.
|
|
7
|
-
*/
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=profile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/types/profile.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|