portkey-admin-mcp 0.1.0 → 0.3.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.
Files changed (4) hide show
  1. package/README.md +45 -13
  2. package/build/index.js +3862 -2797
  3. package/build/server.js +5943 -4402
  4. package/package.json +20 -16
package/README.md CHANGED
@@ -3,19 +3,21 @@
3
3
  # Portkey Admin MCP Server
4
4
 
5
5
  <picture>
6
- <source media="(prefers-color-scheme: dark)" srcset="https://readme-typing-svg.demolab.com?font=Fira+Code&pause=1000&color=FFFFFF&center=true&vCenter=true&width=500&lines=151+tools+for+Portkey+Admin+API;Prompts%2C+Configs%2C+Analytics;Full+MCP+Protocol+1.0+Server">
7
- <source media="(prefers-color-scheme: light)" srcset="https://readme-typing-svg.demolab.com?font=Fira+Code&pause=1000&color=000000&center=true&vCenter=true&width=500&lines=151+tools+for+Portkey+Admin+API;Prompts%2C+Configs%2C+Analytics;Full+MCP+Protocol+1.0+Server">
8
- <img src="https://readme-typing-svg.demolab.com?font=Fira+Code&pause=1000&color=000000&center=true&vCenter=true&width=500&lines=151+tools+for+Portkey+Admin+API;Prompts%2C+Configs%2C+Analytics;Full+MCP+Protocol+1.0+Server" alt="Typing SVG">
6
+ <source media="(prefers-color-scheme: dark)" srcset="https://readme-typing-svg.demolab.com?font=Fira+Code&pause=1000&color=FFFFFF&center=true&vCenter=true&width=500&lines=150+tools+for+Portkey+Admin+API;Prompts%2C+Configs%2C+Analytics;Full+MCP+Protocol+1.0+Server">
7
+ <source media="(prefers-color-scheme: light)" srcset="https://readme-typing-svg.demolab.com?font=Fira+Code&pause=1000&color=000000&center=true&vCenter=true&width=500&lines=150+tools+for+Portkey+Admin+API;Prompts%2C+Configs%2C+Analytics;Full+MCP+Protocol+1.0+Server">
8
+ <img src="https://readme-typing-svg.demolab.com?font=Fira+Code&pause=1000&color=000000&center=true&vCenter=true&width=500&lines=150+tools+for+Portkey+Admin+API;Prompts%2C+Configs%2C+Analytics;Full+MCP+Protocol+1.0+Server" alt="Typing SVG">
9
9
  </picture>
10
10
 
