invgate-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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 InvGate
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/README.md ADDED
@@ -0,0 +1,113 @@
1
+ # invgate-mcp
2
+
3
+ A curated [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) server
4
+ that exposes **12 read-only tools** over stdio for [InvGate Asset Management](https://www.invgate.com/asset-management).
5
+ Any MCP-compatible client (Claude Desktop, etc.) can query assets, people,
6
+ computers, servers, software, and API health through natural language.
7
+
8
+ - **Transport**: stdio only (the universal default for local agents).
9
+ - **Auth**: OAuth2 client-credentials flow (`scope=read`), in-memory token
10
+ cache with a 60-second expiry buffer and one-shot 401 retry.
11
+ - **Validation**: every tool input is validated with [zod](https://zod.dev);
12
+ invalid input returns a structured `validation_error` without calling the API.
13
+ - **Resilience**: HTTP, auth, and network failures are converted to MCP text
14
+ content with `isError: true` — the server never crashes the host.
15
+ - **Distribution**: published to npm, runnable via `npx invgate-mcp`.
16
+
17
+ ## Install
18
+
19
+ ```bash
20
+ # Run without installing
21
+ npx invgate-mcp
22
+
23
+ # Or install globally
24
+ npm install -g invgate-mcp
25
+ invgate-mcp
26
+ ```
27
+
28
+ ## Configuration
29
+
30
+ The server reads three required environment variables at startup:
31
+
32
+ | Env var | Description | Example |
33
+ |---|---|---|
34
+ | `INVGATE_BASE_URL` | InvGate public API base URL (ends with `/public-api/v2`) | `https://acme.invgate.net/public-api/v2` |
35
+ | `INVGATE_CLIENT_ID` | OAuth2 client ID | `my-client-id` |
36
+ | `INVGATE_CLIENT_SECRET` | OAuth2 client secret | `my-client-secret` |
37
+
38
+ If any are missing the server prints a descriptive error to stderr and exits
39
+ with code 1.
40
+
41
+ The OAuth2 token endpoint is derived from `INVGATE_BASE_URL` by stripping the
42
+ `/public-api/v2` segment and appending `/oauth2/token/`, so
43
+ `https://acme.invgate.net/public-api/v2` → `https://acme.invgate.net/oauth2/token/`.
44
+
45
+ ## Claude Desktop config
46
+
47
+ Add `invgate-mcp` to your `mcpServers` block
48
+ (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
49
+
50
+ ```json
51
+ {
52
+ "mcpServers": {
53
+ "invgate": {
54
+ "command": "npx",
55
+ "args": ["-y", "invgate-mcp"],
56
+ "env": {
57
+ "INVGATE_BASE_URL": "https://acme.invgate.net/public-api/v2",
58
+ "INVGATE_CLIENT_ID": "your-client-id",
59
+ "INVGATE_CLIENT_SECRET": "your-client-secret"
60
+ }
61
+ }
62
+ }
63
+ }
64
+ ```
65
+
66
+ ## Tools
67
+
68
+ | Tool | Input | Behavior |
69
+ |---|---|---|
70
+ | `invgate_list_asset_types` | _none_ | Returns all asset types |
71
+ | `invgate_list_assets` | `page`, `per_page`, `asset_type_id`, `criteria` | Paginated asset list with optional filters |
72
+ | `invgate_get_asset` | `asset_id` (required) | Single asset by ID |
73
+ | `invgate_list_people` | `page`, `per_page`, `criteria` | Paginated people list |
74
+ | `invgate_get_person` | `person_id` (required) | Single person by ID |
75
+ | `invgate_get_person_assets` | `person_id` (required), `page`, `per_page` | Assets assigned to a person |
76
+ | `invgate_list_computers` | `page`, `per_page`, `criteria` | Assets of type "computer" |
77
+ | `invgate_get_computer` | `asset_id` (required) | Single computer asset |
78
+ | `invgate_list_servers` | `page`, `per_page`, `criteria` | Assets of type "server" |
79
+ | `invgate_get_server` | `asset_id` (required) | Single server asset |
80
+ | `invgate_get_health` | _none_ | API connectivity status |
81
+ | `invgate_list_software` | `page`, `per_page`, `criteria` | Paginated installed-software catalog |
82
+
83
+ ### Parameter mapping
84
+
85
+ Tool inputs use `snake_case`; the server maps them to the InvGate API query
86
+ parameters. `per_page` → `page_size`, `asset_type_id` → `asset_types`.
87
+ The `criteria` object maps to InvGate's nested syntax:
88
+ `{ "name": "cont:MacBook" }` becomes `criteria[name]=cont:MacBook` on the
89
+ query string (`op` examples: `cont`, `eq`, `startswith`, …).
90
+
91
+ ### Results & errors
92
+
93
+ - **Success**: the raw JSON response body, pretty-printed, as MCP `text` content.
94
+ - **Errors**: structured JSON `{ "error": "...", "message": "...", "status": ... }`
95
+ as text content with `isError: true`. Types:
96
+ `validation_error`, `auth_error`, `api_error`, `network_error`.
97
+
98
+ ## Development
99
+
100
+ ```bash
101
+ npm install
102
+ npm run build # tsup → dist/index.js (single ESM bundle)
103
+ npm run typecheck # tsc --noEmit
104
+ npm test # vitest run (59 tests, MSW for HTTP interception)
105
+ npm run test:coverage # vitest run --coverage (80% gate on src/**)
106
+ npm run dev # tsx src/index.ts
107
+ ```
108
+
109
+ Requires Node.js 20+ (uses native `fetch`).
110
+
111
+ ## License
112
+
113
+ MIT