Skip to content

Descope Agentic Hooks#69

Open
gaokevin1 wants to merge 6 commits intomainfrom
hooks
Open

Descope Agentic Hooks#69
gaokevin1 wants to merge 6 commits intomainfrom
hooks

Conversation

@gaokevin1
Copy link
Member

@gaokevin1 gaokevin1 commented Feb 13, 2026

Related Issues

Fixes <link_to_github_issue>

Related PRs

branch PR
service a PR Link to PR
service b PR Link to PR

Description

Added the following Agentic Hooks:

Pre tool use - exchanging client_credentials for an access token and then using OAuth token exchange for an MCP server access token with specific scopes
This will use Resource Client Grants (today they aren't policies but rather "Resource Client Grants")

Pre tool use - exchanging a user access_token with OAuth token exchange for an MCP server access token with specific scopes
This will use Policies (related to the user)

Pre tool use - exchanging a user access_token with Connections API, for a connections token

Pre tool use - using a user access_token or a login_hint to retrieve an MCP server access token using CIBA

Must

  • Tests
  • Documentation (if applicable)

Copilot AI review requested due to automatic review settings February 13, 2026 17:20
@vercel
Copy link
Contributor

vercel bot commented Feb 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ai Ready Ready Preview, Comment Feb 13, 2026 5:29pm
nextjs-descope-mcp-server Ready Ready Preview, Comment Feb 13, 2026 5:29pm

Request Review

@netlify
Copy link

netlify bot commented Feb 13, 2026

Deploy Preview for express-mcp-server canceled.

Name Link
🔨 Latest commit 3ee68fa
🔍 Latest deploy log https://app.netlify.com/projects/express-mcp-server/deploys/698f5f46efca800008cd0c60

@netlify
Copy link

netlify bot commented Feb 13, 2026

Deploy Preview for mcp-example-oauth canceled.

Name Link
🔨 Latest commit 3ee68fa
🔍 Latest deploy log https://app.netlify.com/projects/mcp-example-oauth/deploys/698f5f46024b2a0008671c6c

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 13, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
brave-search-mcp-server 3ee68fa Feb 13 2026, 05:29 PM

Copy link
Contributor

Copilot AI left a 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 introduces a "Hooks Folder" containing authentication hooks for AI agents (Cursor and Claude Code) to acquire scoped OAuth tokens from Descope before executing MCP tool calls. The implementation provides four authentication strategies (client credentials + token exchange, user token exchange, connections API, and CIBA), along with shell scripts for hook execution, installation scripts, comprehensive documentation, and a TypeScript library.

Changes:

  • Added authentication hook implementations for Cursor and Claude Code platforms
  • Implemented four OAuth authentication strategies with token caching
  • Created installation scripts and comprehensive documentation
  • Added test agent for validation and a TypeScript library for programmatic usage

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
hooks/typescript/tsconfig.json TypeScript compiler configuration for the hooks library
hooks/typescript/src/package.json Package metadata and build configuration for the TypeScript library
hooks/typescript/src/descope-auth-hooks.ts Core TypeScript implementation of all four authentication strategies
hooks/test-agent/test-agent.mjs Test suite for validating hook functionality across platforms
hooks/test-agent/README.md Documentation for the test agent
hooks/install.sh Installation script for Cursor hooks
hooks/install-claude-code.sh Installation script for Claude Code hooks
hooks/docs/strategies.md Detailed documentation of authentication strategies and API endpoints
hooks/docs/security.md Security considerations for token handling and strategy selection
hooks/cursor/hooks.json Cursor hook registration configuration
hooks/cursor/descope-auth.sh Cursor authentication hook implementation with embedded example configs
hooks/claude-code/settings.json Claude Code hook and MCP server configuration
hooks/claude-code/descope-mcp-wrapper.sh MCP server wrapper for token injection in Claude Code
hooks/claude-code/descope-auth.config.example.json Example configuration for Claude Code authentication
hooks/claude-code/descope-auth-cc.sh Claude Code authentication hook implementation
hooks/README.md Main documentation covering all features, platforms, and usage patterns
hooks/.gitignore Git ignore rules for secrets and runtime artifacts
LICENSE Copyright year updated to 2026

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +309 to +312
const token =
(json as any).token ??
(json as any).accessToken ??
(json as any).access_token;
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use type guards or proper type casting instead of repeated 'as any' assertions. Consider defining an interface for the API response or using a single type assertion at the function level.

Copilot uses AI. Check for mistakes.
Comment on lines 385 to 389
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Embedded JSON configuration in a bash script at lines 385-489 will cause syntax errors. These appear to be misplaced file contents that should be in separate files (descope-auth.config.example.json and settings.json).

Copilot uses AI. Check for mistakes.
gaokevin1 and others added 2 commits February 13, 2026 09:27
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments