llng-mcp 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/.github/workflows/ci.yml +77 -0
- package/.prettierrc +7 -0
- package/LICENSE +661 -0
- package/README.md +502 -0
- package/dist/__tests__/api-transport.test.d.ts +1 -0
- package/dist/__tests__/api-transport.test.js +577 -0
- package/dist/__tests__/api-transport.test.js.map +1 -0
- package/dist/__tests__/config.test.d.ts +1 -0
- package/dist/__tests__/config.test.js +472 -0
- package/dist/__tests__/config.test.js.map +1 -0
- package/dist/__tests__/integration/api-mode.test.d.ts +1 -0
- package/dist/__tests__/integration/api-mode.test.js +199 -0
- package/dist/__tests__/integration/api-mode.test.js.map +1 -0
- package/dist/__tests__/integration/oidc-rp.test.d.ts +1 -0
- package/dist/__tests__/integration/oidc-rp.test.js +120 -0
- package/dist/__tests__/integration/oidc-rp.test.js.map +1 -0
- package/dist/__tests__/integration/ssh-mode.test.d.ts +1 -0
- package/dist/__tests__/integration/ssh-mode.test.js +101 -0
- package/dist/__tests__/integration/ssh-mode.test.js.map +1 -0
- package/dist/__tests__/k8s-transport.test.d.ts +1 -0
- package/dist/__tests__/k8s-transport.test.js +254 -0
- package/dist/__tests__/k8s-transport.test.js.map +1 -0
- package/dist/__tests__/oidc-tools.test.d.ts +1 -0
- package/dist/__tests__/oidc-tools.test.js +457 -0
- package/dist/__tests__/oidc-tools.test.js.map +1 -0
- package/dist/__tests__/registry.test.d.ts +1 -0
- package/dist/__tests__/registry.test.js +96 -0
- package/dist/__tests__/registry.test.js.map +1 -0
- package/dist/__tests__/ssh-transport.test.d.ts +1 -0
- package/dist/__tests__/ssh-transport.test.js +618 -0
- package/dist/__tests__/ssh-transport.test.js.map +1 -0
- package/dist/__tests__/tools.test.d.ts +1 -0
- package/dist/__tests__/tools.test.js +525 -0
- package/dist/__tests__/tools.test.js.map +1 -0
- package/dist/config.d.ts +65 -0
- package/dist/config.js +506 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/documentation.d.ts +5 -0
- package/dist/resources/documentation.js +56 -0
- package/dist/resources/documentation.js.map +1 -0
- package/dist/tools/cli-utilities.d.ts +3 -0
- package/dist/tools/cli-utilities.js +187 -0
- package/dist/tools/cli-utilities.js.map +1 -0
- package/dist/tools/config.d.ts +6 -0
- package/dist/tools/config.js +326 -0
- package/dist/tools/config.js.map +1 -0
- package/dist/tools/consents.d.ts +3 -0
- package/dist/tools/consents.js +39 -0
- package/dist/tools/consents.js.map +1 -0
- package/dist/tools/instances.d.ts +3 -0
- package/dist/tools/instances.js +14 -0
- package/dist/tools/instances.js.map +1 -0
- package/dist/tools/oidc-rp.d.ts +6 -0
- package/dist/tools/oidc-rp.js +246 -0
- package/dist/tools/oidc-rp.js.map +1 -0
- package/dist/tools/oidc.d.ts +3 -0
- package/dist/tools/oidc.js +343 -0
- package/dist/tools/oidc.js.map +1 -0
- package/dist/tools/secondfactors.d.ts +3 -0
- package/dist/tools/secondfactors.js +62 -0
- package/dist/tools/secondfactors.js.map +1 -0
- package/dist/tools/sessions.d.ts +6 -0
- package/dist/tools/sessions.js +300 -0
- package/dist/tools/sessions.js.map +1 -0
- package/dist/transport/api.d.ts +35 -0
- package/dist/transport/api.js +327 -0
- package/dist/transport/api.js.map +1 -0
- package/dist/transport/interface.d.ts +50 -0
- package/dist/transport/interface.js +2 -0
- package/dist/transport/interface.js.map +1 -0
- package/dist/transport/k8s.d.ts +41 -0
- package/dist/transport/k8s.js +303 -0
- package/dist/transport/k8s.js.map +1 -0
- package/dist/transport/registry.d.ts +20 -0
- package/dist/transport/registry.js +91 -0
- package/dist/transport/registry.js.map +1 -0
- package/dist/transport/ssh.d.ts +37 -0
- package/dist/transport/ssh.js +353 -0
- package/dist/transport/ssh.js.map +1 -0
- package/docker-compose.test.yml +16 -0
- package/eslint.config.js +21 -0
- package/package.json +38 -0
- package/src/__tests__/api-transport.test.ts +746 -0
- package/src/__tests__/config.test.ts +587 -0
- package/src/__tests__/integration/api-mode.test.ts +229 -0
- package/src/__tests__/integration/oidc-rp.test.ts +138 -0
- package/src/__tests__/integration/ssh-mode.test.ts +113 -0
- package/src/__tests__/k8s-transport.test.ts +342 -0
- package/src/__tests__/oidc-tools.test.ts +554 -0
- package/src/__tests__/registry.test.ts +110 -0
- package/src/__tests__/ssh-transport.test.ts +805 -0
- package/src/__tests__/tools.test.ts +735 -0
- package/src/config.ts +605 -0
- package/src/index.ts +48 -0
- package/src/resources/documentation.ts +65 -0
- package/src/tools/cli-utilities.ts +207 -0
- package/src/tools/config.ts +382 -0
- package/src/tools/consents.ts +50 -0
- package/src/tools/instances.ts +21 -0
- package/src/tools/oidc-rp.ts +299 -0
- package/src/tools/oidc.ts +434 -0
- package/src/tools/secondfactors.ts +78 -0
- package/src/tools/sessions.ts +342 -0
- package/src/transport/api.ts +429 -0
- package/src/transport/interface.ts +58 -0
- package/src/transport/k8s.ts +367 -0
- package/src/transport/registry.ts +105 -0
- package/src/transport/ssh.ts +430 -0
- package/tsconfig.json +16 -0
- package/vitest.config.ts +8 -0
- package/vitest.integration.config.ts +9 -0
package/README.md
ADDED
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
# llng-mcp
|
|
2
|
+
|
|
3
|
+
MCP Server for Lemonldap-NG
|
|
4
|
+
|
|
5
|
+
A Model Context Protocol (MCP) server that enables AI assistants to manage and monitor Lemonldap-NG web SSO instances. Supports both local SSH/CLI mode and remote REST API mode for comprehensive access control and session management.
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
llng-mcp bridges AI assistants with Lemonldap-NG, a powerful web SSO (Single Sign-On) system. Through 43 tools and 1 resource, it provides AI-native access to configuration management, session control, multi-factor authentication, OIDC testing, and user consent tracking.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
### Configuration Tools (11 tools)
|
|
14
|
+
|
|
15
|
+
- **llng_config_info** - Retrieve current configuration metadata (number, author, date, log)
|
|
16
|
+
- **llng_config_get** - Fetch configuration values by key
|
|
17
|
+
- **llng_config_set** - Update configuration values with optional change log
|
|
18
|
+
- **llng_config_addKey** - Add subkeys to composite configuration parameters
|
|
19
|
+
- **llng_config_delKey** - Remove subkeys from composite configuration parameters
|
|
20
|
+
- **llng_config_export** - Export entire configuration as JSON
|
|
21
|
+
- **llng_config_import** - Replace configuration from JSON backup
|
|
22
|
+
- **llng_config_merge** - Merge JSON snippet into current configuration
|
|
23
|
+
- **llng_config_rollback** - Revert to previous configuration version
|
|
24
|
+
- **llng_config_update_cache** - Force cache refresh on LLNG nodes
|
|
25
|
+
- **llng_config_test_email** - Send a test email to verify SMTP settings
|
|
26
|
+
|
|
27
|
+
### Session Management Tools (6 tools)
|
|
28
|
+
|
|
29
|
+
- **llng_session_get** - Retrieve session data by ID (supports `backend`, `persistent`, `hash`, `refreshTokens` options)
|
|
30
|
+
- **llng_session_search** - Search sessions with filters (supports `where`, `select`, `backend`, `count`, `kind`, `persistent`, `hash`, `idOnly`, `refreshTokens`)
|
|
31
|
+
- **llng_session_delete** - Terminate user sessions (supports `where` filter for bulk deletion, `kind`, `backend`, `persistent`, `hash`, `refreshTokens`)
|
|
32
|
+
- **llng_session_setKey** - Modify session attributes (supports `backend`, `persistent`, `hash`, `refreshTokens` options)
|
|
33
|
+
- **llng_session_delKey** - Remove session attributes (supports `backend`, `persistent`, `hash`, `refreshTokens` options)
|
|
34
|
+
- **llng_session_backup** - Export all sessions as JSON backup (supports `backend`, `persistent`, `refreshTokens` options)
|
|
35
|
+
|
|
36
|
+
### Two-Factor Authentication Tools (3 tools)
|
|
37
|
+
|
|
38
|
+
- **llng_2fa_list** - List user's registered 2FA devices
|
|
39
|
+
- **llng_2fa_delete** - Remove specific 2FA devices
|
|
40
|
+
- **llng_2fa_delType** - Remove all devices of a given type (TOTP, U2F, etc.)
|
|
41
|
+
|
|
42
|
+
### User Consent Tools (2 tools)
|
|
43
|
+
|
|
44
|
+
- **llng_consent_list** - List user's OIDC provider consents
|
|
45
|
+
- **llng_consent_delete** - Revoke OIDC provider consents
|
|
46
|
+
|
|
47
|
+
### OIDC Relying Party Management Tools (5 tools)
|
|
48
|
+
|
|
49
|
+
- **llng_oidc_issuer_enable** - Enable OIDC issuer (activate issuerDBOpenIDConnectActivation and generate signing keys)
|
|
50
|
+
- **llng_oidc_rp_list** - List configured OIDC Relying Parties with clientID and displayName
|
|
51
|
+
- **llng_oidc_rp_get** - Get full details of an OIDC RP by confKey
|
|
52
|
+
- **llng_oidc_rp_add** - Add a new OIDC Relying Party (clientId, redirectUris, exportedVars, etc.)
|
|
53
|
+
- **llng_oidc_rp_delete** - Delete an OIDC Relying Party by confKey
|
|
54
|
+
|
|
55
|
+
### CLI Utility Tools (7 tools)
|
|
56
|
+
|
|
57
|
+
- **llng_download_saml_metadata** - Download SAML metadata from a remote IdP
|
|
58
|
+
- **llng_import_metadata** - Import a SAML federation into LLNG config
|
|
59
|
+
- **llng_delete_session** - Delete user sessions by UID pattern
|
|
60
|
+
- **llng_user_attributes** - Look up user attributes
|
|
61
|
+
- **llng_purge_central_cache** - Purge expired sessions from central cache
|
|
62
|
+
- **llng_purge_local_cache** - Purge local handler cache
|
|
63
|
+
- **llng_rotate_oidc_keys** - Rotate OIDC signing keys
|
|
64
|
+
|
|
65
|
+
### OIDC Testing Tools (8 tools)
|
|
66
|
+
|
|
67
|
+
- **llng_oidc_metadata** - Fetch OIDC provider discovery metadata
|
|
68
|
+
- **llng_oidc_authorize** - Generate authorization URL with PKCE flow
|
|
69
|
+
- **llng_oidc_tokens** - Exchange authorization code for access/refresh tokens
|
|
70
|
+
- **llng_oidc_userinfo** - Retrieve authenticated user information
|
|
71
|
+
- **llng_oidc_introspect** - Validate and inspect access tokens
|
|
72
|
+
- **llng_oidc_refresh** - Refresh expired access tokens
|
|
73
|
+
- **llng_oidc_whoami** - Decode ID token to display user identity
|
|
74
|
+
- **llng_oidc_check_auth** - Test authentication status of protected resources
|
|
75
|
+
|
|
76
|
+
### Documentation Resource (1 resource)
|
|
77
|
+
|
|
78
|
+
- **llng-documentation** - Fetch live documentation pages from lemonldap-ng.org
|
|
79
|
+
|
|
80
|
+
### Instance Discovery (1 tool)
|
|
81
|
+
|
|
82
|
+
- **llng_instances** - List available LLNG instances and their transport mode
|
|
83
|
+
|
|
84
|
+
## Installation
|
|
85
|
+
|
|
86
|
+
Requires Node.js 20 or higher.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npm install llng-mcp
|
|
90
|
+
npm run build
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Configuration
|
|
94
|
+
|
|
95
|
+
The MCP server reads configuration from `~/.llng-mcp.json` with support for environment variable overrides. Two operation modes are available.
|
|
96
|
+
|
|
97
|
+
### SSH/CLI Mode (Default)
|
|
98
|
+
|
|
99
|
+
Execute commands via SSH or locally using Lemonldap-NG CLI tools.
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"mode": "ssh",
|
|
104
|
+
"ssh": {
|
|
105
|
+
"binPrefix": "/usr/share/lemonldap-ng/bin"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
For remote SSH connections:
|
|
111
|
+
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"mode": "ssh",
|
|
115
|
+
"ssh": {
|
|
116
|
+
"host": "llng.example.com",
|
|
117
|
+
"user": "root",
|
|
118
|
+
"port": 22,
|
|
119
|
+
"sudo": "root",
|
|
120
|
+
"binPrefix": "/usr/share/lemonldap-ng/bin"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
#### `remoteCommand` - Execute via Docker, LXC, etc.
|
|
126
|
+
|
|
127
|
+
The `remoteCommand` field inserts a command between SSH/sudo and the LLNG CLI binary. This allows running commands inside containers or through other wrappers:
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"mode": "ssh",
|
|
132
|
+
"ssh": {
|
|
133
|
+
"host": "server.example.com",
|
|
134
|
+
"remoteCommand": "docker exec sso-auth-1",
|
|
135
|
+
"binPrefix": "/usr/share/lemonldap-ng/bin"
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
This produces: `ssh server.example.com docker exec sso-auth-1 /usr/share/lemonldap-ng/bin/lemonldap-ng-cli ...`
|
|
141
|
+
|
|
142
|
+
#### `binPrefix` - Custom binary location
|
|
143
|
+
|
|
144
|
+
The `binPrefix` field (default: `/usr/share/lemonldap-ng/bin`) sets the base directory for all LLNG CLI tools. Individual paths (`cliPath`, `sessionsPath`, `configEditorPath`) can still override specific binaries.
|
|
145
|
+
|
|
146
|
+
**SSH Mode Limitations**: The following operations require API mode:
|
|
147
|
+
|
|
148
|
+
- `llng_2fa_list` - List 2FA devices
|
|
149
|
+
- `llng_2fa_delete` - Remove 2FA devices
|
|
150
|
+
- `llng_2fa_delType` - Remove all devices of type
|
|
151
|
+
- `llng_consent_list` - List user consents
|
|
152
|
+
- `llng_consent_delete` - Revoke consents
|
|
153
|
+
|
|
154
|
+
### API Mode
|
|
155
|
+
|
|
156
|
+
Call REST endpoints on LLNG manager with optional HTTP Basic authentication.
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"mode": "api",
|
|
161
|
+
"api": {
|
|
162
|
+
"baseUrl": "https://manager.example.com/api/v1",
|
|
163
|
+
"basicAuth": {
|
|
164
|
+
"username": "admin",
|
|
165
|
+
"password": "secret"
|
|
166
|
+
},
|
|
167
|
+
"verifySsl": true
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Kubernetes Mode
|
|
173
|
+
|
|
174
|
+
Execute commands inside Kubernetes pods using `kubectl exec`. The server automatically resolves a pod from a Deployment using label selectors.
|
|
175
|
+
|
|
176
|
+
```json
|
|
177
|
+
{
|
|
178
|
+
"mode": "k8s",
|
|
179
|
+
"k8s": {
|
|
180
|
+
"context": "prod-cluster",
|
|
181
|
+
"namespace": "auth",
|
|
182
|
+
"deployment": "lemonldap-ng",
|
|
183
|
+
"container": "sso"
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
- **`context`** (optional) - kubectl context to use
|
|
189
|
+
- **`namespace`** (required) - Kubernetes namespace
|
|
190
|
+
- **`deployment`** (required) - Deployment name (used to derive the default pod selector `app.kubernetes.io/name=DEPLOYMENT`)
|
|
191
|
+
- **`container`** (optional) - Container name within the pod (omit if single container)
|
|
192
|
+
- **`podSelector`** (optional) - Override the label selector for pod resolution (default: `app.kubernetes.io/name=DEPLOYMENT`)
|
|
193
|
+
- **`binPrefix`** (optional) - Path to LLNG binaries inside the pod (default: `/usr/share/lemonldap-ng/bin`)
|
|
194
|
+
|
|
195
|
+
K8s mode has the same limitations as SSH mode (2FA and consents require API mode).
|
|
196
|
+
|
|
197
|
+
### OIDC Configuration (Optional)
|
|
198
|
+
|
|
199
|
+
For OIDC testing tools:
|
|
200
|
+
|
|
201
|
+
```json
|
|
202
|
+
{
|
|
203
|
+
"oidc": {
|
|
204
|
+
"issuer": "https://auth.example.com",
|
|
205
|
+
"clientId": "my-app",
|
|
206
|
+
"clientSecret": "secret",
|
|
207
|
+
"redirectUri": "http://localhost:8080/callback",
|
|
208
|
+
"scope": "openid profile email"
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Multi-Instance Configuration
|
|
214
|
+
|
|
215
|
+
To manage multiple LLNG instances from a single MCP server, use the `instances` format:
|
|
216
|
+
|
|
217
|
+
```json
|
|
218
|
+
{
|
|
219
|
+
"instances": {
|
|
220
|
+
"prod": {
|
|
221
|
+
"mode": "api",
|
|
222
|
+
"api": {
|
|
223
|
+
"baseUrl": "https://manager-prod.example.com/api/v1",
|
|
224
|
+
"basicAuth": { "username": "admin", "password": "secret" }
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
"staging": {
|
|
228
|
+
"mode": "ssh",
|
|
229
|
+
"ssh": {
|
|
230
|
+
"host": "staging.example.com",
|
|
231
|
+
"user": "root"
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
"local": {
|
|
235
|
+
"mode": "ssh"
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
"default": "prod"
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
- **`instances`** - Named LLNG instance configurations, each with its own `mode`, `ssh`, `api`, and `oidc` settings
|
|
243
|
+
- **`default`** - Name of the instance used when the `instance` parameter is omitted (defaults to the first instance if not specified)
|
|
244
|
+
- All tools accept an optional **`instance`** parameter to target a specific instance
|
|
245
|
+
- The legacy flat format (without `instances`) is fully supported and treated as a single "default" instance
|
|
246
|
+
- Environment variables (`LLNG_*`) apply to the default instance only
|
|
247
|
+
|
|
248
|
+
### Environment Variables
|
|
249
|
+
|
|
250
|
+
Configuration can be overridden via environment variables:
|
|
251
|
+
|
|
252
|
+
**Mode**
|
|
253
|
+
|
|
254
|
+
- `LLNG_MODE` - Set to "ssh" or "api"
|
|
255
|
+
|
|
256
|
+
**SSH Configuration**
|
|
257
|
+
|
|
258
|
+
- `LLNG_SSH_HOST` - Hostname for SSH connection
|
|
259
|
+
- `LLNG_SSH_USER` - SSH username
|
|
260
|
+
- `LLNG_SSH_PORT` - SSH port (default: 22)
|
|
261
|
+
- `LLNG_SSH_SUDO` - User to sudo to
|
|
262
|
+
- `LLNG_SSH_REMOTE_COMMAND` - Command inserted between SSH/sudo and LLNG binaries (e.g., `docker exec container-name`)
|
|
263
|
+
- `LLNG_SSH_BIN_PREFIX` - Base directory for LLNG CLI tools (default: `/usr/share/lemonldap-ng/bin`)
|
|
264
|
+
- `LLNG_SSH_CLI_PATH` - Path to lemonldap-ng-cli (overrides binPrefix)
|
|
265
|
+
- `LLNG_SSH_SESSIONS_PATH` - Path to lemonldap-ng-sessions (overrides binPrefix)
|
|
266
|
+
- `LLNG_SSH_CONFIG_EDITOR_PATH` - Path to lmConfigEditor (overrides binPrefix)
|
|
267
|
+
|
|
268
|
+
**Kubernetes Configuration**
|
|
269
|
+
|
|
270
|
+
- `LLNG_K8S_CONTEXT` - kubectl context
|
|
271
|
+
- `LLNG_K8S_NAMESPACE` - Kubernetes namespace
|
|
272
|
+
- `LLNG_K8S_DEPLOYMENT` - Deployment name
|
|
273
|
+
- `LLNG_K8S_CONTAINER` - Container name (optional)
|
|
274
|
+
- `LLNG_K8S_POD_SELECTOR` - Label selector override
|
|
275
|
+
- `LLNG_K8S_BIN_PREFIX` - Path to LLNG binaries inside the pod
|
|
276
|
+
|
|
277
|
+
**API Configuration**
|
|
278
|
+
|
|
279
|
+
- `LLNG_API_URL` - API base URL
|
|
280
|
+
- `LLNG_API_BASIC_USER` - HTTP Basic Auth username
|
|
281
|
+
- `LLNG_API_BASIC_PASSWORD` - HTTP Basic Auth password
|
|
282
|
+
- `LLNG_API_VERIFY_SSL` - Set to "false" to skip SSL verification
|
|
283
|
+
|
|
284
|
+
**OIDC Configuration**
|
|
285
|
+
|
|
286
|
+
- `LLNG_OIDC_ISSUER` - OIDC issuer URL
|
|
287
|
+
- `LLNG_OIDC_CLIENT_ID` - OIDC client ID
|
|
288
|
+
- `LLNG_OIDC_CLIENT_SECRET` - OIDC client secret
|
|
289
|
+
- `LLNG_OIDC_REDIRECT_URI` - OIDC redirect URI
|
|
290
|
+
- `LLNG_OIDC_SCOPE` - OIDC scopes
|
|
291
|
+
|
|
292
|
+
> **Note**: When using multi-instance configuration, environment variables override the **default instance** only.
|
|
293
|
+
|
|
294
|
+
## Usage with Claude Desktop
|
|
295
|
+
|
|
296
|
+
Add this to your Claude Desktop configuration (`~/.claude/desktop_config.json`):
|
|
297
|
+
|
|
298
|
+
```json
|
|
299
|
+
{
|
|
300
|
+
"mcpServers": {
|
|
301
|
+
"llng": {
|
|
302
|
+
"command": "node",
|
|
303
|
+
"args": ["/path/to/llng-mcp/dist/index.js"]
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
If you have configuration in `~/.llng-mcp.json`, it will be automatically loaded. You can also override via environment variables:
|
|
310
|
+
|
|
311
|
+
```json
|
|
312
|
+
{
|
|
313
|
+
"mcpServers": {
|
|
314
|
+
"llng": {
|
|
315
|
+
"command": "node",
|
|
316
|
+
"args": ["/path/to/llng-mcp/dist/index.js"],
|
|
317
|
+
"env": {
|
|
318
|
+
"LLNG_MODE": "api",
|
|
319
|
+
"LLNG_API_URL": "https://manager.example.com/api/v1"
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
## Usage with Other MCP Clients
|
|
327
|
+
|
|
328
|
+
### Inspect Tool with npx
|
|
329
|
+
|
|
330
|
+
Test the server using the official MCP inspector:
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
npx @modelcontextprotocol/inspector node dist/index.js
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
This opens an interactive inspector where you can call tools and see results.
|
|
337
|
+
|
|
338
|
+
### Configuration
|
|
339
|
+
|
|
340
|
+
Configure your MCP client to connect to the stdio server. For example, with `cline`:
|
|
341
|
+
|
|
342
|
+
```json
|
|
343
|
+
{
|
|
344
|
+
"mcpServers": {
|
|
345
|
+
"llng": {
|
|
346
|
+
"command": "node",
|
|
347
|
+
"args": ["/absolute/path/to/llng-mcp/dist/index.js"]
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
## Tools Reference
|
|
354
|
+
|
|
355
|
+
> **Note**: All tools accept an optional `instance` parameter (string) to target a specific LLNG instance. When omitted, the default instance is used.
|
|
356
|
+
|
|
357
|
+
### Configuration Management
|
|
358
|
+
|
|
359
|
+
| Tool | Description | Parameters | Mode |
|
|
360
|
+
| ------------------------ | -------------------- | --------------------------- | ------- |
|
|
361
|
+
| llng_config_info | Get config metadata | None | Both |
|
|
362
|
+
| llng_config_get | Fetch config values | keys (string[]) | Both |
|
|
363
|
+
| llng_config_set | Update config values | keys (object), log (string) | Both |
|
|
364
|
+
| llng_config_addKey | Add composite key | key, subkey, value | Both |
|
|
365
|
+
| llng_config_delKey | Delete composite key | key, subkey | Both |
|
|
366
|
+
| llng_config_export | Export as JSON | None | Both |
|
|
367
|
+
| llng_config_import | Import from JSON | json (string) | Both |
|
|
368
|
+
| llng_config_merge | Merge JSON | json (string) | Both |
|
|
369
|
+
| llng_config_rollback | Revert previous | None | Both |
|
|
370
|
+
| llng_config_update_cache | Force cache refresh | None | Both |
|
|
371
|
+
| llng_config_test_email | Send test email | destination (string) | SSH/K8s |
|
|
372
|
+
|
|
373
|
+
### Session Management
|
|
374
|
+
|
|
375
|
+
| Tool | Description | Parameters | Mode |
|
|
376
|
+
| ------------------- | ----------------- | ---------------------------------------------------------------------------- | ---- |
|
|
377
|
+
| llng_session_get | Get session | id, backend, persistent, hash, refreshTokens | Both |
|
|
378
|
+
| llng_session_search | Search sessions | where, select, backend, count, kind, persistent, hash, idOnly, refreshTokens | Both |
|
|
379
|
+
| llng_session_delete | Delete sessions | ids (optional), where, kind, backend, persistent, hash, refreshTokens | Both |
|
|
380
|
+
| llng_session_setKey | Modify session | id, keys, backend, persistent, hash, refreshTokens | Both |
|
|
381
|
+
| llng_session_delKey | Remove attributes | id, keys, backend, persistent, hash, refreshTokens | Both |
|
|
382
|
+
| llng_session_backup | Export sessions | backend, persistent, refreshTokens | Both |
|
|
383
|
+
|
|
384
|
+
### Two-Factor Authentication
|
|
385
|
+
|
|
386
|
+
| Tool | Description | Parameters | Mode |
|
|
387
|
+
| ---------------- | -------------- | -------------------- | -------- |
|
|
388
|
+
| llng_2fa_list | List devices | user (string) | API Only |
|
|
389
|
+
| llng_2fa_delete | Remove devices | user, ids (string[]) | API Only |
|
|
390
|
+
| llng_2fa_delType | Remove by type | user, type (string) | API Only |
|
|
391
|
+
|
|
392
|
+
### User Consents
|
|
393
|
+
|
|
394
|
+
| Tool | Description | Parameters | Mode |
|
|
395
|
+
| ------------------- | --------------- | -------------------- | -------- |
|
|
396
|
+
| llng_consent_list | List consents | user (string) | API Only |
|
|
397
|
+
| llng_consent_delete | Revoke consents | user, ids (string[]) | API Only |
|
|
398
|
+
|
|
399
|
+
### Instance Discovery
|
|
400
|
+
|
|
401
|
+
| Tool | Description | Parameters | Mode |
|
|
402
|
+
| -------------- | ------------------------ | ---------- | ---- |
|
|
403
|
+
| llng_instances | List available instances | None | Both |
|
|
404
|
+
|
|
405
|
+
### OIDC Relying Party Management
|
|
406
|
+
|
|
407
|
+
| Tool | Description | Parameters | Mode |
|
|
408
|
+
| ----------------------- | ------------------ | ---------------------------------------------------------------------------------------------- | ---- |
|
|
409
|
+
| llng_oidc_issuer_enable | Enable OIDC issuer | force (optional bool) | Both |
|
|
410
|
+
| llng_oidc_rp_list | List OIDC RPs | None | Both |
|
|
411
|
+
| llng_oidc_rp_get | Get RP details | confKey | Both |
|
|
412
|
+
| llng_oidc_rp_add | Add new RP | confKey, clientId, redirectUris, clientSecret, displayName, exportedVars, extraClaims, options | Both |
|
|
413
|
+
| llng_oidc_rp_delete | Delete RP | confKey | Both |
|
|
414
|
+
|
|
415
|
+
### CLI Utilities
|
|
416
|
+
|
|
417
|
+
| Tool | Description | Parameters | Mode |
|
|
418
|
+
| --------------------------- | ------------------------ | ----------------------------------------------------------------------- | ------- |
|
|
419
|
+
| llng_download_saml_metadata | Download SAML metadata | url, outputFile, noCheck, verbose | SSH/K8s |
|
|
420
|
+
| llng_import_metadata | Import SAML federation | url, spPrefix, idpPrefix, ignoreSp, ignoreIdp, remove, noCheck, verbose | SSH/K8s |
|
|
421
|
+
| llng_delete_session | Delete sessions by UID | uid, force, debug | SSH/K8s |
|
|
422
|
+
| llng_user_attributes | Look up user attributes | username, field | SSH/K8s |
|
|
423
|
+
| llng_purge_central_cache | Purge central cache | debug, force, json | SSH/K8s |
|
|
424
|
+
| llng_purge_local_cache | Purge local cache | debug | SSH/K8s |
|
|
425
|
+
| llng_rotate_oidc_keys | Rotate OIDC signing keys | debug | SSH/K8s |
|
|
426
|
+
|
|
427
|
+
### OIDC Testing
|
|
428
|
+
|
|
429
|
+
| Tool | Description | Parameters | Requires Config |
|
|
430
|
+
| -------------------- | --------------- | ---------------------- | --------------- |
|
|
431
|
+
| llng_oidc_metadata | Fetch discovery | None | OIDC config |
|
|
432
|
+
| llng_oidc_authorize | Get auth URL | scope (optional) | OIDC config |
|
|
433
|
+
| llng_oidc_tokens | Exchange code | code, code_verifier | OIDC config |
|
|
434
|
+
| llng_oidc_userinfo | Get user info | access_token (string) | OIDC config |
|
|
435
|
+
| llng_oidc_introspect | Inspect token | token (string) | OIDC config |
|
|
436
|
+
| llng_oidc_refresh | Refresh token | refresh_token (string) | OIDC config |
|
|
437
|
+
| llng_oidc_whoami | Decode ID token | id_token (string) | OIDC config |
|
|
438
|
+
| llng_oidc_check_auth | Test protected | url, access_token | OIDC config |
|
|
439
|
+
|
|
440
|
+
## Development
|
|
441
|
+
|
|
442
|
+
### Build
|
|
443
|
+
|
|
444
|
+
```bash
|
|
445
|
+
npm run build
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
### Watch Mode
|
|
449
|
+
|
|
450
|
+
```bash
|
|
451
|
+
npm run dev
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
### Unit Tests
|
|
455
|
+
|
|
456
|
+
```bash
|
|
457
|
+
npm test
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
### Integration Tests
|
|
461
|
+
|
|
462
|
+
Requires Docker Compose for running Lemonldap-NG instance:
|
|
463
|
+
|
|
464
|
+
```bash
|
|
465
|
+
npm run test:integration
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
The test stack includes a full Lemonldap-NG instance accessible at `http://localhost:19876`.
|
|
469
|
+
|
|
470
|
+
View test configuration in `docker-compose.test.yml`.
|
|
471
|
+
|
|
472
|
+
## Architecture
|
|
473
|
+
|
|
474
|
+
llng-mcp uses an abstraction layer (`ILlngTransport`) with two implementations:
|
|
475
|
+
|
|
476
|
+
- **SshTransport** - Executes CLI commands via SSH or locally using child_process
|
|
477
|
+
- **K8sTransport** - Executes CLI commands inside Kubernetes pods via kubectl exec
|
|
478
|
+
- **ApiTransport** - Makes HTTP requests to LLNG REST API
|
|
479
|
+
|
|
480
|
+
A `TransportRegistry` manages transport instances per named configuration, enabling multi-instance support. All tools resolve their transport through the registry, allowing seamless switching between modes and instances.
|
|
481
|
+
|
|
482
|
+
## Limitations
|
|
483
|
+
|
|
484
|
+
### SSH Mode
|
|
485
|
+
|
|
486
|
+
2FA management and user consent operations require the REST API. The CLI tools (`lemonldap-ng-cli` and `lemonldap-ng-sessions`) provide read-only or delete-only capabilities for these features.
|
|
487
|
+
|
|
488
|
+
### API Mode
|
|
489
|
+
|
|
490
|
+
Ensure the LLNG manager is properly configured with REST endpoints enabled and authentication credentials provided.
|
|
491
|
+
|
|
492
|
+
### OIDC Tools
|
|
493
|
+
|
|
494
|
+
OIDC testing tools are optional. Omit OIDC configuration if not needed.
|
|
495
|
+
|
|
496
|
+
## License
|
|
497
|
+
|
|
498
|
+
AGPL-3.0
|
|
499
|
+
|
|
500
|
+
Copyright: 2026 [LINAGORA](https://linagora.com)
|
|
501
|
+
|
|
502
|
+
See the [Lemonldap-NG project](https://lemonldap-ng.org/) for more information.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|