Management API tokens + /api guard: foundation for a management CLI
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 20/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- openapi, postgresql, typescript
- Lĩnh vực
- api, authentication, authorization, database, security
Hướng nghiên cứu
Start by reading AGENTS.md and the existing MCP auth guards, RolesGuard, rate-limit guard and middleware, plus the /api/mcp-keys controller and Prisma schema. The issue requires agreement on credential shape and scope semantics before implementation, then calls for auth and rate-limit tests, a Prisma migration, minting UI changes, and OpenAPI annotations in the File Search and file-share controllers. Done means those decisions are agreed and the listed tasks are implemented.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Add a management-scoped API credential and a guard that lets it authorize the
/api/* management endpoints, as the foundation for a full management CLI
(configure connectors, MCP servers, roles, users, SSO, code mode, settings,
memory/skills/knowledge-graph from the terminal — and by a connected agent).
This is a discussion-first issue per AGENTS.md (it changes authentication
and the Prisma schema). No code until the approach here is agreed.
Problem (verified in source)
There are two auth realms:
- MCP realm — the MCP API key is authenticated by
McpAuthMiddleware/
McpCombinedAuthGuard, bound only to.forRoutes('mcp'), and resolves to a
user pinned to onemcpServerId+mcpRoleId(a tool allow-list). It exists
to call tools. - Management realm — every
/api/*controller is guarded by
AuthGuard('jwt')(browser session cookie) +@Roles('ADMIN')on sensitive
routes. The MCP key cannot reach it, and cookie+CSRF is unusable from a CLI/CI.
Cloud SSO users have no username/password login at all.
So a CLI cannot manage an instance today with the existing credential.
Proposal
Extend the existing API-key machinery rather than build a parallel system:
- Scope on the credential — add a scope to
McpApiKey
(mcp|management-read|management-admin). The key carries the user's
identity and role; the scope is a downward cap, never an elevation.
Effective power = min(user role, key scope). A non-admin's key still gets the
same@Roles('ADMIN')403s as in the dashboard. - Guard — a guard that accepts a valid session JWT or a management
key on/api/*, composing with the existingRolesGuard. - Rate limiting — apply the existing per-principal rate-limit
(mcp-principal-rate-limit.guard/mcp-rate-limit.middleware) to/api/*
keyed to the management key, plus a per-key daily op cap. Protects against a
looping tool/agent hammering the backend. - Self-service minting —
/api/mcp-keysis already JWT-only and
user-scoped, so any user mints their own key; add the scope selector (offer
only scopes <= the user's role). Agent-issued keys default to read-only.
Deployment behavior
Same feature on Cloud and self-hosted. Self-hosted gets it for free; on Cloud it
is the only non-interactive path for SSO users. No Cloud operator procedures are
part of this change.
Security
Least privilege (read vs admin scope), revocation, per-principal rate limit +
per-key quota, every management mutation already lands in the audit log, and
registration / forgot-password stay off the CLI (launcher-only to the web page,
no API call, no email).
Schema change + migration
New scope column (enum) on McpApiKey; migration included with the
implementation PR. Open to a separate ManagementApiKey table instead if we
prefer to keep MCP and management credentials fully distinct — a design question
for this thread.
Pre-work found
OpenAPI coverage audit: 179 / 207 management routes already carry
@ApiOperation. The gap is almost entirely File Search (file-search 3/23,
file-share 0/8, ~29 routes). Those two controllers need annotation before we
generate a typed CLI client from /api/docs.
Out of scope (follow-ups)
- Browser OAuth
loginfor human ergonomics / SSO (fast-follow; reuses the
OAuth2 server already in the repo). - The CLI command surface itself (225 management commands mapped; one command
per controller route) and public npm distribution. - Declarative
apply/export("instance as code").
Tasks
- Agree credential shape (scope on
McpApiKeyvs separate table) - Define scope semantics (read = GET only; admin = all, role-capped)
- Guard design (JWT-or-management-key) + tests
- Apply per-principal rate limit + per-key quota to
/api/* - Prisma migration
- Mint UI +
/api/mcp-keysscope selector (cap to role; agent default read-only) - Annotate File Search / file-share controllers for OpenAPI
- Ngôn ngữ chính
- TypeScript
- Star
- 856
- Fork
- 82
- Merge trung bình
- 6 giờ 23 phút
- Pull request đã merge (30 ngày)
- 430
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của HelpCode-ai/anythingmcp
-
adapter-request good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
HelpCode-ai/anythingmcp#1405 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
TikTok Shop: server-level public app and App Store installsCó thể đã có người làm @helpcodeai đã nhận hôm nay. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
HelpCode-ai/anythingmcp#1533 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Upload the new social previewCó thể đã có người làm @helpcodeai đã nhận 3 ngày trước. Đang mở
HelpCode-ai/anythingmcp#1455 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
HelpCode-ai/anythingmcp#1418 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Adapter: TGStatCó thể đã có người làm @abinyads-dev đã nhận hôm nay. Đang mởadapter-request good first issue help wanted
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 75/100
HelpCode-ai/anythingmcp#1413 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của HelpCode-ai/anythingmcp
Issue tương tự
-
unwrapDatabaseError masks real DB errors with TypeError: Cannot convert object to primitive valueĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
NEARBuilders/everything-dev#798 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
vercel-labs/durable-harness#53 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Redesign tab bars ignore clicks on Linux: hidden chat layers keep window drag regionsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
experiência: a doc manda subir para o Micro do Supabase, mas não diz que exige plano pago nem quanto custaCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởarea/docs area/ui enhancement
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
melgarafael/DeskcommCRM#4098 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
dependencies platform: ios
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 78/100
software-mansion/react-native-executorch#1617 ·
Maintainer thường phản hồi trong vòng 1 ngày