feat: project scoped server option #63
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allows you to scope the MCP server to a specific project via the
--project-ref
CLI flag:This is useful for:
Under the hood
When you configure the server with a specific project ID, all tools that previously accepted a
project_id
parameter will omit that parameter from its tool definition and statically set it to the configured ID. Specifically we create aninjectableTool()
function that allows us to define tools with an optionalinject
property that performs the above logic. This allows us implement this scoping logic without duplicating every single tool definition for each mode.Additionally we omit any account-level tools (like
list_organizations
,list_projects
, etc) when in project scoped mode. This has the added benefit of reducing the number of tools we need for clients like Cursor who limit the total number of tools to 40.