Skip to main content

lime-mcp-server-sdk

Verify LIME MCP passport JWTs on your resource server — local JWKS, no LIME hop on the hot path.

from lime_mcp_server import TokenVerifier

verifier = TokenVerifier(expected_domain="tools.example.com")

result = verifier.verify(bearer_token)  # Authorization: Bearer <jwt>
if result.is_valid:
    agent_id = result.agent_id  # claims["sub"] — then YOUR ACL

What the SDK handles: JWKS fetch · cache · RS256 · aud=mcp · issuer · domain pin · async verify.

PyPI version Python versions License: MIT CI Documentation MCP compatible

Docs: Read the Docs · lime.pics/docs · Platform


Installation

pip install lime-mcp-server-sdk
# pin the hostname this RS serves:
export LIME_EXPECTED_DOMAIN=tools.example.com

Requirements: Python 3.10+ · PyJWT · cryptography · httpx
Config: expected_domain= or LIME_EXPECTED_DOMAIN. Zero JWKS boilerplate — not zero config.


Quick start (canonical) — verify Bearer

from lime_mcp_server import TokenVerifier

verifier = TokenVerifier(expected_domain="tools.example.com")


def authorize_mcp_request(authorization_header: str | None) -> str | None:
    if not authorization_header:
        return None
    token = authorization_header.removeprefix("Bearer ").strip()
    if not token:
        return None
    result = verifier.verify(token)
    if not result.is_valid:
        return None
    return result.agent_id  # then apply YOUR tool ACL

Copy-paste: examples/verify-middleware/.

Agent side issues the JWT with lime-agents-sdk (list_tools / call_tool). This package only verifies.


Mental model

TokenVerifier
├── verify(token) / verify_async(token)   ← primary
├── warmup()                              ← production startup
└── cache / refresh / invalidate          ← advanced
Artifact Audience Verified here?
MCP JWT (aud=mcp) Your MCP RS Yes
Site passport (aud=lime-site-login) Site backend No — use lime-sites-sdk

Never send X-Agent-Token to the MCP server. Agents send only Authorization: Bearer <passport>.


Production — async + JWKS warmup

from contextlib import asynccontextmanager

from lime_mcp_server import TokenVerifier

verifier = TokenVerifier(expected_domain="tools.example.com")


@asynccontextmanager
async def lifespan(app):
    verifier.warmup(raise_on_failure=True)  # raises on JWKS failure
    yield


async def verify_bearer(authorization: str) -> str | None:
    token = authorization.removeprefix("Bearer ").strip()
    if not token:
        return None
    result = await verifier.verify_async(token)
    if not result.is_valid:
        return None
    return result.agent_id

Example: examples/async-warmup/.


How the flow fits together

Step Who What
1 Agent (lime-agents-sdk) Issues MCP JWT from X-Agent-Token
2 Agent Calls your RS with Authorization: Bearer <jwt>
3 Your server (this SDK) TokenVerifier.verify — RS256 + aud + domain
4 Your server agent_id = sub → your ACL

MCP JWTs are rejected on LIME HTTP APIs. This SDK is for your MCP server only.


API surface (summary)

Method Description
verify(token) Sync RS256 verify → TokenValidationResult
verify_async(token) Non-blocking verify
warmup() Prefetch OAuth metadata + JWKS
.cache / refresh_cache() / invalidate_cache() JWKS cache control

Result: is_valid, agent_id (sub), domain, error, valid_claims.

Env: LIME_EXPECTED_DOMAIN (or kwarg), LIME_BASE_URL (default https://lime.pics), cache/leeway knobs — see RTD.

Full reference: Read the Docs — API.


Package Role
lime-agents-sdk Agent worker: issue MCP JWT + call tools
lime-sites-sdk Site backend: site login / binding passports

Examples

Path Purpose
examples/verify-middleware/ Sync Bearer check
examples/async-warmup/ Warmup + verify_async

Contributing

git clone https://github.com/Mawyxx/lime-mcp-server-sdk.git
cd lime-mcp-server-sdk
pip install -e ".[dev]"
ruff check src tests
mypy src/lime_mcp_server
pytest --cov=lime_mcp_server --cov-fail-under=100

License

MIT — see LICENSE.

Metadata

Release files for lime-mcp-server-sdk 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lime-mcp-server-sdk 1.0.4
File Size Uploaded Provenance Actions
lime_mcp_server_sdk-1.0.4.tar.gz 24.4 kB With provenance Details for lime_mcp_server_sdk-1.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lime-mcp-server-sdk 1.0.4
File Interpreter ABI Platform Actions
lime_mcp_server_sdk-1.0.4-py3-none-any.whl Python 3 none any Details for lime_mcp_server_sdk-1.0.4-py3-none-any.whl

Total release size: 38.9 kB

Release files / lime_mcp_server_sdk-1.0.4.tar.gz

Download URL lime_mcp_server_sdk-1.0.4.tar.gz
Size 24.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4c5d978d4f7958a4f80dba4c13b00c05890f3a3e4bc6652af3cfc1c9184561df
BLAKE2b-256 checksum
How to use checksums
1287a8f3e1cc98d7b41d87a8c64bd399903634e2e687fbd3f738eddae0c6df5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / lime_mcp_server_sdk-1.0.4-py3-none-any.whl

Download URL lime_mcp_server_sdk-1.0.4-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b31ff0f11f022322574a6855351cf812ac9f407301d32c1a5d1bdcfc070e68fd
BLAKE2b-256 checksum
How to use checksums
81106eb8a3534cc979082256167cdad3888ede1dc7c6e2c9e0121ceea9f4c5d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Security for lime-mcp-server-sdk 1.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for lime_mcp_server_sdk-1.0.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page