@postmcp/types 0.1.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/LICENSE +21 -0
- package/dist/index.d.mts +326 -0
- package/dist/index.d.ts +326 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +32 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PostMCP Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import { AxiosResponse, AxiosRequestConfig } from 'axios';
|
|
2
|
+
|
|
3
|
+
type HttpMethod = 'get' | 'post' | 'put' | 'patch' | 'delete' | 'head' | 'options';
|
|
4
|
+
type RiskTier = 'READ_ONLY' | 'MUTATION' | 'CRITICAL';
|
|
5
|
+
interface JSONSchemaObject {
|
|
6
|
+
type?: string | string[];
|
|
7
|
+
description?: string;
|
|
8
|
+
properties?: Record<string, JSONSchemaObject>;
|
|
9
|
+
required?: string[];
|
|
10
|
+
items?: JSONSchemaObject;
|
|
11
|
+
enum?: any[];
|
|
12
|
+
default?: any;
|
|
13
|
+
oneOf?: JSONSchemaObject[];
|
|
14
|
+
anyOf?: JSONSchemaObject[];
|
|
15
|
+
allOf?: JSONSchemaObject[];
|
|
16
|
+
$ref?: string;
|
|
17
|
+
additionalProperties?: boolean | JSONSchemaObject;
|
|
18
|
+
format?: string;
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}
|
|
21
|
+
interface NormalizedParameter {
|
|
22
|
+
name: string;
|
|
23
|
+
in: 'path' | 'query' | 'header' | 'cookie' | 'body';
|
|
24
|
+
description?: string;
|
|
25
|
+
required: boolean;
|
|
26
|
+
schema: JSONSchemaObject;
|
|
27
|
+
style?: string;
|
|
28
|
+
explode?: boolean;
|
|
29
|
+
}
|
|
30
|
+
interface NormalizedOperation {
|
|
31
|
+
id: string;
|
|
32
|
+
method: HttpMethod;
|
|
33
|
+
path: string;
|
|
34
|
+
summary: string;
|
|
35
|
+
description: string;
|
|
36
|
+
tags: string[];
|
|
37
|
+
parameters: NormalizedParameter[];
|
|
38
|
+
inputSchema: JSONSchemaObject;
|
|
39
|
+
responseSchema?: JSONSchemaObject;
|
|
40
|
+
riskTier: RiskTier;
|
|
41
|
+
security?: Array<Record<string, string[]>>;
|
|
42
|
+
isDeprecated?: boolean;
|
|
43
|
+
contentType?: string;
|
|
44
|
+
}
|
|
45
|
+
interface SecurityScheme {
|
|
46
|
+
type: 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
|
|
47
|
+
description?: string;
|
|
48
|
+
name?: string;
|
|
49
|
+
in?: 'header' | 'query' | 'cookie';
|
|
50
|
+
scheme?: string;
|
|
51
|
+
bearerFormat?: string;
|
|
52
|
+
}
|
|
53
|
+
interface MacroStep {
|
|
54
|
+
id: string;
|
|
55
|
+
action: string;
|
|
56
|
+
body?: Record<string, any>;
|
|
57
|
+
export?: Record<string, string>;
|
|
58
|
+
}
|
|
59
|
+
interface MacroDefinition {
|
|
60
|
+
name: string;
|
|
61
|
+
description: string;
|
|
62
|
+
parameters: JSONSchemaObject;
|
|
63
|
+
steps: MacroStep[];
|
|
64
|
+
}
|
|
65
|
+
interface TokenDietConfig {
|
|
66
|
+
enabled: boolean;
|
|
67
|
+
maxTokens?: number;
|
|
68
|
+
pruneNulls?: boolean;
|
|
69
|
+
markdownTables?: boolean;
|
|
70
|
+
fieldMasks?: Record<string, string[]>;
|
|
71
|
+
}
|
|
72
|
+
interface NormalizedSpec {
|
|
73
|
+
title: string;
|
|
74
|
+
version: string;
|
|
75
|
+
description?: string;
|
|
76
|
+
servers: Array<{
|
|
77
|
+
url: string;
|
|
78
|
+
description?: string;
|
|
79
|
+
}>;
|
|
80
|
+
operations: NormalizedOperation[];
|
|
81
|
+
securitySchemes: Record<string, SecurityScheme>;
|
|
82
|
+
macros?: MacroDefinition[];
|
|
83
|
+
tokenDiet?: TokenDietConfig;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface TokenDietOptions {
|
|
87
|
+
enabled?: boolean;
|
|
88
|
+
fieldMasks?: string[];
|
|
89
|
+
pathFieldMasks?: Record<string, string[]>;
|
|
90
|
+
maxTokens?: number;
|
|
91
|
+
convertToMarkdownTable?: boolean;
|
|
92
|
+
maxProseLength?: number;
|
|
93
|
+
}
|
|
94
|
+
interface TokenDietResult {
|
|
95
|
+
text: string;
|
|
96
|
+
structured: any;
|
|
97
|
+
rawEstimatedTokens: number;
|
|
98
|
+
dietEstimatedTokens: number;
|
|
99
|
+
savingsPercentage: number;
|
|
100
|
+
isTruncated: boolean;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
interface ToolAnnotations {
|
|
104
|
+
readOnlyHint?: boolean;
|
|
105
|
+
destructiveHint?: boolean;
|
|
106
|
+
idempotentHint?: boolean;
|
|
107
|
+
}
|
|
108
|
+
interface DryRunResult {
|
|
109
|
+
isDryRun: true;
|
|
110
|
+
operationId: string;
|
|
111
|
+
method: string;
|
|
112
|
+
targetUrl: string;
|
|
113
|
+
queryParams?: Record<string, any>;
|
|
114
|
+
headers: Record<string, string>;
|
|
115
|
+
body?: any;
|
|
116
|
+
message: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
interface MacroExecutionResult {
|
|
120
|
+
macroName: string;
|
|
121
|
+
success: boolean;
|
|
122
|
+
isDryRun?: boolean;
|
|
123
|
+
stepResults: Array<{
|
|
124
|
+
stepId: string;
|
|
125
|
+
action: string;
|
|
126
|
+
status: number;
|
|
127
|
+
data: any;
|
|
128
|
+
}>;
|
|
129
|
+
finalData: any;
|
|
130
|
+
errorMessage?: string;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
interface McpImageContent {
|
|
134
|
+
type: 'image';
|
|
135
|
+
data: string;
|
|
136
|
+
mimeType: string;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
interface AuthConfig {
|
|
140
|
+
headers?: Record<string, string>;
|
|
141
|
+
bearerToken?: string;
|
|
142
|
+
apiKey?: {
|
|
143
|
+
name: string;
|
|
144
|
+
value: string;
|
|
145
|
+
in: 'header' | 'query' | 'cookie';
|
|
146
|
+
};
|
|
147
|
+
basicAuth?: {
|
|
148
|
+
username?: string;
|
|
149
|
+
password?: string;
|
|
150
|
+
} | string;
|
|
151
|
+
securitySchemes?: Record<string, any>;
|
|
152
|
+
allowedExternalHosts?: string[];
|
|
153
|
+
allowCrossOriginAuth?: boolean;
|
|
154
|
+
}
|
|
155
|
+
interface AsyncPollResult {
|
|
156
|
+
response: AxiosResponse;
|
|
157
|
+
timedOut: boolean;
|
|
158
|
+
}
|
|
159
|
+
interface ResilientHttpClientOptions {
|
|
160
|
+
baseUrl: string;
|
|
161
|
+
auth?: AuthConfig;
|
|
162
|
+
timeout?: number;
|
|
163
|
+
maxRetries?: number;
|
|
164
|
+
autoPoll202?: boolean;
|
|
165
|
+
specSecuritySchemes?: Record<string, SecurityScheme>;
|
|
166
|
+
}
|
|
167
|
+
interface HttpRequestConfig extends AxiosRequestConfig {
|
|
168
|
+
securityRequirement?: Array<Record<string, string[]>>;
|
|
169
|
+
specSecuritySchemes?: Record<string, SecurityScheme>;
|
|
170
|
+
}
|
|
171
|
+
interface HttpResponseResult {
|
|
172
|
+
status: number;
|
|
173
|
+
statusText: string;
|
|
174
|
+
headers: Record<string, any>;
|
|
175
|
+
data: any;
|
|
176
|
+
contentType?: string;
|
|
177
|
+
isError: boolean;
|
|
178
|
+
errorMessage?: string;
|
|
179
|
+
isPollingTimeout?: boolean;
|
|
180
|
+
}
|
|
181
|
+
interface SerializedRequestParameters {
|
|
182
|
+
path: string;
|
|
183
|
+
queryParams: Record<string, any>;
|
|
184
|
+
headerParams: Record<string, string>;
|
|
185
|
+
cookieParams: Record<string, string>;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
interface ToolRegistryOptions {
|
|
189
|
+
forceJIT?: boolean;
|
|
190
|
+
maxMountedTools?: number;
|
|
191
|
+
}
|
|
192
|
+
interface PostMcpServerOptions {
|
|
193
|
+
spec: NormalizedSpec;
|
|
194
|
+
baseUrl?: string;
|
|
195
|
+
auth?: AuthConfig;
|
|
196
|
+
tokenDiet?: TokenDietOptions;
|
|
197
|
+
jit?: boolean;
|
|
198
|
+
dryRun?: boolean;
|
|
199
|
+
serverName?: string;
|
|
200
|
+
serverVersion?: string;
|
|
201
|
+
}
|
|
202
|
+
interface HttpServerOptions extends PostMcpServerOptions {
|
|
203
|
+
port?: number;
|
|
204
|
+
host?: string;
|
|
205
|
+
endpointPath?: string;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
type PresetCategory = 'Developer Tools' | 'Database & Cloud' | 'Payments & Commerce' | 'Communication & AI' | 'Productivity & Support' | 'Social & Media' | 'Demo & Testing';
|
|
209
|
+
interface PresetFieldMask {
|
|
210
|
+
path: string;
|
|
211
|
+
fields: string[];
|
|
212
|
+
}
|
|
213
|
+
interface PresetMacro {
|
|
214
|
+
name: string;
|
|
215
|
+
description: string;
|
|
216
|
+
parameters: {
|
|
217
|
+
type: 'object';
|
|
218
|
+
properties: Record<string, any>;
|
|
219
|
+
required?: string[];
|
|
220
|
+
};
|
|
221
|
+
steps: Array<{
|
|
222
|
+
id: string;
|
|
223
|
+
action: string;
|
|
224
|
+
body?: any;
|
|
225
|
+
export?: Record<string, string>;
|
|
226
|
+
}>;
|
|
227
|
+
}
|
|
228
|
+
interface Preset {
|
|
229
|
+
id: string;
|
|
230
|
+
name: string;
|
|
231
|
+
description: string;
|
|
232
|
+
category: PresetCategory;
|
|
233
|
+
authType: string;
|
|
234
|
+
authEnvVar?: string;
|
|
235
|
+
defaultBaseUrl?: string;
|
|
236
|
+
specUrl?: string;
|
|
237
|
+
bundledSpec?: object;
|
|
238
|
+
tags?: string[];
|
|
239
|
+
fieldMasks?: PresetFieldMask[];
|
|
240
|
+
macros?: PresetMacro[];
|
|
241
|
+
}
|
|
242
|
+
interface EndpointDef {
|
|
243
|
+
path: string;
|
|
244
|
+
method: 'get' | 'post' | 'put' | 'delete' | 'patch';
|
|
245
|
+
operationId: string;
|
|
246
|
+
summary: string;
|
|
247
|
+
description?: string;
|
|
248
|
+
parameters?: Array<{
|
|
249
|
+
name: string;
|
|
250
|
+
in: 'query' | 'path' | 'header';
|
|
251
|
+
required?: boolean;
|
|
252
|
+
schema: {
|
|
253
|
+
type: string;
|
|
254
|
+
format?: string;
|
|
255
|
+
default?: any;
|
|
256
|
+
};
|
|
257
|
+
description?: string;
|
|
258
|
+
}>;
|
|
259
|
+
requestBody?: {
|
|
260
|
+
required?: boolean;
|
|
261
|
+
properties: Record<string, {
|
|
262
|
+
type: string;
|
|
263
|
+
description?: string;
|
|
264
|
+
required?: boolean;
|
|
265
|
+
}>;
|
|
266
|
+
};
|
|
267
|
+
responseSchema?: Record<string, any>;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
interface PostMcpCliConfig {
|
|
271
|
+
spec?: string;
|
|
272
|
+
baseUrl?: string;
|
|
273
|
+
auth?: AuthConfig;
|
|
274
|
+
jit?: boolean;
|
|
275
|
+
dryRun?: boolean;
|
|
276
|
+
transport?: 'stdio' | 'http';
|
|
277
|
+
port?: number;
|
|
278
|
+
tokenDiet?: {
|
|
279
|
+
enabled?: boolean;
|
|
280
|
+
maxTokens?: number;
|
|
281
|
+
convertToMarkdownTable?: boolean;
|
|
282
|
+
};
|
|
283
|
+
fieldMasks?: Record<string, string[]>;
|
|
284
|
+
macros?: MacroDefinition[];
|
|
285
|
+
enabledOperations?: Record<string, boolean>;
|
|
286
|
+
}
|
|
287
|
+
interface GeneratedProject {
|
|
288
|
+
files: Record<string, string>;
|
|
289
|
+
}
|
|
290
|
+
interface RunCommandOptions {
|
|
291
|
+
baseUrl?: string;
|
|
292
|
+
transport?: 'stdio' | 'http';
|
|
293
|
+
port?: string;
|
|
294
|
+
host?: string;
|
|
295
|
+
header?: string[];
|
|
296
|
+
bearer?: string;
|
|
297
|
+
apiKey?: string;
|
|
298
|
+
jit?: boolean;
|
|
299
|
+
dryRun?: boolean;
|
|
300
|
+
tokenDiet?: boolean;
|
|
301
|
+
maxTokens?: string;
|
|
302
|
+
envFile?: string;
|
|
303
|
+
config?: string;
|
|
304
|
+
}
|
|
305
|
+
interface InspectCommandOptions {
|
|
306
|
+
json?: boolean;
|
|
307
|
+
}
|
|
308
|
+
interface GenerateCommandOptions {
|
|
309
|
+
lang?: string;
|
|
310
|
+
target?: string;
|
|
311
|
+
out?: string;
|
|
312
|
+
}
|
|
313
|
+
interface ExportCommandOptions {
|
|
314
|
+
target?: 'cursor' | 'claude' | 'windsurf' | 'all';
|
|
315
|
+
client?: 'cursor' | 'claude' | 'windsurf' | 'all';
|
|
316
|
+
write?: boolean;
|
|
317
|
+
env?: string[];
|
|
318
|
+
bearer?: string;
|
|
319
|
+
baseUrl?: string;
|
|
320
|
+
}
|
|
321
|
+
interface StudioCommandOptions {
|
|
322
|
+
port?: string;
|
|
323
|
+
noOpen?: boolean;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export type { AsyncPollResult, AuthConfig, DryRunResult, EndpointDef, ExportCommandOptions, GenerateCommandOptions, GeneratedProject, HttpMethod, HttpRequestConfig, HttpResponseResult, HttpServerOptions, InspectCommandOptions, JSONSchemaObject, MacroDefinition, MacroExecutionResult, MacroStep, McpImageContent, NormalizedOperation, NormalizedParameter, NormalizedSpec, PostMcpCliConfig, PostMcpServerOptions, Preset, PresetCategory, PresetFieldMask, PresetMacro, ResilientHttpClientOptions, RiskTier, RunCommandOptions, SecurityScheme, SerializedRequestParameters, StudioCommandOptions, TokenDietConfig, TokenDietOptions, TokenDietResult, ToolAnnotations, ToolRegistryOptions };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import { AxiosResponse, AxiosRequestConfig } from 'axios';
|
|
2
|
+
|
|
3
|
+
type HttpMethod = 'get' | 'post' | 'put' | 'patch' | 'delete' | 'head' | 'options';
|
|
4
|
+
type RiskTier = 'READ_ONLY' | 'MUTATION' | 'CRITICAL';
|
|
5
|
+
interface JSONSchemaObject {
|
|
6
|
+
type?: string | string[];
|
|
7
|
+
description?: string;
|
|
8
|
+
properties?: Record<string, JSONSchemaObject>;
|
|
9
|
+
required?: string[];
|
|
10
|
+
items?: JSONSchemaObject;
|
|
11
|
+
enum?: any[];
|
|
12
|
+
default?: any;
|
|
13
|
+
oneOf?: JSONSchemaObject[];
|
|
14
|
+
anyOf?: JSONSchemaObject[];
|
|
15
|
+
allOf?: JSONSchemaObject[];
|
|
16
|
+
$ref?: string;
|
|
17
|
+
additionalProperties?: boolean | JSONSchemaObject;
|
|
18
|
+
format?: string;
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}
|
|
21
|
+
interface NormalizedParameter {
|
|
22
|
+
name: string;
|
|
23
|
+
in: 'path' | 'query' | 'header' | 'cookie' | 'body';
|
|
24
|
+
description?: string;
|
|
25
|
+
required: boolean;
|
|
26
|
+
schema: JSONSchemaObject;
|
|
27
|
+
style?: string;
|
|
28
|
+
explode?: boolean;
|
|
29
|
+
}
|
|
30
|
+
interface NormalizedOperation {
|
|
31
|
+
id: string;
|
|
32
|
+
method: HttpMethod;
|
|
33
|
+
path: string;
|
|
34
|
+
summary: string;
|
|
35
|
+
description: string;
|
|
36
|
+
tags: string[];
|
|
37
|
+
parameters: NormalizedParameter[];
|
|
38
|
+
inputSchema: JSONSchemaObject;
|
|
39
|
+
responseSchema?: JSONSchemaObject;
|
|
40
|
+
riskTier: RiskTier;
|
|
41
|
+
security?: Array<Record<string, string[]>>;
|
|
42
|
+
isDeprecated?: boolean;
|
|
43
|
+
contentType?: string;
|
|
44
|
+
}
|
|
45
|
+
interface SecurityScheme {
|
|
46
|
+
type: 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
|
|
47
|
+
description?: string;
|
|
48
|
+
name?: string;
|
|
49
|
+
in?: 'header' | 'query' | 'cookie';
|
|
50
|
+
scheme?: string;
|
|
51
|
+
bearerFormat?: string;
|
|
52
|
+
}
|
|
53
|
+
interface MacroStep {
|
|
54
|
+
id: string;
|
|
55
|
+
action: string;
|
|
56
|
+
body?: Record<string, any>;
|
|
57
|
+
export?: Record<string, string>;
|
|
58
|
+
}
|
|
59
|
+
interface MacroDefinition {
|
|
60
|
+
name: string;
|
|
61
|
+
description: string;
|
|
62
|
+
parameters: JSONSchemaObject;
|
|
63
|
+
steps: MacroStep[];
|
|
64
|
+
}
|
|
65
|
+
interface TokenDietConfig {
|
|
66
|
+
enabled: boolean;
|
|
67
|
+
maxTokens?: number;
|
|
68
|
+
pruneNulls?: boolean;
|
|
69
|
+
markdownTables?: boolean;
|
|
70
|
+
fieldMasks?: Record<string, string[]>;
|
|
71
|
+
}
|
|
72
|
+
interface NormalizedSpec {
|
|
73
|
+
title: string;
|
|
74
|
+
version: string;
|
|
75
|
+
description?: string;
|
|
76
|
+
servers: Array<{
|
|
77
|
+
url: string;
|
|
78
|
+
description?: string;
|
|
79
|
+
}>;
|
|
80
|
+
operations: NormalizedOperation[];
|
|
81
|
+
securitySchemes: Record<string, SecurityScheme>;
|
|
82
|
+
macros?: MacroDefinition[];
|
|
83
|
+
tokenDiet?: TokenDietConfig;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface TokenDietOptions {
|
|
87
|
+
enabled?: boolean;
|
|
88
|
+
fieldMasks?: string[];
|
|
89
|
+
pathFieldMasks?: Record<string, string[]>;
|
|
90
|
+
maxTokens?: number;
|
|
91
|
+
convertToMarkdownTable?: boolean;
|
|
92
|
+
maxProseLength?: number;
|
|
93
|
+
}
|
|
94
|
+
interface TokenDietResult {
|
|
95
|
+
text: string;
|
|
96
|
+
structured: any;
|
|
97
|
+
rawEstimatedTokens: number;
|
|
98
|
+
dietEstimatedTokens: number;
|
|
99
|
+
savingsPercentage: number;
|
|
100
|
+
isTruncated: boolean;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
interface ToolAnnotations {
|
|
104
|
+
readOnlyHint?: boolean;
|
|
105
|
+
destructiveHint?: boolean;
|
|
106
|
+
idempotentHint?: boolean;
|
|
107
|
+
}
|
|
108
|
+
interface DryRunResult {
|
|
109
|
+
isDryRun: true;
|
|
110
|
+
operationId: string;
|
|
111
|
+
method: string;
|
|
112
|
+
targetUrl: string;
|
|
113
|
+
queryParams?: Record<string, any>;
|
|
114
|
+
headers: Record<string, string>;
|
|
115
|
+
body?: any;
|
|
116
|
+
message: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
interface MacroExecutionResult {
|
|
120
|
+
macroName: string;
|
|
121
|
+
success: boolean;
|
|
122
|
+
isDryRun?: boolean;
|
|
123
|
+
stepResults: Array<{
|
|
124
|
+
stepId: string;
|
|
125
|
+
action: string;
|
|
126
|
+
status: number;
|
|
127
|
+
data: any;
|
|
128
|
+
}>;
|
|
129
|
+
finalData: any;
|
|
130
|
+
errorMessage?: string;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
interface McpImageContent {
|
|
134
|
+
type: 'image';
|
|
135
|
+
data: string;
|
|
136
|
+
mimeType: string;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
interface AuthConfig {
|
|
140
|
+
headers?: Record<string, string>;
|
|
141
|
+
bearerToken?: string;
|
|
142
|
+
apiKey?: {
|
|
143
|
+
name: string;
|
|
144
|
+
value: string;
|
|
145
|
+
in: 'header' | 'query' | 'cookie';
|
|
146
|
+
};
|
|
147
|
+
basicAuth?: {
|
|
148
|
+
username?: string;
|
|
149
|
+
password?: string;
|
|
150
|
+
} | string;
|
|
151
|
+
securitySchemes?: Record<string, any>;
|
|
152
|
+
allowedExternalHosts?: string[];
|
|
153
|
+
allowCrossOriginAuth?: boolean;
|
|
154
|
+
}
|
|
155
|
+
interface AsyncPollResult {
|
|
156
|
+
response: AxiosResponse;
|
|
157
|
+
timedOut: boolean;
|
|
158
|
+
}
|
|
159
|
+
interface ResilientHttpClientOptions {
|
|
160
|
+
baseUrl: string;
|
|
161
|
+
auth?: AuthConfig;
|
|
162
|
+
timeout?: number;
|
|
163
|
+
maxRetries?: number;
|
|
164
|
+
autoPoll202?: boolean;
|
|
165
|
+
specSecuritySchemes?: Record<string, SecurityScheme>;
|
|
166
|
+
}
|
|
167
|
+
interface HttpRequestConfig extends AxiosRequestConfig {
|
|
168
|
+
securityRequirement?: Array<Record<string, string[]>>;
|
|
169
|
+
specSecuritySchemes?: Record<string, SecurityScheme>;
|
|
170
|
+
}
|
|
171
|
+
interface HttpResponseResult {
|
|
172
|
+
status: number;
|
|
173
|
+
statusText: string;
|
|
174
|
+
headers: Record<string, any>;
|
|
175
|
+
data: any;
|
|
176
|
+
contentType?: string;
|
|
177
|
+
isError: boolean;
|
|
178
|
+
errorMessage?: string;
|
|
179
|
+
isPollingTimeout?: boolean;
|
|
180
|
+
}
|
|
181
|
+
interface SerializedRequestParameters {
|
|
182
|
+
path: string;
|
|
183
|
+
queryParams: Record<string, any>;
|
|
184
|
+
headerParams: Record<string, string>;
|
|
185
|
+
cookieParams: Record<string, string>;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
interface ToolRegistryOptions {
|
|
189
|
+
forceJIT?: boolean;
|
|
190
|
+
maxMountedTools?: number;
|
|
191
|
+
}
|
|
192
|
+
interface PostMcpServerOptions {
|
|
193
|
+
spec: NormalizedSpec;
|
|
194
|
+
baseUrl?: string;
|
|
195
|
+
auth?: AuthConfig;
|
|
196
|
+
tokenDiet?: TokenDietOptions;
|
|
197
|
+
jit?: boolean;
|
|
198
|
+
dryRun?: boolean;
|
|
199
|
+
serverName?: string;
|
|
200
|
+
serverVersion?: string;
|
|
201
|
+
}
|
|
202
|
+
interface HttpServerOptions extends PostMcpServerOptions {
|
|
203
|
+
port?: number;
|
|
204
|
+
host?: string;
|
|
205
|
+
endpointPath?: string;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
type PresetCategory = 'Developer Tools' | 'Database & Cloud' | 'Payments & Commerce' | 'Communication & AI' | 'Productivity & Support' | 'Social & Media' | 'Demo & Testing';
|
|
209
|
+
interface PresetFieldMask {
|
|
210
|
+
path: string;
|
|
211
|
+
fields: string[];
|
|
212
|
+
}
|
|
213
|
+
interface PresetMacro {
|
|
214
|
+
name: string;
|
|
215
|
+
description: string;
|
|
216
|
+
parameters: {
|
|
217
|
+
type: 'object';
|
|
218
|
+
properties: Record<string, any>;
|
|
219
|
+
required?: string[];
|
|
220
|
+
};
|
|
221
|
+
steps: Array<{
|
|
222
|
+
id: string;
|
|
223
|
+
action: string;
|
|
224
|
+
body?: any;
|
|
225
|
+
export?: Record<string, string>;
|
|
226
|
+
}>;
|
|
227
|
+
}
|
|
228
|
+
interface Preset {
|
|
229
|
+
id: string;
|
|
230
|
+
name: string;
|
|
231
|
+
description: string;
|
|
232
|
+
category: PresetCategory;
|
|
233
|
+
authType: string;
|
|
234
|
+
authEnvVar?: string;
|
|
235
|
+
defaultBaseUrl?: string;
|
|
236
|
+
specUrl?: string;
|
|
237
|
+
bundledSpec?: object;
|
|
238
|
+
tags?: string[];
|
|
239
|
+
fieldMasks?: PresetFieldMask[];
|
|
240
|
+
macros?: PresetMacro[];
|
|
241
|
+
}
|
|
242
|
+
interface EndpointDef {
|
|
243
|
+
path: string;
|
|
244
|
+
method: 'get' | 'post' | 'put' | 'delete' | 'patch';
|
|
245
|
+
operationId: string;
|
|
246
|
+
summary: string;
|
|
247
|
+
description?: string;
|
|
248
|
+
parameters?: Array<{
|
|
249
|
+
name: string;
|
|
250
|
+
in: 'query' | 'path' | 'header';
|
|
251
|
+
required?: boolean;
|
|
252
|
+
schema: {
|
|
253
|
+
type: string;
|
|
254
|
+
format?: string;
|
|
255
|
+
default?: any;
|
|
256
|
+
};
|
|
257
|
+
description?: string;
|
|
258
|
+
}>;
|
|
259
|
+
requestBody?: {
|
|
260
|
+
required?: boolean;
|
|
261
|
+
properties: Record<string, {
|
|
262
|
+
type: string;
|
|
263
|
+
description?: string;
|
|
264
|
+
required?: boolean;
|
|
265
|
+
}>;
|
|
266
|
+
};
|
|
267
|
+
responseSchema?: Record<string, any>;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
interface PostMcpCliConfig {
|
|
271
|
+
spec?: string;
|
|
272
|
+
baseUrl?: string;
|
|
273
|
+
auth?: AuthConfig;
|
|
274
|
+
jit?: boolean;
|
|
275
|
+
dryRun?: boolean;
|
|
276
|
+
transport?: 'stdio' | 'http';
|
|
277
|
+
port?: number;
|
|
278
|
+
tokenDiet?: {
|
|
279
|
+
enabled?: boolean;
|
|
280
|
+
maxTokens?: number;
|
|
281
|
+
convertToMarkdownTable?: boolean;
|
|
282
|
+
};
|
|
283
|
+
fieldMasks?: Record<string, string[]>;
|
|
284
|
+
macros?: MacroDefinition[];
|
|
285
|
+
enabledOperations?: Record<string, boolean>;
|
|
286
|
+
}
|
|
287
|
+
interface GeneratedProject {
|
|
288
|
+
files: Record<string, string>;
|
|
289
|
+
}
|
|
290
|
+
interface RunCommandOptions {
|
|
291
|
+
baseUrl?: string;
|
|
292
|
+
transport?: 'stdio' | 'http';
|
|
293
|
+
port?: string;
|
|
294
|
+
host?: string;
|
|
295
|
+
header?: string[];
|
|
296
|
+
bearer?: string;
|
|
297
|
+
apiKey?: string;
|
|
298
|
+
jit?: boolean;
|
|
299
|
+
dryRun?: boolean;
|
|
300
|
+
tokenDiet?: boolean;
|
|
301
|
+
maxTokens?: string;
|
|
302
|
+
envFile?: string;
|
|
303
|
+
config?: string;
|
|
304
|
+
}
|
|
305
|
+
interface InspectCommandOptions {
|
|
306
|
+
json?: boolean;
|
|
307
|
+
}
|
|
308
|
+
interface GenerateCommandOptions {
|
|
309
|
+
lang?: string;
|
|
310
|
+
target?: string;
|
|
311
|
+
out?: string;
|
|
312
|
+
}
|
|
313
|
+
interface ExportCommandOptions {
|
|
314
|
+
target?: 'cursor' | 'claude' | 'windsurf' | 'all';
|
|
315
|
+
client?: 'cursor' | 'claude' | 'windsurf' | 'all';
|
|
316
|
+
write?: boolean;
|
|
317
|
+
env?: string[];
|
|
318
|
+
bearer?: string;
|
|
319
|
+
baseUrl?: string;
|
|
320
|
+
}
|
|
321
|
+
interface StudioCommandOptions {
|
|
322
|
+
port?: string;
|
|
323
|
+
noOpen?: boolean;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export type { AsyncPollResult, AuthConfig, DryRunResult, EndpointDef, ExportCommandOptions, GenerateCommandOptions, GeneratedProject, HttpMethod, HttpRequestConfig, HttpResponseResult, HttpServerOptions, InspectCommandOptions, JSONSchemaObject, MacroDefinition, MacroExecutionResult, MacroStep, McpImageContent, NormalizedOperation, NormalizedParameter, NormalizedSpec, PostMcpCliConfig, PostMcpServerOptions, Preset, PresetCategory, PresetFieldMask, PresetMacro, ResilientHttpClientOptions, RiskTier, RunCommandOptions, SecurityScheme, SerializedRequestParameters, StudioCommandOptions, TokenDietConfig, TokenDietOptions, TokenDietResult, ToolAnnotations, ToolRegistryOptions };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/index.ts
|
|
17
|
+
var index_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(index_exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './parser.js';\nexport * from './tokendiet.js';\nexport * from './safety.js';\nexport * from './macro.js';\nexport * from './media.js';\nexport * from './http.js';\nexport * from './server.js';\nexport * from './presets.js';\nexport * from './cli.js';\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@postmcp/types",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Unified TypeScript types and interfaces for the PostMCP ecosystem",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"module": "./dist/index.mjs",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.mjs",
|
|
15
|
+
"require": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/node": "^22.13.5",
|
|
23
|
+
"axios": "^1.8.1",
|
|
24
|
+
"tsup": "^8.4.0",
|
|
25
|
+
"typescript": "^5.7.3"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsup",
|
|
29
|
+
"dev": "tsup --watch",
|
|
30
|
+
"typecheck": "tsc --noEmit"
|
|
31
|
+
}
|
|
32
|
+
}
|