portkey-admin-mcp 0.10.0 → 0.11.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 CHANGED
@@ -4,25 +4,29 @@
4
4
 
5
5
  <h1>Portkey Admin MCP Server</h1>
6
6
 
7
- **The [Portkey](https://portkey.ai/) Admin API as an MCP server — 171 tools across prompts, configs, keys, analytics, governance, and more.**
7
+ **The [Portkey](https://portkey.ai/) Admin API as an MCP server — 178 tools across prompts, configs, keys, analytics, governance, deployments, and more.**
8
8
 
9
9
  </div>
10
10
 
11
11
  <p align="center">
12
12
  <a href="https://www.npmjs.com/package/portkey-admin-mcp"><img src="https://img.shields.io/npm/v/portkey-admin-mcp.svg" alt="npm version"></a>
13
- <a href="https://www.npmjs.com/package/portkey-admin-mcp"><img src="https://img.shields.io/npm/dm/portkey-admin-mcp.svg" alt="npm downloads"></a>
14
13
  <a href="https://nodejs.org/"><img src="https://img.shields.io/badge/node-%3E%3D24-brightgreen.svg" alt="Node.js"></a>
15
14
  <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
16
- <br>
15
+ </p>
16
+
17
+ <p align="center">
17
18
  <a href="https://github.com/CodesWhat/portkey-admin-mcp/actions/workflows/ci.yml"><img src="https://github.com/CodesWhat/portkey-admin-mcp/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
18
19
  <a href="https://securityscorecards.dev/viewer/?uri=github.com/CodesWhat/portkey-admin-mcp"><img src="https://img.shields.io/ossf-scorecard/github.com/CodesWhat/portkey-admin-mcp?label=openssf+scorecard&style=flat" alt="OpenSSF Scorecard"></a>
19
20
  <a href="https://www.bestpractices.dev/projects/14031"><img src="https://www.bestpractices.dev/projects/14031/badge" alt="OpenSSF Best Practices"></a>
20
- <a href="https://github.com/punkpeye/awesome-mcp-servers"><img src="https://awesome.re/mentioned-badge.svg" alt="Mentioned in Awesome MCP Servers"></a>
21
- <a href="https://lobehub.com/mcp/codeswhat-portkey-admin-mcp"><img src="https://lobehub.com/badge/mcp/codeswhat-portkey-admin-mcp" alt="LobeHub MCP"></a>
21
+ <a href="https://qlty.sh/gh/CodesWhat/projects/portkey-admin-mcp"><img src="https://qlty.sh/gh/CodesWhat/projects/portkey-admin-mcp/maintainability.svg" alt="Maintainability"></a>
22
+ <a href="https://qlty.sh/gh/CodesWhat/projects/portkey-admin-mcp"><img src="https://qlty.sh/gh/CodesWhat/projects/portkey-admin-mcp/coverage.svg" alt="Code Coverage"></a>
22
23
  </p>
23
24
 
24
25
  <p align="center">
25
- <a href="https://glama.ai/mcp/servers/CodesWhat/portkey-admin-mcp"><img src="https://glama.ai/mcp/servers/CodesWhat/portkey-admin-mcp/badges/card.svg" alt="portkey-admin-mcp MCP server"></a>
26
+ <a href="https://www.npmjs.com/package/portkey-admin-mcp"><img src="https://img.shields.io/npm/dm/portkey-admin-mcp.svg" alt="npm downloads"></a>
27
+ <a href="https://github.com/punkpeye/awesome-mcp-servers"><img src="https://awesome.re/mentioned-badge.svg" alt="Mentioned in Awesome MCP Servers"></a>
28
+ <a href="https://registry.modelcontextprotocol.io/v0/servers?search=io.github.CodesWhat/portkey-admin-mcp"><img src="https://img.shields.io/badge/MCP-Registry-blue" alt="MCP Registry"></a>
29
+ <a href="https://github.com/sponsors/CodesWhat"><img src="https://img.shields.io/badge/Sponsor-ea4aaa?logo=githubsponsors&logoColor=white" alt="Sponsor"></a>
26
30
  </p>
27
31
 
28
32
  <hr>
@@ -30,24 +34,25 @@
30
34
  > [!IMPORTANT]
31
35
  > **Active compatibility development.** Palo Alto Networks completed its Portkey acquisition on 2026‑05‑29 and now presents Portkey as the core of Prisma AIRS AI Gateway. The Portkey Admin API remains live, and its official OpenAPI and product changelog continued adding control-plane surfaces through August 2026; this project has therefore resumed API-coverage work. It targets the Portkey-compatible API (`x-portkey-api-key`), not Prisma AIRS/Strata Cloud Manager directly. Prisma AIRS AI Gateway currently has a different management and authentication surface, so it is not a `PORTKEY_BASE_URL` swap. See the short [Prisma AIRS interoperability guide](./docs/PRISMA_AIRS_INTEROPERABILITY.md) for the supported side-by-side model and adapter criteria.
32
36
 
33
- <h2 align="center">📑 Contents</h2>
34
-
35
- - [🚀 Quick Start](#quick-start)
36
- - [🧰 What You Can Do](#what-you-can-do)
37
- - [🔑 API Key Scopes](#api-key-scopes)
38
- - [🌐 HTTP Server (Experimental)](#http-server)
39
- - [🏗️ Architecture](./docs/ARCHITECTURE.md)
40
- - [🔄 Prisma AIRS interoperability](./docs/PRISMA_AIRS_INTEROPERABILITY.md)
41
- - [🔏 Verify a release](./docs/VERIFY_RELEASE.md)
42
- - [🛠️ Development](#development)
43
- - [🤝 Contributing](./CONTRIBUTING.md)
44
- - [🏛️ Governance](./GOVERNANCE.md)
45
- - [🛡️ Security assurance](./SECURITY-ASSURANCE.md)
46
- - [🧾 Full tool list — ENDPOINTS.md](./ENDPOINTS.md)
37
+ <h2 align="center">Contents</h2>
38
+
39
+ - [Quick Start](#quick-start)
40
+ - [What You Can Do](#what-you-can-do)
41
+ - [API Key Scopes](#api-key-scopes)
42
+ - [HTTP Server (Experimental)](#http-server)
43
+ - [Architecture](./docs/ARCHITECTURE.md)
44
+ - [Prisma AIRS interoperability](./docs/PRISMA_AIRS_INTEROPERABILITY.md)
45
+ - [Verify a release](./docs/VERIFY_RELEASE.md)
46
+ - [Development](#development)
47
+ - [Community](#community)
48
+ - [Contributing](./CONTRIBUTING.md)
49
+ - [Governance](./GOVERNANCE.md)
50
+ - [Security assurance](./SECURITY-ASSURANCE.md)
51
+ - [Full tool list — ENDPOINTS.md](./ENDPOINTS.md)
47
52
 
48
53
  <hr>
49
54
 
50
- <h2 align="center" id="quick-start">🚀 Quick Start</h2>
55
+ <h2 align="center" id="quick-start">Quick Start</h2>
51
56
 
52
57
  You need a **Portkey API key** with appropriate scopes. Get one from your [Portkey dashboard](https://app.portkey.ai/) under API Keys.
53
58
 
@@ -90,7 +95,7 @@ npx -y portkey-admin-mcp
90
95
  ```
91
96
 
92
97
  Scoping domains is also the biggest lever on context cost, not just access. `tools/list`
93
- is paginated, and the complete 171-tool catalog is roughly 387 KB (~99K tokens) once a
98
+ is paginated, and the complete 178-tool catalog is roughly 400 KB once a
94
99
  client follows `nextCursor` through every page. Narrowing to the domains a client
95
100
  actually needs cuts that roughly proportionally.
96
101
 
@@ -122,7 +127,7 @@ Then use this config:
122
127
 
123
128
  <hr>
124
129
 
125
- <h2 align="center" id="what-you-can-do">🧰 What You Can Do</h2>
130
+ <h2 align="center" id="what-you-can-do">What You Can Do</h2>
126
131
 
127
132
  | Category | Tools | Examples |
128
133
  |----------|-------|---------|
@@ -130,6 +135,7 @@ Then use this config:
130
135
  | **Prompt Partials** | 7 | Reusable prompt fragments with versioning |
131
136
  | **Prompt Labels** | 5 | Organize prompt versions (production, staging, dev) |
132
137
  | **Configs** | 6 | Gateway routing, caching, retry, loadbalancing |
138
+ | **Deployments** | 5 | Register, inspect, update, and archive self-hosted Gateways |
133
139
  | **API Keys** | 6 | Create, rotate, and manage scoped API keys |
134
140
  | **Secret References** | 5 | Manage AWS, Azure, and HashiCorp external-secret references |
135
141
  | **Virtual Keys** | 5 | Manage provider access keys |
@@ -141,30 +147,42 @@ Then use this config:
141
147
  | **Guardrails** | 11 | Content safety policies, organisation defaults, workspace exclusions |
142
148
  | **Usage Limits** | 7 | Cost and token consumption limits |
143
149
  | **Rate Limits** | 5 | Request frequency controls |
144
- | **Analytics** | 20 | Cost, latency, errors, tokens, cache, feedback |
150
+ | **Analytics** | 22 | Cost, latency, errors, tokens, cache, feedback, provider groups |
145
151
  | **Logging** | 10 | Log retrieval, ingestion, export, and field restrictions |
146
152
  | **Tracing** | 2 | Feedback creation and updates on traces |
147
153
  | **Users & Workspaces** | 24 | User management, invites, workspace members, SCIM group mappings |
148
154
  | **Audit** | 1 | Audit log access |
149
155
 
150
- **171 tools total.** See [ENDPOINTS.md](./ENDPOINTS.md) for the full list with descriptions.
156
+ **178 tools total across 20 tool domains.** See [ENDPOINTS.md](./ENDPOINTS.md) for the full list with descriptions.
157
+
158
+ Portkey's newer product language increasingly presents provider credentials as
159
+ Providers, while the current Admin API still exposes both `/virtual-keys` and
160
+ `/providers`. This server keeps both domains: Virtual Keys manage provider access
161
+ credentials, and Providers manage workspace provider configurations.
151
162
 
152
163
  <hr>
153
164
 
154
- <h2 align="center" id="api-key-scopes">🔑 API Key Scopes</h2>
165
+ <h2 align="center" id="api-key-scopes">API Key Scopes</h2>
155
166
 
156
167
  Most tools work with a **workspace-scoped service key** that has Select All permissions enabled. That covers prompts, configs, virtual/API keys, providers, guardrails, workspace integrations, MCP servers, rate/usage limits, logs, prompt completions, and workspace user management.
157
168
 
158
- ### Enterprise-gated tools (40)
169
+ If a tool returns a `403` with Portkey error `AB03`, it means missing scopes — not a broken endpoint.
170
+
171
+ <details>
172
+ <summary><strong>Enterprise-gated tools and other scope requirements</strong></summary>
173
+
174
+ ### Enterprise-gated tools (53)
159
175
 
160
176
  The following tools require an **organisation-level scope that is only available on Portkey Enterprise plans**. They return `403 You do not have enough permissions to execute this request` on workspace plans. Their descriptions include an `Enterprise-gated. Returns 403 on non-Enterprise Portkey plans.` suffix so MCP clients know upfront.
161
177
 
162
178
  | Area | Tools | Required scope |
163
179
  |---|---|---|
164
- | Analytics (20) | `get_cost_analytics`, `get_request_analytics`, `get_token_analytics`, `get_latency_analytics`, `get_error_analytics`, `get_error_rate_analytics`, `get_cache_hit_latency`, `get_cache_hit_rate`, `get_users_analytics`, `get_error_stacks_analytics`, `get_error_status_codes_analytics`, `get_user_requests_analytics`, `get_rescued_requests_analytics`, `get_feedback_analytics`, `get_feedback_models_analytics`, `get_feedback_scores_analytics`, `get_feedback_weighted_analytics`, `get_analytics_group_users`, `get_analytics_group_models`, `get_analytics_group_metadata` | org-level `analytics.view` |
180
+ | Analytics (22) | `get_cost_analytics`, `get_request_analytics`, `get_token_analytics`, `get_latency_analytics`, `get_error_analytics`, `get_error_rate_analytics`, `get_cache_hit_latency`, `get_cache_hit_rate`, `get_cache_summary`, `get_users_analytics`, `get_error_stacks_analytics`, `get_error_status_codes_analytics`, `get_user_requests_analytics`, `get_rescued_requests_analytics`, `get_feedback_analytics`, `get_feedback_models_analytics`, `get_feedback_scores_analytics`, `get_feedback_weighted_analytics`, `get_analytics_group_users`, `get_analytics_group_models`, `get_analytics_group_metadata`, `get_analytics_group_providers` | org-level `analytics.view` |
181
+ | Deployments (5) | `list_deployments`, `register_deployment`, `get_deployment`, `update_deployment`, `archive_deployment` | Enterprise deployment administration |
165
182
  | Audit | `list_audit_logs` | `audit_logs.list` |
166
183
  | Org-level integrations | `get_integration`, `list_integration_models`, `list_integration_workspaces` | `organisation_integrations.read` |
167
184
  | Org-level users | `list_all_users`, `get_user`, `get_user_stats`, `list_user_invites` | `organisation_users.list` / `organisation_users.read` |
185
+ | Organisation guardrails (6) | `get_organisation_defaults`, `update_organisation_defaults`, `list_input_guardrail_workspace_exclusions`, `update_input_guardrail_workspace_exclusions`, `list_output_guardrail_workspace_exclusions`, `update_output_guardrail_workspace_exclusions` | `organisation_settings.read/update` and `organisation_exclusions.list/update` |
168
186
  | Log exports (8) | `create_log_export`, `list_log_exports`, `get_log_export`, `start_log_export`, `cancel_log_export`, `download_log_export`, `update_log_export`, `get_log_export_field_restrictions` | Enterprise Logs Export + `logs.export` |
169
187
  | SCIM groups (4) | `list_scim_groups`, `list_scim_workspace_mappings`, `create_scim_workspace_mapping`, `delete_scim_workspace_mapping` | SCIM enabled + organisation admin access |
170
188
 
@@ -175,16 +193,22 @@ The following tools require an **organisation-level scope that is only available
175
193
  | Prompt completions (`run_prompt_completion`) | `completions.write` scope + billing metadata (`app`, `env`) |
176
194
  | Org-level service API key creation via `create_api_key` | `organisation_service_api_keys.create` (Enterprise) |
177
195
 
178
- If a tool returns a `403` with Portkey error `AB03`, it means missing scopes — not a broken endpoint.
196
+ </details>
179
197
 
180
198
  <hr>
181
199
 
182
- <h2 align="center" id="http-server">🌐 HTTP Server (Experimental)</h2>
200
+ <h2 align="center" id="http-server">HTTP Server (Experimental)</h2>
183
201
 
184
202
  > **Status**: The HTTP transport works locally and is covered by the integration test suite, but it is a proof of concept — there is **no hosted version** of this server, and hosted deployment is not currently a goal. Use stdio (npx) as the supported transport.
185
203
 
186
204
  The server supports Streamable HTTP for remote access:
187
205
 
206
+ HTTP authentication controls access to the server, but it does not impersonate
207
+ separate Portkey tenants. All authenticated principals use the same configured
208
+ `PORTKEY_API_KEY` and can invoke any enabled tool and scope that credential
209
+ grants. Run separate instances or deployments with separately scoped Portkey
210
+ credentials and `PORTKEY_TOOL_DOMAINS` allowlists for different trust levels.
211
+
188
212
  ```bash
189
213
  PORTKEY_API_KEY=your_key \
190
214
  MCP_HOST=127.0.0.1 \
@@ -203,7 +227,8 @@ PORTKEY_API_KEY=your_key MCP_AUTH_MODE=bearer MCP_AUTH_TOKEN=your_secret \
203
227
 
204
228
  For local-only HTTP use, leave `MCP_HOST` at its default `127.0.0.1`. Set `MCP_HOST=0.0.0.0` only when you intentionally need to accept connections from outside the local machine, such as Docker or a reverse proxy on another interface.
205
229
 
206
- ### Configuration
230
+ <details>
231
+ <summary><strong>Full environment variable reference</strong></summary>
207
232
 
208
233
  | Variable | Default | Description |
209
234
  |----------|---------|-------------|
@@ -211,7 +236,7 @@ For local-only HTTP use, leave `MCP_HOST` at its default `127.0.0.1`. Set `MCP_H
211
236
  | `PORTKEY_BASE_URL` | `https://api.portkey.ai/v1` | Portkey Admin API base URL. Prisma AIRS/SCM URLs are not compatible; credentialed requests never auto-follow redirects |
212
237
  | `PORTKEY_ALLOW_PRIVATE_BASE_URL` | — | Set to `true` to allow a literal loopback/private `PORTKEY_BASE_URL` |
213
238
  | `PORTKEY_ALLOW_INSECURE_HTTP` | — | Separately set to `true` only when a trusted self-hosted gateway cannot use HTTPS |
214
- | `PORTKEY_TOOL_DOMAINS` | — | Server-side tool-domain allowlist. HTTP `?tools=` may narrow this set but cannot expand it |
239
+ | `PORTKEY_TOOL_DOMAINS` | — | Server-side allowlist of the 20 domains: `users`, `workspaces`, `configs`, `deployments`, `keys`, `collections`, `prompts`, `analytics`, `guardrails`, `limits`, `audit`, `labels`, `partials`, `tracing`, `logging`, `providers`, `secret-references`, `integrations`, `mcp-integrations`, `mcp-servers`. HTTP `?tools=` may narrow it but cannot expand it |
215
240
  | `MCP_HOST` | `127.0.0.1` | Bind address |
216
241
  | `MCP_PORT` | `3000` | Port |
217
242
  | `MCP_PUBLIC_BASE_URL` | — | Public absolute base URL to advertise from `/auth/info` and the status page; recommended for hosted deployments |
@@ -226,6 +251,8 @@ For local-only HTTP use, leave `MCP_HOST` at its default `127.0.0.1`. Set `MCP_H
226
251
  | `MCP_MAX_SESSIONS` | `100` | Maximum concurrent stateful sessions or active stateless request handlers |
227
252
  | `MCP_EVENT_STORE` | `off` | `off`, `memory`, or `redis`; stateless `GET /mcp` replay requires `memory` or `redis` |
228
253
  | `MCP_EVENT_TTL_SECONDS` | `300` | Replay retention in seconds |
254
+ | `MCP_EVENT_STORE_MAX_EVENTS` | `10000` | Maximum events retained by the in-memory replay store; oldest events are evicted first |
255
+ | `MCP_EVENT_STORE_MAX_BYTES` | `67108864` | Approximate maximum serialized bytes retained by the in-memory replay store |
229
256
  | `MCP_EVENT_STORE_COMMAND_TIMEOUT_MS` | `5000` | Redis command timeout for the event store, in milliseconds; `0` disables the timeout (restores unbounded pre-v6 behavior) |
230
257
  | `MCP_REDIS_URL` | — | Redis URL for shared event store; production requires `rediss://` and ACL-scoped credentials |
231
258
  | `MCP_EVENT_ENCRYPTION_KEY` | — | Required 32-byte base64 AES key for Redis replay payloads; generate with `openssl rand -base64 32` |
@@ -233,7 +260,7 @@ For local-only HTTP use, leave `MCP_HOST` at its default `127.0.0.1`. Set `MCP_H
233
260
  | `MCP_TLS_KEY_PATH` | — | TLS key for native HTTPS |
234
261
  | `MCP_TLS_CERT_PATH` | — | TLS cert for native HTTPS |
235
262
  | `ALLOWED_ORIGINS` | — | CORS allow-list; also used to validate the `Host` header (DNS-rebinding protection) when `MCP_AUTH_MODE=none` |
236
- | `MCP_TRUST_PROXY` | `false` | Trust proxy headers (for reverse proxies) |
263
+ | `MCP_TRUST_PROXY` | `loopback` | Express trust-proxy policy. Use an exact nonnegative hop count or trusted proxy subnet; `true` is rejected because it trusts forwarding headers from every peer |
237
264
  | `RATE_LIMIT_STORE` | `memory` | `redis` for multi-instance/serverless deployments; production memory mode requires `RATE_LIMIT_SINGLE_PROCESS=true` |
238
265
  | `RATE_LIMIT_REDIS_URL` | — | Shared limiter Redis URL, falling back to `MCP_REDIS_URL`/`REDIS_URL`; production requires `rediss://` |
239
266
  | `RATE_LIMIT_REDIS_KEY_PREFIX` | `mcp:rate-limit` | Redis namespace for atomic pre-authentication IP and principal-plus-IP token buckets |
@@ -243,6 +270,8 @@ Production containers must choose their rate-limit topology explicitly: set
243
270
  `RATE_LIMIT_STORE=redis` for multi-instance deployments, or set
244
271
  `RATE_LIMIT_SINGLE_PROCESS=true` only for a single long-lived process.
245
272
 
273
+ </details>
274
+
246
275
  <details>
247
276
  <summary><strong>Vercel deployment</strong></summary>
248
277
 
@@ -285,7 +314,7 @@ docker run \
285
314
 
286
315
  <hr>
287
316
 
288
- <h2 align="center" id="development">🛠️ Development</h2>
317
+ <h2 align="center" id="development">Development</h2>
289
318
 
290
319
  ```bash
291
320
  npm run dev # stdio with hot reload
@@ -294,12 +323,17 @@ npm test # unit + contract tests
294
323
  npm run test:coverage # unit + contract tests with the enforced 80% line floor
295
324
  npm run test:e2e # MCP protocol tests
296
325
  npm run test:http # HTTP endpoint smoke test
326
+ npm run smoke # credentialed read-only Portkey API smoke suite
297
327
  npm run ci # full pipeline (lint + typecheck + coverage + build + e2e + verify)
298
328
  ```
299
329
 
330
+ The live smoke suite reports expected credential-scope denials and the explicitly
331
+ tracked hosted control-plane route gaps as skips. Unexpected HTTP responses,
332
+ network errors, and response-contract failures still fail the run.
333
+
300
334
  The required CI and release gates measure every TypeScript source file and fail
301
- below 80% line coverage. The current full report is 99.36% lines, 92.61%
302
- branches, and 99.01% functions.
335
+ below 80% line coverage. The current full report is 98.19% lines, 91.92%
336
+ branches, and 98.58% functions.
303
337
 
304
338
  `npm run dev:http` now requires `MCP_AUTH_MODE=bearer` or `MCP_AUTH_MODE=clerk` by default. For deliberate local-only unauthenticated testing, set `MCP_ALLOW_UNAUTHENTICATED_HTTP=true`.
305
339
 
@@ -309,6 +343,12 @@ documented in [`GOVERNANCE.md`](GOVERNANCE.md). Report vulnerabilities through
309
343
  [`SECURITY.md`](SECURITY.md), and see [`SECURITY-ASSURANCE.md`](SECURITY-ASSURANCE.md)
310
344
  for the public threat model and assurance case.
311
345
 
346
+ <hr>
347
+
348
+ <h2 align="center" id="community">Community</h2>
349
+
350
+ Questions and bug reports belong in [Issues](https://github.com/CodesWhat/portkey-admin-mcp/issues); broader discussion, ideas, and help using the server belong in [Discussions](https://github.com/CodesWhat/portkey-admin-mcp/discussions).
351
+
312
352
  ---
313
353
 
314
354
  <div align="center">
@@ -336,7 +376,11 @@ for the public threat model and assurance case.
336
376
  </picture>
337
377
  </a>
338
378
 
339
- [![Sponsor](https://img.shields.io/badge/Sponsor-ea4aaa?logo=githubsponsors&logoColor=white)](https://github.com/sponsors/CodesWhat)
379
+ Also listed on [LobeHub](https://lobehub.com/mcp/codeswhat-portkey-admin-mcp) and [Glama](https://glama.ai/mcp/servers/CodesWhat/portkey-admin-mcp):
380
+
381
+ [![LobeHub MCP](https://lobehub.com/badge/mcp/codeswhat-portkey-admin-mcp)](https://lobehub.com/mcp/codeswhat-portkey-admin-mcp)
382
+
383
+ <a href="https://glama.ai/mcp/servers/CodesWhat/portkey-admin-mcp"><img src="https://glama.ai/mcp/servers/CodesWhat/portkey-admin-mcp/badges/card.svg" alt="portkey-admin-mcp MCP server"></a>
340
384
 
341
385
  <a href="#portkey-admin-mcp-server">Back to top</a>
342
386