Repository navigation
feat(mcp): an MCP server for each namespace - #401
Merged
Merged
Conversation
A namespace's owner can turn on its own MCP server, /mcp/<namespace>
(Admin > Namespaces > the namespace > Connect apps, PATCH
/namespaces/{name}/integrations, or the set_namespace_integrations tool).
It has the same tools but sees that namespace alone: the person's roles
are narrowed to it, admins count as owners there, and the tools about the
server itself are left out. Tools that take a namespace default to it.
OAuth discovery names the namespace's own resource, the consent page says
the app asks for that namespace alone, and a token issued for it opens
that server and nothing else (not /mcp, other namespaces or the API).
Off by default; docs, threat model and changelog updated.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LB2qrE7CENSd3G5h4FxFra
…-iq6ke4 # Conflicts: # CHANGELOG.md # threat-model.yaml
…-iq6ke4 # Conflicts: # CHANGELOG.md
…-iq6ke4 # Conflicts: # CHANGELOG.md # threat-model.yaml
This was referenced Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Requested by Adeel · project thread
Description
Before: Lens had one MCP server,
/mcp. An agent connected there saw every namespace the person who signed it in could read.After: each namespace can have its own MCP server at
/mcp/<namespace>. Its owner turns it on under Admin → Namespaces → the namespace → Connect apps, where the address is ready to copy. It can also be turned on withPATCH /api/v1/namespaces/<ns>/integrationsor theset_namespace_integrationsMCP tool. An agent connected there has the same tools but sees that namespace alone, whatever else the person can read.How:
deps.withinnarrows the person's roles, permissions and collection roles to the one namespace, with no administration (an admin counts as an owner there). Every tool reads through that narrowedAccess.file_storage,monitoring,install_settingsand the tools that change them) are left out, even for admins./.well-known/oauth-protected-resource/mcp/<ns>). The consent page says the app asks for that namespace alone. A token issued for it (its RFC 8707resource) opens that server and nothing else: not/mcp, not another namespace's server, not the API. A token for Lens or/mcp, or an API token, works on every namespace's server and sees only that namespace there.space.integrations.mcp). While it's off, the server answers 403; people with no role in the namespace get 404.This is PR 1 of 3 for the thread. Next: an OpenAI-compatible
/chat/completionsper namespace, then API keys that open one namespace only.Motivation and Context
Adeel asked for per-namespace scoped MCP servers, so an agent can be given one part of the archive.
Types of changes
!in the title)Checklist:
make hookschecks it on commit).tests/api/test_mcp_namespace.py,__tests__/connect-apps.test.tsx, consent test).docs/accordingly (docs/mcp.md, "One namespace's MCP server").## UnreleasedinCHANGELOG.md.Done questions (AGENTS.md)
namespace_integrations/set_namespace_integrationsMCP tools, plus the API route.space(integrations). Its absence means off, so no upgrade step is needed.make openapiregenerated the client; full backend suite passes locally (1088 passed).🤖 Generated with Claude Code
https://claude.ai/code/session_01LB2qrE7CENSd3G5h4FxFra
Generated by Claude Code