Skip to content

Add support for MCP scopes & tool permissions#1266

Open
jsourcebot wants to merge 11 commits into
v5from
staticmcp
Open

Add support for MCP scopes & tool permissions#1266
jsourcebot wants to merge 11 commits into
v5from
staticmcp

Conversation

@jsourcebot
Copy link
Copy Markdown

  • We now support the ability for an admin the set the scopes of a connector which allows proper support for servers like slack or GitHub.
  • Scopes can be modified by the admin which will invalidate all existing tokens
  • Admin can now configure per tool permissions for a given connector
  • Per connector/user tools are cached on redis with 1h TTL. This means a user engaging in a chat does not have to live refetch all the tools for all the connectors they have access to on every question they ask.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 3, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4c73b555-afab-4273-b159-42ed6937bdcb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch staticmcp

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

@jsourcebot your pull request is missing a changelog!

@@ -0,0 +1,43 @@
/*
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we want to collapse this into the existing migration file?

serverId: string,
tools: { toolName: string; permission: McpServerToolPermission }[],
) => {
const parsed = updateMcpServerToolPermissionsSchema.safeParse({ serverId, tools });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why do we need to parse the inputs here? Presumably since this is a server action, they are already well typed?

async function getCachedListTools(cacheKey: string): Promise<ListToolsResult | undefined> {
try {
const cached = await redis.get(cacheKey);
return cached ? JSON.parse(cached) as ListToolsResult : undefined;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

could there be a case where the ListToolsResult type can change? Do we need to do some schema validation here?

/// Lifetime tool call counters for an MCP server.
model McpServerToolCallCount {
/// OAuth scope configuration for an MCP server.
model McpServerScope {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

rename to McpServerOauthScope

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.

2 participants