-
Notifications
You must be signed in to change notification settings - Fork 164
Use an MCP token for the mcp tools #1692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: mg/OPS-3127-2
Are you sure you want to change the base?
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
Greptile OverviewGreptile SummaryAdded MCP token type to authentication system and integrated token generation into MCP tool initialization. The PR introduces a new Critical issue found:
Changes made:
Confidence Score: 0/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Client as API Client
participant OpenOps as getOpenOpsTools
participant TokenMgr as accessTokenManager
participant JWT as jwtUtils
participant MCP as MCP Server
Client->>OpenOps: getOpenOpsTools(app, userAuthToken)
OpenOps->>TokenMgr: generateMCPToken(userAuthToken)
TokenMgr->>JWT: extractPrincipal(userToken)
JWT-->>TokenMgr: principal (with user info)
TokenMgr->>TokenMgr: spread principal, add token field
TokenMgr->>JWT: sign(payload, key, expiry)
JWT-->>TokenMgr: mcpToken
TokenMgr-->>OpenOps: mcpToken
OpenOps->>MCP: createMCPClient with mcpToken
MCP-->>OpenOps: client with tools
OpenOps-->>Client: MCPTool
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 files reviewed, 1 comment
packages/server/api/src/app/authentication/context/access-token-manager.ts
Outdated
Show resolved
Hide resolved
…n-manager.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for MCP (Model Context Protocol) token authentication by introducing a new principal type and token generation functionality. This change enables the system to issue specialized tokens for MCP clients that are derived from user tokens but carry distinct authorization semantics.
Key Changes:
- Added MCP as a new principal type to the authentication system
- Implemented token generation for MCP clients that inherits user permissions with MCP-specific type designation
- Updated the OpenOps MCP tools integration to use MCP tokens instead of passing user tokens directly
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/shared/src/lib/authentication/model/principal-type.ts | Added MCP enum value to PrincipalType to support MCP token authentication |
| packages/server/api/src/app/authentication/context/access-token-manager.ts | Implemented generateMCPToken method to create MCP-specific tokens from user tokens |
| packages/server/api/src/app/ai/mcp/openops-tools.ts | Updated to generate and use MCP tokens instead of passing user authentication tokens directly to the MCP server |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/server/api/src/app/authentication/context/access-token-manager.ts
Show resolved
Hide resolved
packages/server/api/src/app/authentication/context/access-token-manager.ts
Show resolved
Hide resolved
…n-manager.ts Co-authored-by: Copilot <[email protected]>
|



Part of OPS-3127.