spring-projects / spring-projects/spring-ai
Add Headers (Authorization) to ToolContext to be used by tool call back method
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.9k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 6
Description
Currently in the MCP Server since the tool callback execution happens in a separate worker pool (boundedElastic scheduler) it loses any context including the headers being passed in the /mcp endpoint.
For most scenarios in the tool callback method there might be certain validations / authorizations that may be needed which can be achieved by having access to the original Authorization Bearer token.
What do you think ? @ThomasVitale / @markpollack
If you are ok with this I can work on a PR to include this in the framework. But let me know what you guys think.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the MCP server's /mcp endpoint and trace how the ToolContext reaches the tool callback on the boundedElastic scheduler. Determine how the original Authorization header could remain available to callback validation, then verify that the callback can access it without leaking unrelated request context.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- authentication, backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100