LIME

Mint a domain JWT and call MCP

Get a passport JWT from LIME for that MCP host, put it in Authorization: Bearer, and call the server — the RS only checks the passport.

  • 15 min
  • Intro

Done when

Protected MCP tools succeed with Bearer only; the RS never sees LIME_AGENT_TOKEN.

  • You hold a hostname-bound access_token (~300s, aud=mcp)
  • Calls use Authorization: Bearer only
  • Agent secret stayed in your private runtime

Run step 1

You need

  • LIME_AGENT_TOKEN in the private agent environment
  • MCP server URL / hostname
  • lime-agents-sdk >= 1.0.0

Steps

  1. Mint the passport JWT for that host

    Pass the MCP URL to LimeAgent.get_mcp_access_token. The SDK mints and caches a short JWT (~300s, aud=mcp) for that hostname.

    import asyncio
    import os
    
    from lime_agents import LimeAgent
    
    # pip install "lime-agents-sdk>=1.0.0"
    TARGET = "https://your-mcp-rs.example/mcp"  # or bare host: your-mcp-rs.example
    
    async def main() -> None:
        async with LimeAgent(agent_token=os.environ["LIME_AGENT_TOKEN"]) as agent:
            # Domain extracted from target; JWT cached per domain (ADR 0081 v11).
            mcp = await agent.get_mcp_access_token(TARGET)
            print(mcp.access_token)
            # Prefer list_tools / call_tool for normal MCP usage:
            # tools = await agent.list_tools(TARGET)
    
    asyncio.run(main())

    Assertaccess_token present; bound to target hostname; TTL ~300s.

  2. Call tools with Bearer only

    Prefer list_tools / call_tool. Send the passport as Bearer — on 401 the SDK refreshes and retries.

    AssertTools succeed with Bearer; 401 triggers SDK refresh + retry.

Protocol

Verify

  • Assert: mint passport → Bearer call to MCP tools succeeds.
  • Negative: LIME_AGENT_TOKEN must never go to the MCP RS as a header.
  • Negative: wrong-host mint fails on the RS verifier.

Wire failures

ScopeStatusCodeWhenWhat to do
LIME API401invalid_clientX-Agent-Token missing or invalid at mintMint only from the private agent environment with a valid agent token
LIME API400invalid_requestdomain / target URL cannot be normalized to a hostnamePass a full MCP URL or bare hostname without a port
SDK verify401mcp_jwt_refreshCached MCP JWT expired (~300s); SDK refreshes on 401Let the SDK refresh, or call get_mcp_access_token again

Related API

Mint a domain JWT and call MCP · LIME