@iwas/mcp 0.0.0-stage → 1.0.1
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 +175 -2
- package/dist/auth/index.d.ts +631 -0
- package/dist/auth/index.js +25 -0
- package/dist/bin.js +165 -0
- package/dist/catalog/index.d.ts +639 -0
- package/dist/catalog/index.js +1 -0
- package/dist/client/index.d.ts +14 -0
- package/dist/client/index.js +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +25 -0
- package/dist/registrar-CNvQygSE.d.ts +192 -0
- package/package.json +69 -3
package/README.md
CHANGED
|
@@ -1,3 +1,176 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @iwas/mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **Intelligent WiFi Access & Presence Service (IWAS) Model Context Protocol (MCP) CLI & SDK**
|
|
4
|
+
|
|
5
|
+
Official command-line tool and developer SDK for connecting AI coding assistants (Claude Desktop, Cursor, Antigravity, Cline) and enterprise applications to the **IWAS** WiFi billing, captive portal, and network presence infrastructure.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@iwas/mcp)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Highlights
|
|
13
|
+
|
|
14
|
+
- 🚀 **Zero Setup**: Run instantly via `npx @iwas/mcp` without cloning or pre-installing dependencies.
|
|
15
|
+
- 🔐 **RFC 8628 Device Authorization**: Secure, headless browser-based login with standard OAuth 2.0 device flow.
|
|
16
|
+
- 🛡️ **Enterprise Credential Security**: Integrates with native OS Keychains (macOS Keychain, Linux Secret Service) with atomic, permissions-hardened file fallbacks.
|
|
17
|
+
- 🤖 **Native AI Assistant Support**: Plug-and-play Model Context Protocol (MCP) server for Claude, Cursor, and custom agentic frameworks.
|
|
18
|
+
- 📦 **Standalone Zero-Dependency Binary**: Self-contained runtime bundle engineered for maximum reliability.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Quickstart
|
|
23
|
+
|
|
24
|
+
### Run with `npx` (No installation needed)
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Log in via interactive browser
|
|
28
|
+
npx @iwas/mcp login --browser
|
|
29
|
+
|
|
30
|
+
# Check session & authentication status
|
|
31
|
+
npx @iwas/mcp status
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Install Globally
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install -g @iwas/mcp
|
|
38
|
+
|
|
39
|
+
# Verify installation
|
|
40
|
+
iwas --version
|
|
41
|
+
iwas --help
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
*(Note: `iwas-mcp` is also provided as a backward-compatible command alias).*
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Integrating with AI Assistants
|
|
49
|
+
|
|
50
|
+
You can wire IWAS tools directly into your favorite AI environments via standard MCP configuration:
|
|
51
|
+
|
|
52
|
+
### Claude Desktop (`claude_desktop_config.json`)
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"mcpServers": {
|
|
57
|
+
"iwas": {
|
|
58
|
+
"command": "npx",
|
|
59
|
+
"args": ["-y", "@iwas/mcp"]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Cursor / Cline / Antigravity
|
|
66
|
+
|
|
67
|
+
Configure an MCP server with command `npx` and arguments `["-y", "@iwas/mcp"]`. The CLI will automatically use your stored credentials from `iwas login`.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## CLI Commands
|
|
72
|
+
|
|
73
|
+
### 1. `iwas login`
|
|
74
|
+
Authenticate your workstation or development environment using OAuth 2.0 Device Flow:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Interactive login with automatic browser opening
|
|
78
|
+
iwas login --browser
|
|
79
|
+
|
|
80
|
+
# Connect to a custom or self-hosted IWAS gateway
|
|
81
|
+
iwas login --server https://getiwas.com --browser
|
|
82
|
+
|
|
83
|
+
# Headless / remote server login (shows verification URL & code)
|
|
84
|
+
iwas login --no-browser
|
|
85
|
+
|
|
86
|
+
# Request custom scopes
|
|
87
|
+
iwas login --scopes "analytics:read session:read offline_access"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 2. `iwas status`
|
|
91
|
+
Inspect the active authenticated profile, expiration status, and authorized scopes:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
iwas status
|
|
95
|
+
|
|
96
|
+
# JSON output for automated scripting & CI/CD
|
|
97
|
+
iwas status --json
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 3. `iwas logout`
|
|
101
|
+
Revoke active session grants on the server and remove stored credentials from the local vault:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
iwas logout
|
|
105
|
+
|
|
106
|
+
# Force local cleanup even if the authentication server is unreachable
|
|
107
|
+
iwas logout --force
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Machine-Readable JSON Mode (`--json`)
|
|
113
|
+
|
|
114
|
+
When passed the `--json` flag, all commands output structured, newline-delimited JSON events to `stdout`, while human-readable prompts and notices are redirected to `stderr`.
|
|
115
|
+
|
|
116
|
+
**Example: Initiating device login**
|
|
117
|
+
```json
|
|
118
|
+
{"event":"device_authorization","user_code":"WDJB-MJHT","verification_uri":"https://getiwas.com/device","verification_uri_complete":"https://getiwas.com/device?user_code=WDJB-MJHT","expires_in":600,"interval":5}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Example: Successful login**
|
|
122
|
+
```json
|
|
123
|
+
{"event":"login_success","success":true,"profileKey":"https://getiwas.com::iwas-cli","serverUrl":"https://getiwas.com","clientId":"iwas-cli","organizationId":"org_123","scope":"...","expiresAt":1792376265000}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## TypeScript SDK & Programmatic Usage
|
|
129
|
+
|
|
130
|
+
`@iwas/mcp` provides first-class TypeScript library exports for building custom agents and administrative tools:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
pnpm add @iwas/mcp
|
|
134
|
+
# or
|
|
135
|
+
npm install @iwas/mcp
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Subpath Exports
|
|
139
|
+
|
|
140
|
+
* `@iwas/mcp` — Core entrypoint and package metadata.
|
|
141
|
+
* `@iwas/mcp/client` — Programmatic MCP client transport and client interfaces.
|
|
142
|
+
* `@iwas/mcp/auth` — Credential vault (`CredentialVault`), Token refresh manager (`TokenRefreshManager`), and OS Keychain utilities.
|
|
143
|
+
* `@iwas/mcp/catalog` — Typed permission vocabulary and tool definition catalog.
|
|
144
|
+
|
|
145
|
+
### Example: Automated Token Refresh in Node.js
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
import { CredentialVault, TokenRefreshManager } from '@iwas/mcp/auth';
|
|
149
|
+
|
|
150
|
+
const vault = new CredentialVault();
|
|
151
|
+
const refreshManager = new TokenRefreshManager({ vault });
|
|
152
|
+
|
|
153
|
+
// Automatically retrieves a valid token, refreshing via OAuth family rotation if near expiration
|
|
154
|
+
const accessToken = await refreshManager.getValidAccessToken('https://getiwas.com::iwas-cli');
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Credential Storage & Security
|
|
160
|
+
|
|
161
|
+
Credentials are protected using defense-in-depth:
|
|
162
|
+
|
|
163
|
+
* **macOS**: Stored securely in the **macOS Keychain Services** under service `iwas-cli`.
|
|
164
|
+
* **Linux**: Stored via standard **Secret Service API / libsecret**.
|
|
165
|
+
* **Headless / Windows / Container Fallback**: Stored in `~/.config/iwas/credentials.json` with strict POSIX `0600` permissions and atomic write guarantees.
|
|
166
|
+
|
|
167
|
+
You can explicitly enforce storage mode via the `IWAS_MCP_VAULT` environment variable:
|
|
168
|
+
- `IWAS_MCP_VAULT=auto` (default: Keychain if available, fallback to file)
|
|
169
|
+
- `IWAS_MCP_VAULT=keychain` (strict Keychain only)
|
|
170
|
+
- `IWAS_MCP_VAULT=file` (strict file storage only)
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## License
|
|
175
|
+
|
|
176
|
+
MIT © [9xlayer](https://getiwas.com)
|