11
11
  MCP server for the [Portkey](https://portkey.ai/) Admin API. Manage prompts, configs, analytics, API keys, and more from any MCP client.
12
12
 
13
13
  <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>
14
14
  <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>
15
- <a href="https://github.com/SYPartners/portkey-admin-mcp/actions/workflows/ci.yml"><img src="https://github.com/SYPartners/portkey-admin-mcp/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
15
+ <a href="https://github.com/s-b-e-n-s-o-n/portkey-admin-mcp/actions/workflows/ci.yml"><img src="https://github.com/s-b-e-n-s-o-n/portkey-admin-mcp/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
16
16
  <a href="https://nodejs.org/"><img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg" alt="Node.js"></a>
17
17
  <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
18
18
 
19
+ <a href="https://glama.ai/mcp/servers/s-b-e-n-s-o-n/portkey-admin-mcp"><img src="https://glama.ai/mcp/servers/s-b-e-n-s-o-n/portkey-admin-mcp/badges/card.svg" alt="portkey-admin-mcp MCP server"></a>
20
+
19
21
  </div>
20
22
 
21
23
  ---
@@ -54,6 +56,14 @@ Add to your MCP config (`.cursor/mcp.json`, `.windsurf/mcp.json`, or `.vscode/mc
54
56
  PORTKEY_API_KEY=your_key npx -y portkey-admin-mcp
55
57
  ```
56
58
 
59
+ To expose only a focused subset of tools in stdio clients, set `PORTKEY_TOOL_DOMAINS`:
60
+
61
+ ```bash
62
+ PORTKEY_API_KEY=your_key \
63
+ PORTKEY_TOOL_DOMAINS=prompts,analytics \
64
+ npx -y portkey-admin-mcp
65
+ ```
66
+
57
67
  <details>
58
68
  <summary><strong>Build from source</strong></summary>
59
69
 
@@ -102,24 +112,35 @@ Then use this config:
102
112
  | **Rate Limits** | 5 | Request frequency controls |
103
113
  | **Analytics** | 20 | Cost, latency, errors, tokens, cache, feedback |
104
114
  | **Logging** | 8 | Log ingestion and export |
105
- | **Tracing** | 3 | Feedback and trace retrieval |
115
+ | **Tracing** | 2 | Feedback creation and updates on traces |
106
116
  | **Users & Workspaces** | 20 | User management, invites, workspace members |
107
117
  | **Audit** | 1 | Audit log access |
108
118
 
109
- **151 tools total.** See [ENDPOINTS.md](./ENDPOINTS.md) for the full list with descriptions.
119
+ **150 tools total.** See [ENDPOINTS.md](./ENDPOINTS.md) for the full list with descriptions.
110
120
 
111
121
  ---
112
122
 
113
123
  ## API Key Scopes
114
124
 
115
- Different tools require different API key scopes. A workspace-scoped service key with broad permissions works for most operations. Some features need additional access:
125
+ 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.
126
+
127
+ ### Enterprise-gated tools (28)
128
+
129
+ 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.
130
+
131
+ | Area | Tools | Required scope |
132
+ |---|---|---|
133
+ | 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` |
134
+ | Audit | `list_audit_logs` | `audit_logs.list` |
135
+ | Org-level integrations | `get_integration`, `list_integration_models`, `list_integration_workspaces` | `organisation_integrations.read` |
136
+ | Org-level users | `list_all_users`, `get_user`, `get_user_stats`, `list_user_invites` | `organisation_users.list` / `organisation_users.read` |
137
+
138
+ ### Other scope requirements
116
139
 
117
140
  | Feature | Required |
118
141
  |---------|----------|
119
- | Analytics, log exports, audit logs | Enterprise plan + `analytics.view` scope |
120
- | User management, invites | Organization-level API key |
121
- | Integration models/workspaces | Organization-level API key |
122
- | Prompt completions | `completions.write` scope + billing metadata |
142
+ | Prompt completions (`run_prompt_completion`) | `completions.write` scope + billing metadata (`app`, `env`) |
143
+ | Org-level service API key creation via `create_api_key` | `organisation_service_api_keys.create` (Enterprise) |
123
144
 
124
145
  If a tool returns a `403` with Portkey error `AB03`, it means missing scopes — not a broken endpoint.
125
146
 
@@ -133,8 +154,9 @@ The server supports Streamable HTTP for remote access:
133
154
 
134
155
  ```bash
135
156
  PORTKEY_API_KEY=your_key \
136
- MCP_HOST=0.0.0.0 \
157
+ MCP_HOST=127.0.0.1 \
137
158
  MCP_PORT=3000 \
159
+ MCP_PUBLIC_BASE_URL=https://mcp.example.com \
138
160
  MCP_AUTH_MODE=bearer \
139
161
  MCP_AUTH_TOKEN=your_secret \
140
162
  node build/server.js
@@ -146,22 +168,29 @@ PORTKEY_API_KEY=your_key MCP_AUTH_MODE=bearer MCP_AUTH_TOKEN=your_secret \
146
168
  npx -y -p portkey-admin-mcp portkey-admin-mcp-http
147
169
  ```
148
170
 
171
+ 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.
172
+
149
173
  ### Configuration
150
174
 
151
175
  | Variable | Default | Description |
152
176
  |----------|---------|-------------|
153
177
  | `PORTKEY_API_KEY` | (required) | Your Portkey API key |
178
+ | `PORTKEY_TOOL_DOMAINS` | — | Optional comma-separated stdio/HTTP default tool subset, e.g. `prompts,analytics` |
154
179
  | `MCP_HOST` | `127.0.0.1` | Bind address |
155
180
  | `MCP_PORT` | `3000` | Port |
156
- | `MCP_AUTH_MODE` | `none` | `none`, `bearer`, or `clerk` |
181
+ | `MCP_PUBLIC_BASE_URL` | | Public absolute base URL to advertise from `/auth/info` and the status page; recommended for hosted deployments |
182
+ | `MCP_AUTH_MODE` | `none` | `none`, `bearer`, or `clerk` (`none` is blocked for HTTP unless explicitly overridden) |
157
183
  | `MCP_AUTH_TOKEN` | — | Secret for bearer auth |
184
+ | `MCP_ALLOW_UNAUTHENTICATED_HTTP` | — | Set to `true` only for intentional local unauthenticated HTTP debugging |
158
185
  | `MCP_SESSION_MODE` | `stateful` | `stateful` or `stateless` |
186
+ | `MCP_MAX_SESSIONS` | `100` | Maximum concurrent stateful MCP sessions before new initialize requests are rejected |
159
187
  | `MCP_EVENT_STORE` | `off` | `off`, `memory`, or `redis` |
160
188
  | `MCP_REDIS_URL` | — | Redis URL for shared event store |
161
189
  | `MCP_TLS_KEY_PATH` | — | TLS key for native HTTPS |
162
190
  | `MCP_TLS_CERT_PATH` | — | TLS cert for native HTTPS |
163
191
  | `ALLOWED_ORIGINS` | — | CORS allow-list |
164
192
  | `MCP_TRUST_PROXY` | `false` | Trust proxy headers (for reverse proxies) |
193
+ | `RATE_LIMIT_MAX_BUCKETS` | `10000` | Maximum distinct in-memory rate-limit buckets before new clients share an overflow bucket |
165
194
 
166
195
  <details>
167
196
  <summary><strong>Vercel deployment</strong></summary>
@@ -172,6 +201,7 @@ Key points:
172
201
  - Uses stateless mode with Redis event store
173
202
  - Requires Clerk or bearer auth
174
203
  - Leave `MCP_TLS_*` unset (Vercel terminates HTTPS)
204
+ - Set `MCP_PUBLIC_BASE_URL` to your deployment URL so advertised MCP endpoints never depend on request headers
175
205
  - Vercel does not support WebSockets — Streamable HTTP/SSE only
176
206
 
177
207
  </details>
@@ -214,6 +244,8 @@ npm run test:http # HTTP endpoint smoke test
214
244
  npm run ci # full pipeline (lint + typecheck + test + build + e2e + verify)
215
245
  ```
216
246
 
247
+ `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`.
248
+
217
249
  ---
218
250
 
219
251
  <div align="center">