stacklok / stacklok/toolhive

User Token Mapping and Chained Downstream Tokens for MCP / ToolHive

Open
#2,043 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

authentication documentation enhancement proxy
Dominant language
Go
Stars
2.2k
Forks
300
Avg merge
1d 15h
Merged PRs (30d)
184

Description

ToolHive needs to maintain a per-user mapping of tokens across multiple upstream services (e.g., Google, GitHub, AWS). When a user authenticates, ToolHive can chain the consent process: alongside granting access to ToolHive/MCP, the user is also prompted to authorize against one or more external IdPs. ToolHive then keeps both the internal and external tokens, refreshes them as needed, and injects or exchanges the correct downstream token when MCP servers call external APIs.

Tasks:

  • [ ] Provide functionality into Toolhive proxy for users to go into a consent flow that yields both a ToolHive token and one or more external tokens (e.g., Google, GitHub).
  • Provide functionality into Toolhive proxy to store and refresh external tokens securely, linked to the internal user identity. They need to be encrypted, refreshed/rotated when supported, and never logged.
  • Provide functionality into Toolhive proxy to retrieve the right mapped downstream token and provide it to the MCP server when needed.
  • Create an end-to-end demo showing chained login → token mapping → MCP call with downstream token injection.
  • [ ] Create documentation explaining the chained consent model, token storage, and operator security practices.
  • Perform a security review validating protections against token leakage, replay, mis-linked identities, and consent confusion.

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

Start by reviewing the ToolHive proxy's existing authentication and MCP request flow, then map the consent, storage, refresh, and downstream-token requirements. Use the end-to-end demo and security review as completion criteria, with documentation covering the consent model, storage, and operator practices.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
authentication, backend-api-design, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.