Repository navigation
Description
Summary
Add two unauthenticated MCP tools (request_login and verify_login) that let a user authenticate to Trinity directly from their MCP client — no web UI visit, no pre-created API key required. After a successful inline login, the MCP session is credentialed and the user gains access to a scoped subset of tools (e.g. exposed agents they are authorized for).
Context
Today, using the Trinity MCP server requires a user to: (1) log into the web UI, (2) navigate to Settings → MCP Keys, (3) generate a trinity_mcp_* key, and (4) paste it into their .mcp.json. This is a significant barrier for sharing agents with external users or light collaborators.
The goal is a zero-friction path analogous to Telegram's inline /login flow: the user drops in a default MCP config (no key needed), calls request_login with their email, receives a 6-digit verification code, calls verify_login with the code, and is done. The MCP server issues a session credential and they immediately have access to whatever agents they are authorized for.
⚠️ Design confirmation required with Eugene before implementation. The auth flow, session credential lifecycle, and tool-visibility rules after inline login need explicit sign-off.
Design Questions (to resolve before implementation)
- After inline login, does the MCP server return a
trinity_mcp_*key for the user to persist in their config, or manage the session transiently? - Which tools are visible to an inline-authenticated session vs. a full API-key session? (Proposal: only tools for
mcp_exposedagents the user is authorized for) - How is the inline session credential stored and expired server-side? (Redis with TTL, same as Telegram pending-login pattern?)
- Should inline auth also work for users who do not yet have a Trinity account, or only for users already in the email whitelist?
Acceptance Criteria
- Design confirmed with Eugene
-
request_loginMCP tool: acceptsemail, calls existingPOST /api/auth/email/request, returns confirmation; no auth required to call -
verify_loginMCP tool: acceptsemail+code, calls existingPOST /api/auth/email/verify, returns a session token or minted MCP API key; no auth required to call - Unauthenticated MCP sessions see only
request_loginandverify_login(and optionally public agent info); all other tools require auth - After successful inline login, the session has access to a defined subset of tools (scope TBD in design)
- The default
.mcp.jsonsnippet in docs / UI works without a pre-filled API key - Inline auth flow is audit-logged (same as web email auth)
- Existing API-key auth path is unaffected
Technical Notes
- Existing email auth endpoints:
POST /api/auth/email/requestandPOST /api/auth/email/verifyinrouters/auth.py - Telegram's inline login state machine in
adapters/telegram_adapter.pyis the reference implementation (Redis-backed pending login with TTL) - FastMCP supports unauthenticated tool calls when
authenticatecallback returnsundefined— gate the tool list on session presence - Minted MCP key (if that's the chosen credential model) follows the existing
trinity_mcp_*format inrouters/mcp_keys.py - Related: feat: per-agent MCP exposure flag — dynamic dedicated tool per exposed agent #846 (per-agent MCP exposure flag) — the tool-visibility subset after inline login likely ties directly to
mcp_exposedagents
Activity
vybe commentedon Jun 28, 2026
Design decision (Eugene, 2026-06-28) — gate resolved, promoting to
status-ready.Inline MCP login reuses the existing public-channel auth contract rather than a bespoke flow:
request_login(email)issues the standard 6-digit code via the existing/api/auth/email/requestpath;verify_login(code)mirrors/api/auth/email/verify. No new verification mechanism.resolve_verified_email()→agent_sharingallow-list /access_requests(feat: Unified channel access control — verified-email identity, per-agent allow-list, access requests (web / Telegram / Slack) #311), scoped tomcp_exposedagents (feat: per-agent MCP exposure flag — dynamic dedicated tool per exposed agent #846). First-login role =userper bug(access): Public-channel users auto-promoted tocreatorrole on Trinity login #314 (chat-only grant, no silent promotion).telegram_chat_links.verified_email, and never hand the user atrinity_mcp_*key), the MCP session is credentialed off the verified-email binding transiently — it does not return a persistent API key. (This answers the body's first open design question.)Net: MCP becomes a client-sharing channel that authenticates exactly like the existing public channels. Tool visibility after login = the
mcp_exposedagents the email is authorized for.vybe commentedon Jul 9, 2026
Scope note: the per-agent MCP connector (playbook tools for shared consumers) is now the primary consumer of this inline login flow — tracked in trinity-enterprise#118, which also moves the connector to OSS core. When resolving the design questions above (session credential lifecycle, post-login tool visibility, whitelist-only), answer them connector-first: an email-authenticated session should see only the exposed playbooks of agents shared with that email.
feat(mcp): make per-agent MCP connector OSS-core (trinity-enterprise#…
obasilakis commentedon Jul 20, 2026
/claim
26 remaining items
fix(ratings): bound the turn, not the row — and read machine-ness as …
fix(canvas): state the bound, audit the Workspace writes, gate Manage…
fix(canvas): the Workspace audit names the operator, not the platform…
feat(canvas): delete, pin, search and a stated bound for the canvas p…
feat(canvas): share a canvas at a link, and download it as a PDF (ent…
feat(canvas): the open canvas is shared context for the turn (ent#555) (
feat(mcp): search_executions — grep the execution corpus via the ente…
refactor(mcp): credential tools are advertised only to the keys the b…
refactor(mcp): credential-migration tools are listed only for the key…
refactor(a2a): mark the rc-era A2A columns inert and close §32.7 (ent…
refactor(a2a): every inbound A2A call needs a credential — drop the k…
test(gates): existing gate worlds' approvers can open the agent; shap…
fix(mcp-server): keyed MCP sessions survive a server restart (Ability…