Skip to content

Support backend-scoped Cedar authorization in VirtualMCPServer #5483

Closed

Description

@astohle

Summary

When using a VirtualMCPServer (vMCP) with multiple discovered MCPServer backends, there is currently no first-class way to authorize access to all tools belonging to a specific backend.

Today, tools are exposed as individual Tool entities and inherit from the vMCP server entity itself:

Tool::<tool-name>
  -> parent MCP::<vmcp-name>

This makes the following policy work:

permit(principal, action, resource)
when {
    resource in MCP::"vmcp-main"
};

However, backend MCPServer resources are not represented as Cedar entities, so policies such as:

permit(principal, action, resource)
when {
    resource in MCP::"backend-a"
};

do not match any tools.

Current workaround

The current workaround is to use prefix matching on the resolved tool name:

permit(principal, action, resource)
when {
    resource.name like "backend-a_*"
};

This works, but it relies on string matching rather than a resource hierarchy.

Requested enhancement

Represent discovered backends as Cedar entities and make tools inherit from their originating backend.

For example:

Tool::"backend-a_get_user"
  -> parent MCP::"backend-a"

Tool::"backend-b_read_file"
  -> parent MCP::"backend-b"

This would allow policies such as:

permit(principal in THVGroup::"mcp.common", action, resource)
when {
    resource in MCP::"backend-a"
};

and

permit(principal in THVGroup::"mcp.dev", action, resource)
when {
    resource in MCP::"backend-b"
};

without enumerating individual tools or relying on naming conventions.

Use case

A common scenario is a single vMCP aggregating multiple backends where access should be granted per backend rather than per tool.

Example:

backend-a = Directory / Identity tools
backend-b = File access tools
backend-c = Infrastructure tools

Administrators may want to grant access to all tools from a backend while keeping a single vMCP endpoint and a clean Cedar authorization model.

Environment

  • ToolHive v0.29.1
  • VirtualMCPServer with dynamically discovered MCPServer backends
  • Cedar authorization enabled

Activity

  1. added
    kubernetes
    on Jun 10, 2026
  2. added
    needs-triage
    enhancement
    go
    vmcp
    and removed
    needs-triage
    on Jun 10, 2026
  3. jhrozek commented on Jun 11, 2026

    @jhrozek
    Contributor

    I think this is a valid RFE. We'd want to extend the schema with a Backend entity type. Tool entities become children of both MCP (the vMCP) and their origin Backend. A policy can then say:

      permit(principal in PlatformRole::"reader",
             action == Action::"call_tool",
             resource in Backend::"github-mcp");
    

    This requires:

    • New Backend entity type in the Cedar schema
    • Compiler emitting Backend entities with Tool membership populated from the vMCP's routing table at compile time
    • The authz ConfigMap being built from vMCP + its backing MCPGroup/MCPServer membership, not just a single target
  4. Sanskarzz commented on Aug 9, 2026

    @Sanskarzz
    Collaborator

    @jhrozek I’m interested in working on this. I’ve reviewed the proposed direction around adding the Backend entity, associating tools with their originating backend, and updating the vMCP authorization configuration.
    Since this is a security-sensitive change that spans the Cedar model and vMCP/operator configuration, would you prefer that I start with an RFC/design proposal, or is the direction described here sufficient to proceed directly with implementation?
    If this issue is available, please assign it to me. Thanks!

  5. jhrozek commented on Aug 10, 2026

    @jhrozek
    Contributor

    Give it a shot I do think this issue needs a bit of design around the cedar mechanics

  6. Sanskarzz commented on Aug 10, 2026

    @Sanskarzz
    Collaborator

    @jhrozek Thanks! I went through the current vMCP/Cedar authorization flow and the THV-0076 implementation before puting the design.
    Today, the vMCP aggregator already records the originating backend in Tool.BackendID. This value is preserved even when a tool is renamed by prefix, priority, or manual conflict resolution.
    The Cedar admission layer also receives the complete vmcp.Tool for both listing and calling tools. However, it currently passes only tool.Name to the authorizer, so the BackendID is lost before the Cedar resource entity is created.

    My proposed entity shape is:

       Tool::<advertised-tool-name>
         -> parent MCP::<vmcp-name>
         -> parent Backend::<tool.BackendID>
    

    This keeps the existing vMCP-wide policies working while allowing backend-scoped policies such as:

      permit (
          principal in PlatformRole::"reader",
          action == Action::"call_tool",
          resource in Backend::"github-mcp"
      );
    

    The BackendID would come only from the aggregated vmcp.Tool, not from the tool name, arguments, or any client-controlled value.
    In the original suggestion, backend membership was generated from the routing table and added to the authz ConfigMap. After checking the current implementation, I think we could build this relationship when the Cedar request entity is created instead:

    • pass the trusted Tool.BackendID through the authorizer API;
    • use it in both FilterTools and AllowToolCall, so list and call decisions stay consistent;
    • keep the existing MCP parent and add the Backend parent when BackendID is non-empty;
    • keep only the MCP parent for composite tools, since they do not have one originating backend.

    Building the parent at runtime would use the same BackendID that routing uses, remain correct with dynamic backend discovery, and avoid maintaining a second backend-membership graph in the ConfigMap. For direct resource in Backend::"..." checks, the Backend parent UID should be sufficient. Materialized Backend entities could still be added later if backends need their own attributes or group hierarchy.

    I would keep the first change scoped to tools. Resources and prompts also carry BackendID, but their direct authorization paths need some additional lookup work to maintain list/operation consistency.

    I also checked the THV-0076 epic (#5419). The pieces this depends on BackendID preservation, the core admission seam, direct VMCP calls, and routing through the new core have already landed. The remaining assembly API and documentation/example work does not appear to block this change.

    Before I start implementing, could you please confirm:

    1. Is building the Backend parent from Tool.BackendID at request time acceptable, or do you still prefer compiling the membership into the authz ConfigMap?
    2. Is a tools-only first PR the right scope?
    3. For the authorizer API, would you prefer a structured authorization request carrying BackendID, or simply adding BackendID as an explicit parameter?

    CC: @tgrunnagle

  7. Sanskarzz commented on Aug 30, 2026

    @Sanskarzz
    Collaborator

    Hi @jhrozek, do you have an update on the confirmations?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

authorizationenhancementgokubernetesvmcp

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions