spring-projects / spring-projects/spring-ai

‌Metadata injection in tool calls

Open
#2,590 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

mcp
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 10h
Merged PRs (30d)
5

Description

Here's the translation of your technical proposal for Spring optimization:

When MCP invokes tools, can we add a metadata injection mechanism? The workflow would be:

User login → Authentication service returns tenantId → Store in MCP context
Tools automatically carry tenantId during invocation
Data queries perform tenant permission filtering using tenantId to prevent unauthorized access
MCP should enforce these verifications before tool execution:

Client requests must carry tenantId metadata (Item 6)
Server must validate the ownership relationship between user session and tenantId (Item 1)
Tools can only access resources within the tenantId's authorized scope
This proposal clearly outlines a multi-tenant security pattern using tenant isolation. You might want to reference Spring Security's existing tenant isolation capabilities and Spring Cloud Context's property propagation mechanisms when submitting this to Spring. Would you like me to help format this as an official Spring Enhancement Proposal (SEP) template?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the MCP tool invocation path and the existing authentication or context handling first. Compare the proposal with Spring Security tenant isolation and Spring Cloud Context property propagation, then verify that tenant metadata is validated against the user session and restricted to authorized resources before tool execution.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
authentication, authorization, backend, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.