portkey-admin-mcp 0.1.0-beta.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Scott Benson
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,484 @@
1
+ <div align="center">
2
+
3
+ # Portkey Admin MCP Server
4
+
5
+ [![Typing SVG](https://readme-typing-svg.demolab.com?font=Fira+Code&pause=1000&color=000000&center=true&vCenter=true&width=500&lines=116+tools+for+Portkey+Admin+API;Prompts%2C+Configs%2C+Analytics;Full+MCP+Protocol+1.0+Server)](https://git.io/typing-svg)
6
+
7
+ MCP server for Portkey Admin API. **116 tools** for prompts, configs, analytics & more.
8
+
9
+ </div>
10
+
11
+ <p align="center">
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" alt="npm downloads"></a>
14
+ <a href="https://nodejs.org/"><img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg" alt="Node.js"></a>
15
+ <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-5.9-blue.svg" alt="TypeScript"></a>
16
+ <a href="https://modelcontextprotocol.io/"><img src="https://img.shields.io/badge/MCP-1.0-purple.svg" alt="MCP"></a>
17
+ </p>
18
+
19
+ <p align="center">
20
+ <a href="https://github.com/s-b-e-n-s-o-n/portkey-admin-mcp/stargazers"><img src="https://img.shields.io/github/stars/s-b-e-n-s-o-n/portkey-admin-mcp" alt="GitHub stars"></a>
21
+ <a href="https://github.com/s-b-e-n-s-o-n/portkey-admin-mcp/issues"><img src="https://img.shields.io/github/issues/s-b-e-n-s-o-n/portkey-admin-mcp" alt="GitHub issues"></a>
22
+ <a href="https://github.com/s-b-e-n-s-o-n/portkey-admin-mcp/pulls"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs Welcome"></a>
23
+ <a href="https://github.com/s-b-e-n-s-o-n/portkey-admin-mcp/commits"><img src="https://img.shields.io/github/last-commit/s-b-e-n-s-o-n/portkey-admin-mcp" alt="Last Commit"></a>
24
+ </p>
25
+
26
+ <p align="center">
27
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
28
+ <a href="./ENDPOINTS.md"><img src="https://img.shields.io/badge/docs-ENDPOINTS.md-blue" alt="Docs"></a>
29
+ <a href="https://github.com/sponsors/s-b-e-n-s-o-n"><img src="https://img.shields.io/badge/sponsor-GitHub_Sponsors-ea4aaa?logo=githubsponsors&logoColor=fff" alt="Sponsor"></a>
30
+ </p>
31
+
32
+ ---
33
+
34
+ ## ๐Ÿ“‘ Contents
35
+
36
+ - [๐Ÿš€ Quick Start](#-quick-start)
37
+ - [โœจ Features](#-features)
38
+ - [๐Ÿ”ง Tools](#-tools-116)
39
+ - [๐Ÿ—๏ธ Architecture](#-architecture)
40
+ - [๐Ÿšข Deployment](#-deployment)
41
+ - [โš ๏ธ Limitations](#-limitations)
42
+
43
+ ---
44
+
45
+ ## ๐Ÿš€ Quick Start
46
+
47
+ **1. Clone and install:**
48
+ ```bash
49
+ git clone https://github.com/s-b-e-n-s-o-n/portkey-admin-mcp.git
50
+ cd portkey-admin-mcp
51
+ npm install
52
+ npm run build
53
+ ```
54
+
55
+ **2. Add to Claude config** (`~/.claude/claude_desktop_config.json`):
56
+ ```json
57
+ {
58
+ "mcpServers": {
59
+ "portkey": {
60
+ "command": "node",
61
+ "args": ["/path/to/portkey-admin-mcp/build/index.js"],
62
+ "env": {
63
+ "PORTKEY_API_KEY": "your_api_key"
64
+ }
65
+ }
66
+ }
67
+ }
68
+ ```
69
+
70
+ **3. Restart Claude Desktop.**
71
+
72
+ ---
73
+
74
+ ## โœจ Features
75
+
76
+ <table>
77
+ <tr>
78
+ <td align="center" width="33%">
79
+ <h3>๐Ÿ“ Prompt Management</h3>
80
+ Create, version, render & execute prompts
81
+ </td>
82
+ <td align="center" width="33%">
83
+ <h3>โšก Gateway Configs</h3>
84
+ Loadbalancing, fallbacks, caching
85
+ </td>
86
+ <td align="center" width="33%">
87
+ <h3>๐Ÿ“Š Analytics</h3>
88
+ Cost, latency, errors, feedback
89
+ </td>
90
+ </tr>
91
+ <tr>
92
+ <td align="center">
93
+ <h3>๐Ÿ›ก๏ธ Governance</h3>
94
+ Rate limits, usage limits, guardrails
95
+ </td>
96
+ <td align="center">
97
+ <h3>๐Ÿ” Observability</h3>
98
+ Logs, traces, audit trails
99
+ </td>
100
+ <td align="center">
101
+ <h3>๐Ÿ” Access Control</h3>
102
+ Users, workspaces, API keys
103
+ </td>
104
+ </tr>
105
+ </table>
106
+
107
+ ---
108
+
109
+ ## ๐Ÿ”ง Tools (116)
110
+
111
+ <details>
112
+ <summary><strong>๐Ÿ‘ฅ User & Access</strong> (10 tools)</summary>
113
+
114
+ | Tool | Description |
115
+ |------|-------------|
116
+ | `list_all_users` | List all users in organization |
117
+ | `get_user` | Get user details |
118
+ | `update_user` | Update user |
119
+ | `delete_user` | Remove user |
120
+ | `invite_user` | Invite a new user |
121
+ | `list_user_invites` | List pending invites |
122
+ | `get_user_invite` | Get invite details |
123
+ | `delete_user_invite` | Cancel invite |
124
+ | `resend_user_invite` | Resend invite email |
125
+ | `get_user_stats` | Get user statistics |
126
+
127
+ </details>
128
+
129
+ <details>
130
+ <summary><strong>๐Ÿข Workspaces</strong> (10 tools)</summary>
131
+
132
+ | Tool | Description |
133
+ |------|-------------|
134
+ | `list_workspaces` | List all workspaces |
135
+ | `get_workspace` | Get workspace details |
136
+ | `create_workspace` | Create workspace |
137
+ | `update_workspace` | Update workspace |
138
+ | `delete_workspace` | Delete workspace |
139
+ | `add_workspace_member` | Add member to workspace |
140
+ | `list_workspace_members` | List workspace members |
141
+ | `get_workspace_member` | Get member details |
142
+ | `update_workspace_member` | Update member role |
143
+ | `remove_workspace_member` | Remove member |
144
+
145
+ </details>
146
+
147
+ <details>
148
+ <summary><strong>โš™๏ธ Configs</strong> (6 tools)</summary>
149
+
150
+ | Tool | Description |
151
+ |------|-------------|
152
+ | `list_configs` | List gateway configs |
153
+ | `get_config` | Get config details |
154
+ | `create_config` | Create config |
155
+ | `update_config` | Update config |
156
+ | `delete_config` | Delete config |
157
+ | `list_config_versions` | List config version history |
158
+
159
+ </details>
160
+
161
+ <details>
162
+ <summary><strong>๐Ÿ”‘ API & Virtual Keys</strong> (10 tools)</summary>
163
+
164
+ | Tool | Description |
165
+ |------|-------------|
166
+ | `list_api_keys` | List API keys |
167
+ | `create_api_key` | Create API key |
168
+ | `get_api_key` | Get API key details |
169
+ | `update_api_key` | Update API key |
170
+ | `delete_api_key` | Delete API key |
171
+ | `list_virtual_keys` | List virtual keys |
172
+ | `create_virtual_key` | Create virtual key |
173
+ | `get_virtual_key` | Get virtual key details |
174
+ | `update_virtual_key` | Update virtual key |
175
+ | `delete_virtual_key` | Delete virtual key |
176
+
177
+ </details>
178
+
179
+ <details>
180
+ <summary><strong>๐Ÿ“ Collections</strong> (5 tools)</summary>
181
+
182
+ | Tool | Description |
183
+ |------|-------------|
184
+ | `list_collections` | List prompt collections |
185
+ | `create_collection` | Create a collection |
186
+ | `get_collection` | Get collection details |
187
+ | `update_collection` | Update collection |
188
+ | `delete_collection` | Delete collection |
189
+
190
+ </details>
191
+
192
+ <details>
193
+ <summary><strong>๐Ÿ“ Prompts</strong> (12 tools)</summary>
194
+
195
+ | Tool | Description |
196
+ |------|-------------|
197
+ | `list_prompts` | List prompts |
198
+ | `create_prompt` | Create a prompt template |
199
+ | `get_prompt` | Get prompt details |
200
+ | `update_prompt` | Update a prompt |
201
+ | `delete_prompt` | Delete prompt |
202
+ | `publish_prompt` | Publish prompt version |
203
+ | `list_prompt_versions` | List version history |
204
+ | `render_prompt` | Render prompt with variables |
205
+ | `run_prompt_completion` | Execute prompt completion |
206
+ | `migrate_prompt` | Create-or-update prompt |
207
+ | `promote_prompt` | Promote prompt between environments |
208
+ | `validate_completion_metadata` | Validate billing metadata |
209
+
210
+ </details>
211
+
212
+ <details>
213
+ <summary><strong>๐Ÿงฉ Prompt Partials</strong> (6 tools)</summary>
214
+
215
+ | Tool | Description |
216
+ |------|-------------|
217
+ | `create_prompt_partial` | Create reusable partial |
218
+ | `list_prompt_partials` | List partials |
219
+ | `get_prompt_partial` | Get partial details |
220
+ | `update_prompt_partial` | Update partial |
221
+ | `delete_prompt_partial` | Delete partial |
222
+ | `list_partial_versions` | List partial versions |
223
+ | `publish_partial` | Publish partial version |
224
+
225
+ </details>
226
+
227
+ <details>
228
+ <summary><strong>๐Ÿท๏ธ Prompt Labels</strong> (5 tools)</summary>
229
+
230
+ | Tool | Description |
231
+ |------|-------------|
232
+ | `create_prompt_label` | Create label |
233
+ | `list_prompt_labels` | List labels |
234
+ | `get_prompt_label` | Get label details |
235
+ | `update_prompt_label` | Update label |
236
+ | `delete_prompt_label` | Delete label |
237
+
238
+ </details>
239
+
240
+ <details>
241
+ <summary><strong>๐Ÿ›ก๏ธ Guardrails</strong> (5 tools)</summary>
242
+
243
+ | Tool | Description |
244
+ |------|-------------|
245
+ | `list_guardrails` | List guardrails |
246
+ | `create_guardrail` | Create guardrail |
247
+ | `get_guardrail` | Get guardrail details |
248
+ | `update_guardrail` | Update guardrail |
249
+ | `delete_guardrail` | Delete guardrail |
250
+
251
+ </details>
252
+
253
+ <details>
254
+ <summary><strong>๐Ÿ“ Usage Limits</strong> (5 tools)</summary>
255
+
256
+ | Tool | Description |
257
+ |------|-------------|
258
+ | `list_usage_limits` | List usage limits |
259
+ | `create_usage_limit` | Create usage limit |
260
+ | `get_usage_limit` | Get limit details |
261
+ | `update_usage_limit` | Update limit |
262
+ | `delete_usage_limit` | Delete limit |
263
+
264
+ </details>
265
+
266
+ <details>
267
+ <summary><strong>โฑ๏ธ Rate Limits</strong> (5 tools)</summary>
268
+
269
+ | Tool | Description |
270
+ |------|-------------|
271
+ | `list_rate_limits` | List rate limits |
272
+ | `create_rate_limit` | Create rate limit |
273
+ | `get_rate_limit` | Get rate limit details |
274
+ | `update_rate_limit` | Update rate limit |
275
+ | `delete_rate_limit` | Delete rate limit |
276
+
277
+ </details>
278
+
279
+ <details>
280
+ <summary><strong>๐Ÿ“œ Audit</strong> (1 tool)</summary>
281
+
282
+ | Tool | Description |
283
+ |------|-------------|
284
+ | `list_audit_logs` | List audit log entries |
285
+
286
+ </details>
287
+
288
+ <details>
289
+ <summary><strong>๐Ÿ“Š Analytics</strong> (20 tools)</summary>
290
+
291
+ | Tool | Description |
292
+ |------|-------------|
293
+ | `get_cost_analytics` | Get cost analytics data |
294
+ | `get_analytics_summary` | Get analytics summary |
295
+ | `get_analytics_by_models` | Analytics by model |
296
+ | `get_analytics_by_metadata` | Analytics by metadata |
297
+ | `get_request_analytics` | Request analytics |
298
+ | `get_token_analytics` | Token usage analytics |
299
+ | `get_latency_analytics` | Latency analytics |
300
+ | `get_error_analytics` | Error analytics |
301
+ | `get_error_rate_analytics` | Error rate analytics |
302
+ | `get_status_code_analytics` | Status code distribution |
303
+ | `get_cache_analytics` | Cache analytics |
304
+ | `get_feedback_analytics` | Feedback analytics |
305
+ | `get_user_analytics` | Per-user analytics |
306
+ | `get_cache_hit_latency` | Cache hit latency |
307
+ | `get_cache_hit_rate` | Cache hit rate |
308
+ | `get_feedback_per_model` | Feedback per model |
309
+ | `get_feedback_score_distribution` | Score distribution |
310
+ | `get_requests_per_user` | Requests per user |
311
+ | `get_rescued_requests` | Rescued requests |
312
+ | `get_weighted_feedback` | Weighted feedback |
313
+
314
+ </details>
315
+
316
+ <details>
317
+ <summary><strong>๐Ÿ“‹ Logging</strong> (8 tools)</summary>
318
+
319
+ | Tool | Description |
320
+ |------|-------------|
321
+ | `insert_log` | Insert log entry |
322
+ | `create_log_export` | Create log export |
323
+ | `list_log_exports` | List exports |
324
+ | `get_log_export` | Get export details |
325
+ | `update_log_export` | Update export |
326
+ | `start_log_export` | Start export job |
327
+ | `cancel_log_export` | Cancel export |
328
+ | `download_log_export` | Download export |
329
+
330
+ </details>
331
+
332
+ <details>
333
+ <summary><strong>๐Ÿ” Tracing</strong> (4 tools)</summary>
334
+
335
+ | Tool | Description |
336
+ |------|-------------|
337
+ | `create_feedback` | Create feedback |
338
+ | `update_feedback` | Update feedback |
339
+ | `list_traces` | List traces |
340
+ | `get_trace` | Get trace details |
341
+
342
+ </details>
343
+
344
+ <details>
345
+ <summary><strong>๐Ÿ”Œ Providers</strong> (5 tools)</summary>
346
+
347
+ | Tool | Description |
348
+ |------|-------------|
349
+ | `list_providers` | List providers |
350
+ | `create_provider` | Create provider |
351
+ | `get_provider` | Get provider details |
352
+ | `update_provider` | Update provider |
353
+ | `delete_provider` | Delete provider |
354
+
355
+ </details>
356
+
357
+ <details>
358
+ <summary><strong>๐Ÿ”— Integrations</strong> (10 tools)</summary>
359
+
360
+ | Tool | Description |
361
+ |------|-------------|
362
+ | `list_integrations` | List integrations |
363
+ | `create_integration` | Create integration |
364
+ | `get_integration` | Get integration details |
365
+ | `update_integration` | Update integration |
366
+ | `delete_integration` | Delete integration |
367
+ | `list_integration_models` | List custom models |
368
+ | `update_integration_models` | Update custom models |
369
+ | `delete_integration_model` | Delete custom model |
370
+ | `list_integration_workspaces` | List workspace access |
371
+ | `update_integration_workspaces` | Update workspace access |
372
+
373
+ </details>
374
+
375
+ ---
376
+
377
+ ## ๐Ÿ—๏ธ Architecture
378
+
379
+ ```mermaid
380
+ sequenceDiagram
381
+ participant Client as Client (Claude)
382
+ participant Transport as MCP Transport<br/>(Stdio or HTTP)
383
+ participant Server as MCP Server
384
+ participant Facade as PortkeyService
385
+ participant Domain as Domain Service<br/>(e.g., UsersService)
386
+ participant API as Portkey API
387
+
388
+ Client->>Transport: Tool invocation request
389
+ Transport->>Server: Forward request
390
+ Server->>Server: Parse tool name & params
391
+ Server->>Facade: Call delegated method
392
+ Facade->>Domain: Delegate to domain service
393
+ Domain->>API: HTTP GET /users
394
+ API-->>Domain: JSON response
395
+ Domain-->>Facade: Return typed data
396
+ Facade-->>Server: Return data
397
+ Server-->>Transport: Tool result
398
+ Transport-->>Client: Display result
399
+ ```
400
+
401
+ ---
402
+
403
+ ## ๐Ÿšข Deployment
404
+
405
+ ### Transports
406
+
407
+ | Transport | Use Case | Default |
408
+ |-----------|----------|---------|
409
+ | `stdio` | Local CLI tools (Claude Code, Cursor) | Yes |
410
+ | `Streamable HTTP` | Remote clients, web, production | - |
411
+
412
+ Set via `MCP_TRANSPORT=stdio|http` environment variable.
413
+
414
+ ### HTTP Mode
415
+
416
+ ```bash
417
+ MCP_TRANSPORT=http MCP_PORT=3000 node build/index.js
418
+ ```
419
+
420
+ Exposes a single `/mcp` endpoint with session management via `Mcp-Session-Id` header.
421
+
422
+ ### Docker
423
+
424
+ ```bash
425
+ docker build -t portkey-admin-mcp .
426
+ docker run -e PORTKEY_API_KEY=your_key -p 3000:3000 portkey-admin-mcp
427
+ ```
428
+
429
+ ### Health Endpoints
430
+
431
+ - `GET /health` - Server status
432
+ - `GET /ready` - Portkey API connectivity check
433
+
434
+ ---
435
+
436
+ ## โš ๏ธ Limitations
437
+
438
+ ### Enterprise Features
439
+
440
+ The following require a Portkey Enterprise plan with Admin API keys:
441
+
442
+ - Analytics (cost, request, token, latency, error, cache, feedback)
443
+ - Log exports
444
+ - Audit logs
445
+ - User management (list users, invites)
446
+ - Provider creation
447
+
448
+ ### Known Issues
449
+
450
+ Some endpoints are pending Portkey API clarification:
451
+
452
+ | Tool | Status | Issue |
453
+ |------|--------|-------|
454
+ | `render_prompt` | 500 | Server error - investigating |
455
+ | `create_prompt_label` | 400 | Request format unclear |
456
+ | `create_usage_limit` | 400 | Request format unclear |
457
+ | `create_rate_limit` | 400 | Request format unclear |
458
+ | `list_traces` | 405 | Endpoint path unclear |
459
+
460
+ ---
461
+
462
+ <div align="center">
463
+
464
+ ### Built With
465
+
466
+ [![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=fff)](#)
467
+ [![Node.js](https://img.shields.io/badge/Node.js-339933?logo=nodedotjs&logoColor=fff)](#)
468
+ [![Zod](https://img.shields.io/badge/Zod-3E67B1?logo=zod&logoColor=fff)](#)
469
+
470
+ ### Contributors
471
+
472
+ <a href="https://github.com/s-b-e-n-s-o-n/portkey-admin-mcp/graphs/contributors">
473
+ <img src="https://contrib.rocks/image?repo=s-b-e-n-s-o-n/portkey-admin-mcp" alt="Contributors to portkey-admin-mcp" />
474
+ </a>
475
+
476
+ ---
477
+
478
+ **MIT License** ยท Inspired by [r-huijts/portkey-admin-mcp-server](https://github.com/r-huijts/portkey-admin-mcp-server)
479
+
480
+ <a href="#portkey-admin-mcp-server">โ†‘ Back to top</a>
481
+
482
+ <img src="https://api.visitorbadge.io/api/visitors?path=s-b-e-n-s-o-n%2Fportkey-admin-mcp&label=Visitors&countColor=%23000000" alt="Visitors">
483
+
484
+ </div>