@iwas/mcp 0.0.0-stage → 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/README.md +134 -2
- package/dist/auth/index.d.ts +631 -0
- package/dist/auth/index.js +2451 -0
- package/dist/bin.js +1833 -0
- package/dist/catalog/index.d.ts +639 -0
- package/dist/catalog/index.js +1118 -0
- package/dist/client/index.d.ts +14 -0
- package/dist/client/index.js +18 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +3458 -0
- package/dist/registrar-CNvQygSE.d.ts +192 -0
- package/package.json +69 -3
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const CATALOG_DEFINITIONS: {
|
|
4
|
+
readonly organization: {
|
|
5
|
+
readonly tier: "T";
|
|
6
|
+
readonly actions: readonly ["update", "delete"];
|
|
7
|
+
readonly description: "Organization tenant profile and settings";
|
|
8
|
+
readonly models: readonly ["Organization", "OrganizationSetting", "OrganizationSubscription"];
|
|
9
|
+
readonly mcpEligible: true;
|
|
10
|
+
};
|
|
11
|
+
readonly member: {
|
|
12
|
+
readonly tier: "T";
|
|
13
|
+
readonly actions: readonly ["create", "update", "delete"];
|
|
14
|
+
readonly description: "Organization member management";
|
|
15
|
+
readonly models: readonly ["Member"];
|
|
16
|
+
readonly mcpEligible: true;
|
|
17
|
+
};
|
|
18
|
+
readonly invitation: {
|
|
19
|
+
readonly tier: "T";
|
|
20
|
+
readonly actions: readonly ["create", "cancel"];
|
|
21
|
+
readonly description: "Organization membership invitations";
|
|
22
|
+
readonly models: readonly ["Invitation"];
|
|
23
|
+
readonly mcpEligible: true;
|
|
24
|
+
};
|
|
25
|
+
readonly location: {
|
|
26
|
+
readonly tier: "T";
|
|
27
|
+
readonly actions: readonly ["read", "write", "delete"];
|
|
28
|
+
readonly description: "Physical hotspot location management";
|
|
29
|
+
readonly models: readonly ["Location"];
|
|
30
|
+
readonly mcpEligible: true;
|
|
31
|
+
};
|
|
32
|
+
readonly router: {
|
|
33
|
+
readonly tier: "T";
|
|
34
|
+
readonly actions: readonly ["read", "write", "delete", "control"];
|
|
35
|
+
readonly description: "Gateway router inventory, provisioning and control";
|
|
36
|
+
readonly models: readonly ["Router", "ZtpToken", "CoaQueue", "IpamAllocationCursor"];
|
|
37
|
+
readonly mcpEligible: true;
|
|
38
|
+
};
|
|
39
|
+
readonly package: {
|
|
40
|
+
readonly tier: "S";
|
|
41
|
+
readonly actions: readonly ["read", "write", "delete", "publish"];
|
|
42
|
+
readonly description: "WiFi access package catalog (tenant + shared)";
|
|
43
|
+
readonly models: readonly ["Package", "VoucherPackage"];
|
|
44
|
+
readonly mcpEligible: true;
|
|
45
|
+
};
|
|
46
|
+
readonly voucher: {
|
|
47
|
+
readonly tier: "S";
|
|
48
|
+
readonly actions: readonly ["read", "write", "publish", "issue", "revoke"];
|
|
49
|
+
readonly description: "Prepaid voucher codes and issuance (tenant + shared)";
|
|
50
|
+
readonly models: readonly ["Voucher", "VoucherIssuance", "VoucherUser"];
|
|
51
|
+
readonly mcpEligible: true;
|
|
52
|
+
};
|
|
53
|
+
readonly session: {
|
|
54
|
+
readonly tier: "T";
|
|
55
|
+
readonly actions: readonly ["read", "control"];
|
|
56
|
+
readonly description: "Active and historical WiFi guest sessions";
|
|
57
|
+
readonly models: readonly ["WifiSession", "RadiusAccounting", "DeviceToken"];
|
|
58
|
+
readonly mcpEligible: true;
|
|
59
|
+
};
|
|
60
|
+
readonly wallet: {
|
|
61
|
+
readonly tier: "T";
|
|
62
|
+
readonly actions: readonly ["read", "topup", "charge", "refund", "freeze"];
|
|
63
|
+
readonly description: "Prepaid wallet balances, topups and ledger transactions (SENSITIVE - MCP EXCLUDED)";
|
|
64
|
+
readonly models: readonly ["Wallet", "WalletTransaction", "TopupRequest"];
|
|
65
|
+
readonly hasOwnQualifier: true;
|
|
66
|
+
readonly mcpEligible: false;
|
|
67
|
+
};
|
|
68
|
+
readonly payment: {
|
|
69
|
+
readonly tier: "T";
|
|
70
|
+
readonly actions: readonly ["read", "approve", "refund"];
|
|
71
|
+
readonly description: "Inbound payment transactions and gateway integrations (SENSITIVE - MCP EXCLUDED)";
|
|
72
|
+
readonly models: readonly ["PaymentTransaction", "PaymentGatewayIntegration"];
|
|
73
|
+
readonly hasOwnQualifier: true;
|
|
74
|
+
readonly mcpEligible: false;
|
|
75
|
+
};
|
|
76
|
+
readonly subscription: {
|
|
77
|
+
readonly tier: "T";
|
|
78
|
+
readonly actions: readonly ["read", "manage"];
|
|
79
|
+
readonly description: "SaaS organization plan subscription and entitlements";
|
|
80
|
+
readonly models: readonly ["OrganizationSubscription"];
|
|
81
|
+
readonly mcpEligible: true;
|
|
82
|
+
};
|
|
83
|
+
readonly partner: {
|
|
84
|
+
readonly tier: "T";
|
|
85
|
+
readonly actions: readonly ["read", "manage", "payout:approve"];
|
|
86
|
+
readonly description: "Affiliate/partner programs and payout requests";
|
|
87
|
+
readonly models: readonly ["Partner", "PartnerPayoutRequest"];
|
|
88
|
+
readonly mcpEligible: true;
|
|
89
|
+
};
|
|
90
|
+
readonly campaign: {
|
|
91
|
+
readonly tier: "T";
|
|
92
|
+
readonly actions: readonly ["read", "write"];
|
|
93
|
+
readonly description: "Captive portal ad campaigns and lead capture";
|
|
94
|
+
readonly models: readonly ["AdCampaign", "LeadCapture"];
|
|
95
|
+
readonly mcpEligible: true;
|
|
96
|
+
};
|
|
97
|
+
readonly notification: {
|
|
98
|
+
readonly tier: "T";
|
|
99
|
+
readonly actions: readonly ["read", "send", "template:write"];
|
|
100
|
+
readonly description: "Multi-channel notifications, templates and logs";
|
|
101
|
+
readonly models: readonly ["NotificationItem", "NotificationTemplate", "DeliveryLog"];
|
|
102
|
+
readonly hasOwnQualifier: true;
|
|
103
|
+
readonly mcpEligible: true;
|
|
104
|
+
};
|
|
105
|
+
readonly store: {
|
|
106
|
+
readonly tier: "P";
|
|
107
|
+
readonly actions: readonly ["read", "write"];
|
|
108
|
+
readonly description: "Public hardware/affiliate store catalog";
|
|
109
|
+
readonly models: readonly ["StoreProduct", "AffiliateClick"];
|
|
110
|
+
readonly mcpEligible: true;
|
|
111
|
+
};
|
|
112
|
+
readonly blog: {
|
|
113
|
+
readonly tier: "P";
|
|
114
|
+
readonly actions: readonly ["read", "write", "publish"];
|
|
115
|
+
readonly description: "Company-wide editorial articles and CDN media";
|
|
116
|
+
readonly models: readonly ["BlogPost", "Media"];
|
|
117
|
+
readonly hasOwnQualifier: true;
|
|
118
|
+
readonly mcpEligible: true;
|
|
119
|
+
};
|
|
120
|
+
readonly analytics: {
|
|
121
|
+
readonly tier: "D";
|
|
122
|
+
readonly actions: readonly ["read"];
|
|
123
|
+
readonly description: "Aggregated usage, session and revenue metrics";
|
|
124
|
+
readonly models: readonly ["WifiSession", "Package", "PaymentTransaction"];
|
|
125
|
+
readonly mcpEligible: true;
|
|
126
|
+
};
|
|
127
|
+
readonly diagnostics: {
|
|
128
|
+
readonly tier: "P";
|
|
129
|
+
readonly actions: readonly ["read", "write"];
|
|
130
|
+
readonly description: "System error events, MCP tool execution spans, flow events, issue triage and audit logs";
|
|
131
|
+
readonly models: readonly ["ErrorEvent", "McpToolSpan", "AuditLog", "SystemSetting", "FlowEvent", "IssueState"];
|
|
132
|
+
readonly mcpEligible: true;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
type Resource = keyof typeof CATALOG_DEFINITIONS;
|
|
136
|
+
type ActionFor<R extends Resource> = (typeof CATALOG_DEFINITIONS)[R]['actions'][number];
|
|
137
|
+
type PermMap = {
|
|
138
|
+
[R in Resource]: `${R}:${ActionFor<R>}`;
|
|
139
|
+
};
|
|
140
|
+
type PermissionString = PermMap[Resource];
|
|
141
|
+
/**
|
|
142
|
+
* Type guard validating that a candidate string is a valid catalog permission.
|
|
143
|
+
*/
|
|
144
|
+
declare function isPermissionString(value: unknown): value is PermissionString;
|
|
145
|
+
|
|
146
|
+
type McpCapabilityType = 'tool' | 'prompt';
|
|
147
|
+
interface McpToolAnnotations {
|
|
148
|
+
readOnlyHint?: boolean;
|
|
149
|
+
}
|
|
150
|
+
type McpDomain = 'health' | 'analytics' | 'sessions' | 'insights' | 'diagnostics' | 'blog' | 'prompts';
|
|
151
|
+
type McpToolParamsShape = z.ZodRawShape | Record<string, never>;
|
|
152
|
+
interface McpToolDefinition<TShape extends McpToolParamsShape = z.ZodRawShape> {
|
|
153
|
+
type: 'tool';
|
|
154
|
+
name: string;
|
|
155
|
+
methodName: string;
|
|
156
|
+
domain: McpDomain;
|
|
157
|
+
description: string;
|
|
158
|
+
paramsSchema: TShape;
|
|
159
|
+
annotations?: McpToolAnnotations;
|
|
160
|
+
permissions: PermissionString[] | 'public';
|
|
161
|
+
platformScopeOnly?: boolean;
|
|
162
|
+
}
|
|
163
|
+
interface McpPromptDefinition<TShape extends McpToolParamsShape = z.ZodRawShape> {
|
|
164
|
+
type: 'prompt';
|
|
165
|
+
name: string;
|
|
166
|
+
methodName: string;
|
|
167
|
+
domain: 'prompts';
|
|
168
|
+
description: string;
|
|
169
|
+
argsSchema: TShape;
|
|
170
|
+
permissions: PermissionString[];
|
|
171
|
+
}
|
|
172
|
+
type McpCapabilityDefinition = McpToolDefinition | McpPromptDefinition;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Abstract registrar interface for registering tools and prompts with an MCP server implementation.
|
|
176
|
+
*/
|
|
177
|
+
interface ToolRegistrar<TContext = unknown> {
|
|
178
|
+
registerTool(definition: McpToolDefinition, handler: (args: Record<string, unknown>, extra: TContext) => Promise<unknown>): void;
|
|
179
|
+
registerPrompt(definition: McpPromptDefinition, handler: (args: Record<string, unknown>, extra: TContext) => Promise<unknown>): void;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Interface for invoking tools and retrieving prompts programmatically.
|
|
183
|
+
*/
|
|
184
|
+
interface ToolClient {
|
|
185
|
+
callTool(name: string, args?: Record<string, unknown>): Promise<unknown>;
|
|
186
|
+
getPrompt(name: string, args?: Record<string, unknown>): Promise<unknown>;
|
|
187
|
+
listTools(): Promise<McpToolDefinition[]>;
|
|
188
|
+
listPrompts(): Promise<McpPromptDefinition[]>;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export { CATALOG_DEFINITIONS as C, isPermissionString as i };
|
|
192
|
+
export type { McpCapabilityDefinition as M, PermissionString as P, Resource as R, ToolClient as T, McpCapabilityType as a, McpDomain as b, McpPromptDefinition as c, McpToolAnnotations as d, McpToolDefinition as e, McpToolParamsShape as f, ToolRegistrar as g };
|
package/package.json
CHANGED
|
@@ -1,6 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iwas/mcp",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Intelligent WiFi Access & Presence Service (IWAS) Model Context Protocol (MCP) CLI & SDK",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "9xlayer <support@getiwas.com>",
|
|
7
|
+
"homepage": "https://getiwas.com",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/9xlayer/iwas.git",
|
|
11
|
+
"directory": "packages/mcp"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"iwas",
|
|
15
|
+
"mcp",
|
|
16
|
+
"model-context-protocol",
|
|
17
|
+
"wifi",
|
|
18
|
+
"hotspot",
|
|
19
|
+
"billing",
|
|
20
|
+
"cli",
|
|
21
|
+
"oauth2",
|
|
22
|
+
"device-flow"
|
|
23
|
+
],
|
|
24
|
+
"main": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"bin": {
|
|
27
|
+
"iwas": "./dist/bin.js",
|
|
28
|
+
"iwas-mcp": "./dist/bin.js"
|
|
29
|
+
},
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"default": "./dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./catalog": {
|
|
36
|
+
"types": "./dist/catalog/index.d.ts",
|
|
37
|
+
"default": "./dist/catalog/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./client": {
|
|
40
|
+
"types": "./dist/client/index.d.ts",
|
|
41
|
+
"default": "./dist/client/index.js"
|
|
42
|
+
},
|
|
43
|
+
"./auth": {
|
|
44
|
+
"types": "./dist/auth/index.d.ts",
|
|
45
|
+
"default": "./dist/auth/index.js"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"files": [
|
|
49
|
+
"dist",
|
|
50
|
+
"README.md"
|
|
51
|
+
],
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public",
|
|
54
|
+
"registry": "https://registry.npmjs.org/"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
58
|
+
"jose": "^6.0.8",
|
|
59
|
+
"zod": "^4.4.3"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@types/node": "^22.10.2",
|
|
63
|
+
"tsup": "^9.0.0",
|
|
64
|
+
"typescript": "^6.0.3",
|
|
65
|
+
"@iwas/auth": "1.0.0"
|
|
66
|
+
},
|
|
67
|
+
"scripts": {
|
|
68
|
+
"build": "tsup",
|
|
69
|
+
"build:types": "tsc -p tsconfig.types.json",
|
|
70
|
+
"test": "tsup && node --test tests/index.spec.mjs tests/catalog.spec.mjs tests/credentials-vault.spec.mjs tests/device-flow.spec.mjs tests/token-refresh.spec.mjs tests/logout.spec.mjs"
|
|
71
|
+
}
|
|
6
72
|
}
|