esaalat-mcp
Local Model Context Protocol server for Esaalat. It runs on the merchant's own machine (stdio) and calls the public Esaalat API with a personal access token — it holds no business logic and never imports Django.
Run it with:
ESAALAT_API_TOKEN=esa_... uvx esaalat-mcp
uvx fetches the published package (Python 3.10 or newer) on first run and
keeps it in its own cache; there is nothing to install. From a checkout,
uvx --from . esaalat-mcp runs the working copy instead.
Create the token in the dashboard under Connect AI. Setup for Claude
Desktop, Claude Code, Cursor and VS Code — plus every tool it exposes — lives
in ../MCP.md.
Streamable HTTP
The same tools over HTTP, for clients that cannot launch a local process:
uvx --from esaalat-mcp esaalat-mcp-http
It serves /mcp (Streamable HTTP), /healthz and the RFC 9728
protected-resource metadata at /.well-known/oauth-protected-resource. The last
two are public; everything under /mcp requires an OAuth access token. The
production deployment (nginx, systemd, probe) is in
deploy/; the shared API/MCP settings are in
../docs/MCP-ENVIRONMENT.md. A
missing, malformed, unsigned, badly signed, expired or wrongly issued token gets
401 with WWW-Authenticate: Bearer resource_metadata="…"; a valid token
without the required scope gets 403.
The token is also the merchant. Tools call api.esaalat.com with the bearer
token that arrived with the request, so this process needs no
ESAALAT_API_TOKEN and two merchants on one server never share credentials.
It binds 127.0.0.1:8000 unless ESAALAT_MCP_HOST / ESAALAT_MCP_PORT say
otherwise. ESAALAT_MCP_ALLOWED_HOSTS and ESAALAT_MCP_ALLOWED_ORIGINS extend
the Host/Origin allowlist when it runs behind a proxy.
| Variable | Default | Meaning |
|---|---|---|
ESAALAT_MCP_RESOURCE |
http://127.0.0.1:8000 |
Canonical resource identifier, and the origin the metadata is served from (https://mcp.esaalat.com in production) |
ESAALAT_OAUTH_ISSUER |
https://api.esaalat.com |
iss a token must carry; also advertised as the authorization server |
ESAALAT_OAUTH_JWKS_URI |
<issuer>/oauth/jwks.json |
Where signing keys are published |
ESAALAT_OAUTH_AUDIENCE |
the resource identifier | aud a token must carry |
ESAALAT_MCP_REQUIRED_SCOPE |
read |
Scope every request must grant |
ESAALAT_MCP_JWKS_TTL |
300 |
Seconds a fetched key set is reused |
ESAALAT_MCP_JWKS_MIN_REFRESH |
30 |
Back-off after a key id nobody publishes |
ESAALAT_MCP_OAUTH_TIMEOUT |
5 |
JWKS fetch timeout, seconds |
ESAALAT_MCP_MAX_CLIENTS |
32 |
Maximum merchant HTTP clients retained in memory |
ESAALAT_MCP_CLIENT_TTL |
180 |
Seconds an idle merchant HTTP client is reused |
Operating the HTTP transport
- Rate limit. 120 requests per minute per verified
sub, sliding window. SetESAALAT_MCP_RATE_LIMITto change it (0disables it). A refused call is429withRetry-After; it does not consume budget, so retrying cannot extend the wait. The counter is in-process: with multiple replicas, each worker enforces its own budget unless the limit is disabled or moved to a shared store. - Request log. One JSON line per
/mcprequest on theesaalat_mcp.httplogger:request_id,sub, tool name, scope, status and duration. The request body and the token are never logged; at most 64 KiB of the body is buffered to read the tool name. An incomingX-Request-IDis echoed; otherwise one is generated and returned. - Upstream budget.
ESAALAT_TIMEOUTis the per-call budget (default 30s). A timeout reaches the assistant as a504message, and a429from the API stays a429withretry_afterunder_meta["esaalat/upstream"]. - Memory. The per-merchant client cache is bounded to 32 entries for 180
seconds by default, and each client has a 10-connection pool with five
keep-alive connections. The systemd unit also caps the process at 256 MiB;
lower
ESAALAT_MCP_MAX_CLIENTSif the host has less headroom. - Stateless mode. Set
ESAALAT_MCP_STATELESS_HTTP=1when running more than one replica behind a load balancer. The MCP session is then carried by the client's token and each request can land on a different worker; leave it off for a single process, where the default session handling is cheaper. - Audit. OAuth write calls create an
MCPAuditLogrow linked to the grant (personal tokens link to the token). Reads are not audited; re-consent and revocation are enforced on every call by the grant row.
Widgets
The four MCP Apps pages are plain HTML with shared CSS/JS inlined; there is no
runtime bundler and no network dependency except the payment link's QR image.
Edit widgets/src/* and build:
cd widgets && node build.mjs
That writes src/esaalat_mcp/ui_assets/*.html, which the server serves as four
versioned resources:
| Resource | Opened by |
|---|---|
ui://esaalat/payment-link/v1.html |
create_payment_link |
ui://esaalat/payment-tracker/v1.html |
get_payment |
ui://esaalat/unmatched/v1.html |
list_unmatched_payments |
ui://esaalat/device-code/v1.html |
create_device |
Each tool result carries _meta.ui = {resourceUri, csp}. The CSP is empty
except for the payment link, which allows the QR image host.
Where the other half lives
The authorization server is be/ypg/esaalat/apps/mcp_oauth, and the API accepts
the tokens it mints through MCPOAuthTokenAuthentication. That authenticator
re-checks the grant on every request, so disconnecting the app stops the next
call even though the access token itself lives for an hour.
The consent page is backed by the dashboard's JWT consent endpoint, so a
signed-in merchant can approve the app without a second login. The hosted
deployment contract lives in ../docs/MCP-ENVIRONMENT.md; the review-facing
assets, prompts and screenshots are in submission/README.md.
Metadata
Release files for esaalat-mcp 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| esaalat_mcp-0.1.6.tar.gz | 270.6 kB | Without provenance | Details for esaalat_mcp-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| esaalat_mcp-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for esaalat_mcp-0.1.6-py3-none-any.whl |
Total release size: 343.1 kB
Release files / esaalat_mcp-0.1.6.tar.gz
| Download URL | esaalat_mcp-0.1.6.tar.gz |
|---|---|
| Size | 270.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
70fdad9ce9f075b83f5695c424d9939dac5c608119374d863e812844ec5e5eea
|
|
BLAKE2b-256 checksum How to use checksums |
81764c1a43384a54c7eb7e0747d429c67f8158dd8207e1cdeafa9e0b7f8927fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Kali GNU/Linux","version":"2025.2","id":"kali-rolling","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / esaalat_mcp-0.1.6-py3-none-any.whl
| Download URL | esaalat_mcp-0.1.6-py3-none-any.whl |
|---|---|
| Size | 72.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b255b9d6c11e0d549d2bf86b24448684ff8a0912982041e2175062b958de1009
|
|
BLAKE2b-256 checksum How to use checksums |
ce170512b18b4424ca534d6a5ec6297b5f0b08a40a997cbac845c06eb8b786f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Kali GNU/Linux","version":"2025.2","id":"kali-rolling","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for esaalat-mcp 0.1.6
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.