@tunnelhub/mcp 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/CONTRIBUTING.md +70 -0
- package/LICENSE +21 -0
- package/README.md +322 -0
- package/dist/auth/browser-auth.d.ts +16 -0
- package/dist/auth/browser-auth.d.ts.map +1 -0
- package/dist/auth/browser-auth.js +144 -0
- package/dist/auth/browser-auth.js.map +1 -0
- package/dist/auth/cognito-client.d.ts +14 -0
- package/dist/auth/cognito-client.d.ts.map +1 -0
- package/dist/auth/cognito-client.js +69 -0
- package/dist/auth/cognito-client.js.map +1 -0
- package/dist/auth/session-manager.d.ts +17 -0
- package/dist/auth/session-manager.d.ts.map +1 -0
- package/dist/auth/session-manager.js +152 -0
- package/dist/auth/session-manager.js.map +1 -0
- package/dist/auth/token-manager.d.ts +50 -0
- package/dist/auth/token-manager.d.ts.map +1 -0
- package/dist/auth/token-manager.js +107 -0
- package/dist/auth/token-manager.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/index.d.ts +3 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +7 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/resources/index.d.ts +3 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +7 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/server.d.ts +12 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +46 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/api-gateway/index.d.ts +3 -0
- package/dist/tools/api-gateway/index.d.ts.map +1 -0
- package/dist/tools/api-gateway/index.js +9 -0
- package/dist/tools/api-gateway/index.js.map +1 -0
- package/dist/tools/automations/index.d.ts +3 -0
- package/dist/tools/automations/index.d.ts.map +1 -0
- package/dist/tools/automations/index.js +201 -0
- package/dist/tools/automations/index.js.map +1 -0
- package/dist/tools/integrations/index.d.ts +3 -0
- package/dist/tools/integrations/index.d.ts.map +1 -0
- package/dist/tools/integrations/index.js +10 -0
- package/dist/tools/integrations/index.js.map +1 -0
- package/dist/tools/monitoring/index.d.ts +3 -0
- package/dist/tools/monitoring/index.d.ts.map +1 -0
- package/dist/tools/monitoring/index.js +331 -0
- package/dist/tools/monitoring/index.js.map +1 -0
- package/dist/tools/packages/index.d.ts +3 -0
- package/dist/tools/packages/index.d.ts.map +1 -0
- package/dist/tools/packages/index.js +7 -0
- package/dist/tools/packages/index.js.map +1 -0
- package/dist/tools/session/current-session.d.ts +35 -0
- package/dist/tools/session/current-session.d.ts.map +1 -0
- package/dist/tools/session/current-session.js +32 -0
- package/dist/tools/session/current-session.js.map +1 -0
- package/dist/tools/session/index.d.ts +3 -0
- package/dist/tools/session/index.d.ts.map +1 -0
- package/dist/tools/session/index.js +16 -0
- package/dist/tools/session/index.js.map +1 -0
- package/dist/tools/session/list-environments.d.ts +35 -0
- package/dist/tools/session/list-environments.d.ts.map +1 -0
- package/dist/tools/session/list-environments.js +36 -0
- package/dist/tools/session/list-environments.js.map +1 -0
- package/dist/tools/session/list-sessions.d.ts +35 -0
- package/dist/tools/session/list-sessions.d.ts.map +1 -0
- package/dist/tools/session/list-sessions.js +37 -0
- package/dist/tools/session/list-sessions.js.map +1 -0
- package/dist/tools/session/login.d.ts +34 -0
- package/dist/tools/session/login.d.ts.map +1 -0
- package/dist/tools/session/login.js +27 -0
- package/dist/tools/session/login.js.map +1 -0
- package/dist/tools/session/logout.d.ts +42 -0
- package/dist/tools/session/logout.d.ts.map +1 -0
- package/dist/tools/session/logout.js +32 -0
- package/dist/tools/session/logout.js.map +1 -0
- package/dist/tools/session/switch-session.d.ts +42 -0
- package/dist/tools/session/switch-session.d.ts.map +1 -0
- package/dist/tools/session/switch-session.js +27 -0
- package/dist/tools/session/switch-session.js.map +1 -0
- package/dist/tools/tenants/index.d.ts +3 -0
- package/dist/tools/tenants/index.d.ts.map +1 -0
- package/dist/tools/tenants/index.js +61 -0
- package/dist/tools/tenants/index.js.map +1 -0
- package/dist/tools/users/index.d.ts +3 -0
- package/dist/tools/users/index.d.ts.map +1 -0
- package/dist/tools/users/index.js +7 -0
- package/dist/tools/users/index.js.map +1 -0
- package/dist/types/api.d.ts +108 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/api.js +2 -0
- package/dist/types/api.js.map +1 -0
- package/dist/types/dynamodb.d.ts +54 -0
- package/dist/types/dynamodb.d.ts.map +1 -0
- package/dist/types/dynamodb.js +55 -0
- package/dist/types/dynamodb.js.map +1 -0
- package/dist/types/mcp.d.ts +271 -0
- package/dist/types/mcp.d.ts.map +1 -0
- package/dist/types/mcp.js +62 -0
- package/dist/types/mcp.js.map +1 -0
- package/dist/utils/api-client.d.ts +44 -0
- package/dist/utils/api-client.d.ts.map +1 -0
- package/dist/utils/api-client.js +201 -0
- package/dist/utils/api-client.js.map +1 -0
- package/dist/utils/error-handler.d.ts +28 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +58 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/package.json +90 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ToolContext } from '../../types/mcp.js';
|
|
3
|
+
export declare const currentSessionTool: {
|
|
4
|
+
name: string;
|
|
5
|
+
schema: {
|
|
6
|
+
title: string;
|
|
7
|
+
description: string;
|
|
8
|
+
inputSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
9
|
+
annotations: {
|
|
10
|
+
readOnlyHint: boolean;
|
|
11
|
+
destructiveHint: boolean;
|
|
12
|
+
idempotentHint: boolean;
|
|
13
|
+
openWorldHint: boolean;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
handler: (_params: unknown, context: ToolContext) => Promise<{
|
|
17
|
+
content: Array<{
|
|
18
|
+
type: "text";
|
|
19
|
+
text: string;
|
|
20
|
+
}>;
|
|
21
|
+
structuredContent?: Record<string, unknown>;
|
|
22
|
+
} | {
|
|
23
|
+
content: Array<{
|
|
24
|
+
type: "text";
|
|
25
|
+
text: string;
|
|
26
|
+
}>;
|
|
27
|
+
isError: true;
|
|
28
|
+
structuredContent: {
|
|
29
|
+
error: string;
|
|
30
|
+
code?: string;
|
|
31
|
+
details?: unknown;
|
|
32
|
+
};
|
|
33
|
+
}>;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=current-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"current-session.d.ts","sourceRoot":"","sources":["../../../src/tools/session/current-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAKtD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;uBAaJ,OAAO,WAAW,WAAW;;;;;;;;;;;;;;gBAmBqT,CAAC;mBAAiB,CAAC;;;CAD/X,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { errorResult, textResult } from '../../utils/error-handler.js';
|
|
3
|
+
const EmptySchema = z.object({}).strict();
|
|
4
|
+
export const currentSessionTool = {
|
|
5
|
+
name: 'current_session_tunnelhub',
|
|
6
|
+
schema: {
|
|
7
|
+
title: 'Current TunnelHub Session',
|
|
8
|
+
description: 'Show the current authenticated TunnelHub session.',
|
|
9
|
+
inputSchema: EmptySchema,
|
|
10
|
+
annotations: {
|
|
11
|
+
readOnlyHint: true,
|
|
12
|
+
destructiveHint: false,
|
|
13
|
+
idempotentHint: true,
|
|
14
|
+
openWorldHint: false,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
handler: async (_params, context) => {
|
|
18
|
+
try {
|
|
19
|
+
const authContext = await context.sessionManager.getCurrentContext();
|
|
20
|
+
if (!authContext?.session) {
|
|
21
|
+
return textResult('No active session. Use login_tunnelhub first.');
|
|
22
|
+
}
|
|
23
|
+
const session = authContext.session;
|
|
24
|
+
const expiresInMinutes = Math.max(0, Math.floor((session.tokens.expiresAt - Date.now()) / 60000));
|
|
25
|
+
return textResult(`Current session:\n\nTenant: ${session.tenantName}\nEnvironment: ${session.environmentName}\nAPI Host: ${session.apiHost}\nUser: ${session.user.email || session.user.id}\nExpires in: ${expiresInMinutes} minutes`, session);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
return errorResult(error);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=current-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"current-session.js","sourceRoot":"","sources":["../../../src/tools/session/current-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAE1C,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,2BAA2B;IACjC,MAAM,EAAE;QACN,KAAK,EAAE,2BAA2B;QAClC,WAAW,EAAE,mDAAmD;QAChE,WAAW,EAAE,WAAW;QACxB,WAAW,EAAE;YACX,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,KAAK;SACrB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAgB,EAAE,OAAoB,EAAE,EAAE;QACxD,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,iBAAiB,EAAE,CAAC;YACrE,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE,CAAC;gBAC1B,OAAO,UAAU,CAAC,+CAA+C,CAAC,CAAC;YACrE,CAAC;YAED,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC;YACpC,MAAM,gBAAgB,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;YAElG,OAAO,UAAU,CACf,+BAA+B,OAAO,CAAC,UAAU,kBAAkB,OAAO,CAAC,eAAe,eAAe,OAAO,CAAC,OAAO,WAAW,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE,iBAAiB,gBAAgB,UAAU,EACnN,OAAO,CACR,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/session/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AASzE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAS9E"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { loginTool } from './login.js';
|
|
2
|
+
import { switchSessionTool } from './switch-session.js';
|
|
3
|
+
import { listSessionsTool } from './list-sessions.js';
|
|
4
|
+
import { currentSessionTool } from './current-session.js';
|
|
5
|
+
import { logoutTool } from './logout.js';
|
|
6
|
+
import { listEnvironmentsTool } from './list-environments.js';
|
|
7
|
+
export function registerSessionTools(server, context) {
|
|
8
|
+
const toolContext = context;
|
|
9
|
+
server.registerTool(loginTool.name, loginTool.schema, (params) => loginTool.handler(params, toolContext));
|
|
10
|
+
server.registerTool(switchSessionTool.name, switchSessionTool.schema, (params) => switchSessionTool.handler(params, toolContext));
|
|
11
|
+
server.registerTool(listSessionsTool.name, listSessionsTool.schema, (params) => listSessionsTool.handler(params, toolContext));
|
|
12
|
+
server.registerTool(currentSessionTool.name, currentSessionTool.schema, (params) => currentSessionTool.handler(params, toolContext));
|
|
13
|
+
server.registerTool(logoutTool.name, logoutTool.schema, (params) => logoutTool.handler(params, toolContext));
|
|
14
|
+
server.registerTool(listEnvironmentsTool.name, listEnvironmentsTool.schema, (params) => listEnvironmentsTool.handler(params, toolContext));
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/session/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D,MAAM,UAAU,oBAAoB,CAAC,MAAiB,EAAE,OAAgB;IACtE,MAAM,WAAW,GAAG,OAAsB,CAAC;IAE3C,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IAC1G,MAAM,CAAC,YAAY,CAAC,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IAClI,MAAM,CAAC,YAAY,CAAC,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IAC/H,MAAM,CAAC,YAAY,CAAC,kBAAkB,CAAC,IAAI,EAAE,kBAAkB,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IACrI,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IAC7G,MAAM,CAAC,YAAY,CAAC,oBAAoB,CAAC,IAAI,EAAE,oBAAoB,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,oBAAoB,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;AAC7I,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ToolContext } from '../../types/mcp.js';
|
|
3
|
+
export declare const listEnvironmentsTool: {
|
|
4
|
+
name: string;
|
|
5
|
+
schema: {
|
|
6
|
+
title: string;
|
|
7
|
+
description: string;
|
|
8
|
+
inputSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
9
|
+
annotations: {
|
|
10
|
+
readOnlyHint: boolean;
|
|
11
|
+
destructiveHint: boolean;
|
|
12
|
+
idempotentHint: boolean;
|
|
13
|
+
openWorldHint: boolean;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
handler: (_params: unknown, context: ToolContext) => Promise<{
|
|
17
|
+
content: Array<{
|
|
18
|
+
type: "text";
|
|
19
|
+
text: string;
|
|
20
|
+
}>;
|
|
21
|
+
structuredContent?: Record<string, unknown>;
|
|
22
|
+
} | {
|
|
23
|
+
content: Array<{
|
|
24
|
+
type: "text";
|
|
25
|
+
text: string;
|
|
26
|
+
}>;
|
|
27
|
+
isError: true;
|
|
28
|
+
structuredContent: {
|
|
29
|
+
error: string;
|
|
30
|
+
code?: string;
|
|
31
|
+
details?: unknown;
|
|
32
|
+
};
|
|
33
|
+
}>;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=list-environments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-environments.d.ts","sourceRoot":"","sources":["../../../src/tools/session/list-environments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAKtD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;uBAaN,OAAO,WAAW,WAAW;;;;;;;;;;;;;;gBAoB+N,CAAC;mBAAiB,CAAC;;;CADzS,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { errorResult, requireSession, textResult } from '../../utils/error-handler.js';
|
|
3
|
+
const EmptySchema = z.object({}).strict();
|
|
4
|
+
export const listEnvironmentsTool = {
|
|
5
|
+
name: 'list_environments_tunnelhub',
|
|
6
|
+
schema: {
|
|
7
|
+
title: 'List TunnelHub Environments',
|
|
8
|
+
description: 'List environments available to the current authenticated user.',
|
|
9
|
+
inputSchema: EmptySchema,
|
|
10
|
+
annotations: {
|
|
11
|
+
readOnlyHint: true,
|
|
12
|
+
destructiveHint: false,
|
|
13
|
+
idempotentHint: true,
|
|
14
|
+
openWorldHint: false,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
handler: async (_params, context) => {
|
|
18
|
+
try {
|
|
19
|
+
const session = await requireSession(context);
|
|
20
|
+
context.apiClient.setSession(session);
|
|
21
|
+
const apiClient = context.apiClient;
|
|
22
|
+
const environments = (await apiClient.getEnvironments());
|
|
23
|
+
const text = environments
|
|
24
|
+
.map((environment) => {
|
|
25
|
+
const active = environment.uuid === session.environmentId ? '*' : '-';
|
|
26
|
+
return `${active} ${String(environment.name)} (${String(environment.uuid)})`;
|
|
27
|
+
})
|
|
28
|
+
.join('\n');
|
|
29
|
+
return textResult(`Available environments:\n\n${text}`, environments);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
return errorResult(error);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=list-environments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-environments.js","sourceRoot":"","sources":["../../../src/tools/session/list-environments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAEvF,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAE1C,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE,6BAA6B;IACnC,MAAM,EAAE;QACN,KAAK,EAAE,6BAA6B;QACpC,WAAW,EAAE,gEAAgE;QAC7E,WAAW,EAAE,WAAW;QACxB,WAAW,EAAE;YACX,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,KAAK;SACrB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAgB,EAAE,OAAoB,EAAE,EAAE;QACxD,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;YAC9C,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YACtC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAqE,CAAC;YAChG,MAAM,YAAY,GAAG,CAAC,MAAM,SAAS,CAAC,eAAe,EAAE,CAAmC,CAAC;YAE3F,MAAM,IAAI,GAAG,YAAY;iBACtB,GAAG,CAAC,CAAC,WAAoC,EAAE,EAAE;gBAC5C,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;gBACtE,OAAO,GAAG,MAAM,IAAI,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC;YAC/E,CAAC,CAAC;iBACD,IAAI,CAAC,IAAI,CAAC,CAAC;YAEd,OAAO,UAAU,CAAC,8BAA8B,IAAI,EAAE,EAAE,YAAY,CAAC,CAAC;QACxE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ToolContext } from '../../types/mcp.js';
|
|
3
|
+
export declare const listSessionsTool: {
|
|
4
|
+
name: string;
|
|
5
|
+
schema: {
|
|
6
|
+
title: string;
|
|
7
|
+
description: string;
|
|
8
|
+
inputSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
9
|
+
annotations: {
|
|
10
|
+
readOnlyHint: boolean;
|
|
11
|
+
destructiveHint: boolean;
|
|
12
|
+
idempotentHint: boolean;
|
|
13
|
+
openWorldHint: boolean;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
handler: (_params: unknown, context: ToolContext) => Promise<{
|
|
17
|
+
content: Array<{
|
|
18
|
+
type: "text";
|
|
19
|
+
text: string;
|
|
20
|
+
}>;
|
|
21
|
+
structuredContent?: Record<string, unknown>;
|
|
22
|
+
} | {
|
|
23
|
+
content: Array<{
|
|
24
|
+
type: "text";
|
|
25
|
+
text: string;
|
|
26
|
+
}>;
|
|
27
|
+
isError: true;
|
|
28
|
+
structuredContent: {
|
|
29
|
+
error: string;
|
|
30
|
+
code?: string;
|
|
31
|
+
details?: unknown;
|
|
32
|
+
};
|
|
33
|
+
}>;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=list-sessions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-sessions.d.ts","sourceRoot":"","sources":["../../../src/tools/session/list-sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAKtD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;uBAaF,OAAO,WAAW,WAAW;;;;;;;;;;;;;;gBAsB6V,CAAC;mBAAiB,CAAC;;;CADva,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { errorResult, textResult } from '../../utils/error-handler.js';
|
|
3
|
+
const EmptySchema = z.object({}).strict();
|
|
4
|
+
export const listSessionsTool = {
|
|
5
|
+
name: 'list_sessions_tunnelhub',
|
|
6
|
+
schema: {
|
|
7
|
+
title: 'List TunnelHub Sessions',
|
|
8
|
+
description: 'List saved TunnelHub sessions in local MCP storage.',
|
|
9
|
+
inputSchema: EmptySchema,
|
|
10
|
+
annotations: {
|
|
11
|
+
readOnlyHint: true,
|
|
12
|
+
destructiveHint: false,
|
|
13
|
+
idempotentHint: true,
|
|
14
|
+
openWorldHint: false,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
handler: async (_params, context) => {
|
|
18
|
+
try {
|
|
19
|
+
const sessions = context.sessionManager.getAllSessions();
|
|
20
|
+
const currentSession = context.sessionManager.getCurrentSession();
|
|
21
|
+
if (sessions.length === 0) {
|
|
22
|
+
return textResult('No saved sessions. Use login_tunnelhub first.');
|
|
23
|
+
}
|
|
24
|
+
const text = sessions
|
|
25
|
+
.map((session) => {
|
|
26
|
+
const marker = currentSession?.id === session.id ? '*' : '-';
|
|
27
|
+
return `${marker} ${session.tenantName} / ${session.environmentName} (${session.id})`;
|
|
28
|
+
})
|
|
29
|
+
.join('\n');
|
|
30
|
+
return textResult(`Saved sessions:\n\n${text}`, sessions);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
return errorResult(error);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=list-sessions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-sessions.js","sourceRoot":"","sources":["../../../src/tools/session/list-sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAE1C,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,yBAAyB;IAC/B,MAAM,EAAE;QACN,KAAK,EAAE,yBAAyB;QAChC,WAAW,EAAE,qDAAqD;QAClE,WAAW,EAAE,WAAW;QACxB,WAAW,EAAE;YACX,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,KAAK;SACrB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAgB,EAAE,OAAoB,EAAE,EAAE;QACxD,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,cAAc,EAAE,CAAC;YACzD,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,iBAAiB,EAAE,CAAC;YAElE,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC1B,OAAO,UAAU,CAAC,+CAA+C,CAAC,CAAC;YACrE,CAAC;YAED,MAAM,IAAI,GAAG,QAAQ;iBAClB,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;gBACf,MAAM,MAAM,GAAG,cAAc,EAAE,EAAE,KAAK,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;gBAC7D,OAAO,GAAG,MAAM,IAAI,OAAO,CAAC,UAAU,MAAM,OAAO,CAAC,eAAe,KAAK,OAAO,CAAC,EAAE,GAAG,CAAC;YACxF,CAAC,CAAC;iBACD,IAAI,CAAC,IAAI,CAAC,CAAC;YAEd,OAAO,UAAU,CAAC,sBAAsB,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC;QAC5D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ToolContext } from '../../types/mcp.js';
|
|
2
|
+
export declare const loginTool: {
|
|
3
|
+
name: string;
|
|
4
|
+
schema: {
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
inputSchema: import("zod").ZodObject<{}, "strict", import("zod").ZodTypeAny, {}, {}>;
|
|
8
|
+
annotations: {
|
|
9
|
+
readOnlyHint: boolean;
|
|
10
|
+
destructiveHint: boolean;
|
|
11
|
+
idempotentHint: boolean;
|
|
12
|
+
openWorldHint: boolean;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
handler: (_params: unknown, context: ToolContext) => Promise<{
|
|
16
|
+
content: Array<{
|
|
17
|
+
type: "text";
|
|
18
|
+
text: string;
|
|
19
|
+
}>;
|
|
20
|
+
structuredContent?: Record<string, unknown>;
|
|
21
|
+
} | {
|
|
22
|
+
content: Array<{
|
|
23
|
+
type: "text";
|
|
24
|
+
text: string;
|
|
25
|
+
}>;
|
|
26
|
+
isError: true;
|
|
27
|
+
structuredContent: {
|
|
28
|
+
error: string;
|
|
29
|
+
code?: string;
|
|
30
|
+
details?: unknown;
|
|
31
|
+
};
|
|
32
|
+
}>;
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=login.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/tools/session/login.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAItD,eAAO,MAAM,SAAS;;;;;;;;;;;;;uBAaK,OAAO,WAAW,WAAW;;;;;;;;;;;;;;gBAcumB,CAAC;mBAAiB,CAAC;;;CADjrB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LoginParamsSchema } from '../../types/mcp.js';
|
|
2
|
+
import { errorResult, textResult } from '../../utils/error-handler.js';
|
|
3
|
+
export const loginTool = {
|
|
4
|
+
name: 'login_tunnelhub',
|
|
5
|
+
schema: {
|
|
6
|
+
title: 'Login TunnelHub',
|
|
7
|
+
description: 'Authenticate to TunnelHub using the browser-based frontend auth flow.',
|
|
8
|
+
inputSchema: LoginParamsSchema,
|
|
9
|
+
annotations: {
|
|
10
|
+
readOnlyHint: false,
|
|
11
|
+
destructiveHint: false,
|
|
12
|
+
idempotentHint: false,
|
|
13
|
+
openWorldHint: true,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
handler: async (_params, context) => {
|
|
17
|
+
try {
|
|
18
|
+
const session = await context.sessionManager.createSession();
|
|
19
|
+
context.apiClient.setSession(session);
|
|
20
|
+
return textResult(`Authenticated successfully.\n\nTenant: ${session.tenantName}\nEnvironment: ${session.environmentName}\nUser: ${session.user.email || session.user.id}`, session);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
return errorResult(error);
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/tools/session/login.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,IAAI,EAAE,iBAAiB;IACvB,MAAM,EAAE;QACN,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,uEAAuE;QACpF,WAAW,EAAE,iBAAiB;QAC9B,WAAW,EAAE;YACX,YAAY,EAAE,KAAK;YACnB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,KAAK;YACrB,aAAa,EAAE,IAAI;SACpB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAgB,EAAE,OAAoB,EAAE,EAAE;QACxD,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC;YAC7D,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YAEtC,OAAO,UAAU,CACf,0CAA0C,OAAO,CAAC,UAAU,kBAAkB,OAAO,CAAC,eAAe,WAAW,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,EACvJ,OAAO,CACR,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { ToolContext } from '../../types/mcp.js';
|
|
3
|
+
import { LogoutParamsSchema } from '../../types/mcp.js';
|
|
4
|
+
export declare const logoutTool: {
|
|
5
|
+
name: string;
|
|
6
|
+
schema: {
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
inputSchema: z.ZodObject<{
|
|
10
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
sessionId?: string | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
sessionId?: string | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
annotations: {
|
|
17
|
+
readOnlyHint: boolean;
|
|
18
|
+
destructiveHint: boolean;
|
|
19
|
+
idempotentHint: boolean;
|
|
20
|
+
openWorldHint: boolean;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
handler: (params: z.infer<typeof LogoutParamsSchema>, context: ToolContext) => Promise<{
|
|
24
|
+
content: Array<{
|
|
25
|
+
type: "text";
|
|
26
|
+
text: string;
|
|
27
|
+
}>;
|
|
28
|
+
structuredContent?: Record<string, unknown>;
|
|
29
|
+
} | {
|
|
30
|
+
content: Array<{
|
|
31
|
+
type: "text";
|
|
32
|
+
text: string;
|
|
33
|
+
}>;
|
|
34
|
+
isError: true;
|
|
35
|
+
structuredContent: {
|
|
36
|
+
error: string;
|
|
37
|
+
code?: string;
|
|
38
|
+
details?: unknown;
|
|
39
|
+
};
|
|
40
|
+
}>;
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=logout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../src/tools/session/logout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;sBAaG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,WAAW,WAAW;;;;;;;;;;;;;;gBAmBia,CAAC;mBAAiB,CAAC;;;CADrgB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { LogoutParamsSchema } from '../../types/mcp.js';
|
|
2
|
+
import { errorResult, textResult } from '../../utils/error-handler.js';
|
|
3
|
+
export const logoutTool = {
|
|
4
|
+
name: 'logout_tunnelhub',
|
|
5
|
+
schema: {
|
|
6
|
+
title: 'Logout TunnelHub',
|
|
7
|
+
description: 'Remove the current or a specific saved TunnelHub session.',
|
|
8
|
+
inputSchema: LogoutParamsSchema,
|
|
9
|
+
annotations: {
|
|
10
|
+
readOnlyHint: false,
|
|
11
|
+
destructiveHint: true,
|
|
12
|
+
idempotentHint: true,
|
|
13
|
+
openWorldHint: false,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
handler: async (params, context) => {
|
|
17
|
+
try {
|
|
18
|
+
const currentSession = context.sessionManager.getCurrentSession();
|
|
19
|
+
context.sessionManager.logout(params.sessionId);
|
|
20
|
+
if (params.sessionId) {
|
|
21
|
+
return textResult(`Logged out session ${params.sessionId}.`);
|
|
22
|
+
}
|
|
23
|
+
return textResult(currentSession
|
|
24
|
+
? `Logged out current session for ${currentSession.tenantName} / ${currentSession.environmentName}.`
|
|
25
|
+
: 'No active session to logout.');
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
return errorResult(error);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=logout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout.js","sourceRoot":"","sources":["../../../src/tools/session/logout.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE,kBAAkB;IACxB,MAAM,EAAE;QACN,KAAK,EAAE,kBAAkB;QACzB,WAAW,EAAE,2DAA2D;QACxE,WAAW,EAAE,kBAAkB;QAC/B,WAAW,EAAE;YACX,YAAY,EAAE,KAAK;YACnB,eAAe,EAAE,IAAI;YACrB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,KAAK;SACrB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,MAA0C,EAAE,OAAoB,EAAE,EAAE;QAClF,IAAI,CAAC;YACH,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,iBAAiB,EAAE,CAAC;YAClE,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAEhD,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;gBACrB,OAAO,UAAU,CAAC,sBAAsB,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC;YAC/D,CAAC;YAED,OAAO,UAAU,CACf,cAAc;gBACZ,CAAC,CAAC,kCAAkC,cAAc,CAAC,UAAU,MAAM,cAAc,CAAC,eAAe,GAAG;gBACpG,CAAC,CAAC,8BAA8B,CACnC,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { ToolContext } from '../../types/mcp.js';
|
|
3
|
+
import { SwitchEnvironmentParamsSchema } from '../../types/mcp.js';
|
|
4
|
+
export declare const switchSessionTool: {
|
|
5
|
+
name: string;
|
|
6
|
+
schema: {
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
inputSchema: z.ZodObject<{
|
|
10
|
+
environmentId: z.ZodString;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
environmentId: string;
|
|
13
|
+
}, {
|
|
14
|
+
environmentId: string;
|
|
15
|
+
}>;
|
|
16
|
+
annotations: {
|
|
17
|
+
readOnlyHint: boolean;
|
|
18
|
+
destructiveHint: boolean;
|
|
19
|
+
idempotentHint: boolean;
|
|
20
|
+
openWorldHint: boolean;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
handler: (params: z.infer<typeof SwitchEnvironmentParamsSchema>, context: ToolContext) => Promise<{
|
|
24
|
+
content: Array<{
|
|
25
|
+
type: "text";
|
|
26
|
+
text: string;
|
|
27
|
+
}>;
|
|
28
|
+
structuredContent?: Record<string, unknown>;
|
|
29
|
+
} | {
|
|
30
|
+
content: Array<{
|
|
31
|
+
type: "text";
|
|
32
|
+
text: string;
|
|
33
|
+
}>;
|
|
34
|
+
isError: true;
|
|
35
|
+
structuredContent: {
|
|
36
|
+
error: string;
|
|
37
|
+
code?: string;
|
|
38
|
+
details?: unknown;
|
|
39
|
+
};
|
|
40
|
+
}>;
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=switch-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch-session.d.ts","sourceRoot":"","sources":["../../../src/tools/session/switch-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAGnE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;sBAaJ,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,WAAW,WAAW;;;;;;;;;;;;;;gBAcye,CAAC;mBAAiB,CAAC;;;CADxlB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SwitchEnvironmentParamsSchema } from '../../types/mcp.js';
|
|
2
|
+
import { errorResult, textResult } from '../../utils/error-handler.js';
|
|
3
|
+
export const switchSessionTool = {
|
|
4
|
+
name: 'switch_environment_tunnelhub',
|
|
5
|
+
schema: {
|
|
6
|
+
title: 'Switch TunnelHub Environment',
|
|
7
|
+
description: 'Switch the active TunnelHub environment for the current session.',
|
|
8
|
+
inputSchema: SwitchEnvironmentParamsSchema,
|
|
9
|
+
annotations: {
|
|
10
|
+
readOnlyHint: false,
|
|
11
|
+
destructiveHint: false,
|
|
12
|
+
idempotentHint: true,
|
|
13
|
+
openWorldHint: true,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
handler: async (params, context) => {
|
|
17
|
+
try {
|
|
18
|
+
const session = await context.sessionManager.switchEnvironment(params.environmentId);
|
|
19
|
+
context.apiClient.setSession(session);
|
|
20
|
+
return textResult(`Switched environment.\n\nTenant: ${session.tenantName}\nEnvironment: ${session.environmentName}`, session);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
return errorResult(error);
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=switch-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch-session.js","sourceRoot":"","sources":["../../../src/tools/session/switch-session.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,8BAA8B;IACpC,MAAM,EAAE;QACN,KAAK,EAAE,8BAA8B;QACrC,WAAW,EAAE,kEAAkE;QAC/E,WAAW,EAAE,6BAA6B;QAC1C,WAAW,EAAE;YACX,YAAY,EAAE,KAAK;YACnB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,IAAI;SACpB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,MAAqD,EAAE,OAAoB,EAAE,EAAE;QAC7F,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,iBAAiB,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;YACrF,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YAEtC,OAAO,UAAU,CACf,oCAAoC,OAAO,CAAC,UAAU,kBAAkB,OAAO,CAAC,eAAe,EAAE,EACjG,OAAO,CACR,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/tenants/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA4DzE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAG7E"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { TenantIdParamsSchema } from '../../types/mcp.js';
|
|
3
|
+
import { errorResult, requireSession, textResult } from '../../utils/error-handler.js';
|
|
4
|
+
const ListTenantsSchema = z.object({}).strict();
|
|
5
|
+
const listTenantsTool = {
|
|
6
|
+
name: 'list_tenants_tunnelhub',
|
|
7
|
+
schema: {
|
|
8
|
+
title: 'List TunnelHub Tenants',
|
|
9
|
+
description: 'List tenants visible to the authenticated user. Intended as read-only lookup.',
|
|
10
|
+
inputSchema: ListTenantsSchema,
|
|
11
|
+
annotations: {
|
|
12
|
+
readOnlyHint: true,
|
|
13
|
+
destructiveHint: false,
|
|
14
|
+
idempotentHint: true,
|
|
15
|
+
openWorldHint: false,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
handler: async (_params, context) => {
|
|
19
|
+
try {
|
|
20
|
+
const session = await requireSession(context);
|
|
21
|
+
context.apiClient.setSession(session);
|
|
22
|
+
const apiClient = context.apiClient;
|
|
23
|
+
const tenants = await apiClient.listTenants();
|
|
24
|
+
return textResult('Fetched tenants.', tenants);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
return errorResult(error);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
const getTenantTool = {
|
|
32
|
+
name: 'get_tenant_tunnelhub',
|
|
33
|
+
schema: {
|
|
34
|
+
title: 'Get TunnelHub Tenant',
|
|
35
|
+
description: 'Get read-only details for a tenant by id.',
|
|
36
|
+
inputSchema: TenantIdParamsSchema,
|
|
37
|
+
annotations: {
|
|
38
|
+
readOnlyHint: true,
|
|
39
|
+
destructiveHint: false,
|
|
40
|
+
idempotentHint: true,
|
|
41
|
+
openWorldHint: false,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
handler: async (params, context) => {
|
|
45
|
+
try {
|
|
46
|
+
const session = await requireSession(context);
|
|
47
|
+
context.apiClient.setSession(session);
|
|
48
|
+
const apiClient = context.apiClient;
|
|
49
|
+
const tenant = await apiClient.getTenant(params.tenantId);
|
|
50
|
+
return textResult(`Fetched tenant ${params.tenantId}.`, tenant);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
return errorResult(error);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
export function registerTenantTools(server, context) {
|
|
58
|
+
server.registerTool(listTenantsTool.name, listTenantsTool.schema, (params) => listTenantsTool.handler(params, context));
|
|
59
|
+
server.registerTool(getTenantTool.name, getTenantTool.schema, (params) => getTenantTool.handler(params, context));
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/tenants/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAEvF,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAEhD,MAAM,eAAe,GAAG;IACtB,IAAI,EAAE,wBAAwB;IAC9B,MAAM,EAAE;QACN,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EAAE,+EAA+E;QAC5F,WAAW,EAAE,iBAAiB;QAC9B,WAAW,EAAE;YACX,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,KAAK;SACrB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAgB,EAAE,OAAoB,EAAE,EAAE;QACxD,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;YAC9C,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YACtC,MAAM,SAAS,GAAG,OAAO,CAAC,SAA+D,CAAC;YAC1F,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,WAAW,EAAE,CAAC;YAC9C,OAAO,UAAU,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;QACjD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;CACF,CAAC;AAEF,MAAM,aAAa,GAAG;IACpB,IAAI,EAAE,sBAAsB;IAC5B,MAAM,EAAE;QACN,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EAAE,2CAA2C;QACxD,WAAW,EAAE,oBAAoB;QACjC,WAAW,EAAE;YACX,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,KAAK;SACrB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,MAA4C,EAAE,OAAoB,EAAE,EAAE;QACpF,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;YAC9C,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YACtC,MAAM,SAAS,GAAG,OAAO,CAAC,SAA6E,CAAC;YACxG,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC1D,OAAO,UAAU,CAAC,kBAAkB,MAAM,CAAC,QAAQ,GAAG,EAAE,MAAM,CAAC,CAAC;QAClE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;CACF,CAAC;AAEF,MAAM,UAAU,mBAAmB,CAAC,MAAiB,EAAE,OAAgB;IACrE,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,EAAE,OAAsB,CAAC,CAAC,CAAC;IACvI,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,OAAsB,CAAC,CAAC,CAAC;AACnI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/users/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,CAK7E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/users/index.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,iBAAiB,CAAC,OAAkB,EAAE,QAAiB;IACrE,6BAA6B;IAC7B,eAAe;IACf,aAAa;IACb,yBAAyB;AAC3B,CAAC"}
|