Skip to main content

sane-mcp

An MCP server that lets an AI assistant (any MCP client) use a scanner on your network through SANE.

Why this one?

It works for assistants that run elsewhere, such as web or mobile clients, as well as local ones:

  • Results the AI can see. Feeder or flatbed, multi-page PDFs or images. The client gets small watermarked previews to read and check.
  • No lost pages. If nobody says where the pages are, it reads every page in the feeder, or scans the glass when the feeder is empty.
  • Full-quality files without exposing your disk. Scans stay on your machine. When you want the actual file, that one file goes to your private S3-compatible bucket with a short-lived download link.
  • Works with quirky scanners. The scanner, its sources and its modes are detected automatically, with overrides for devices that name them oddly.

Tools

Tool What it does
scan Scan from the feeder or the glass; returns the file name and previews
list_scans, get_scan Saved scans: list, previews, download link
list_scan_sources The scanner's sources and modes, and how the tool's names map to them

Install

Needs Linux with SANE and a supported scanner, and Python 3.11+. Installing builds python-sane, so it also needs a C compiler and the SANE development headers (libsane-dev on Debian/Ubuntu; included with the sane package on Arch).

pipx install sane-mcp          # or: uv tool install sane-mcp
sane-mcp                       # stdio, for local clients
sane-mcp --http                # HTTP on 127.0.0.1:8711/mcp

For a local client that starts servers itself:

{
  "mcpServers": {
    "scanner": {
      "command": "sane-mcp",
      "env": { "MCP_SCAN_DIR": "/home/me/Scans" }
    }
  }
}

To run it permanently over HTTP, see examples/sane-mcp.service and "Connecting remote clients" below.

Settings (environment variables)

Variable Default
MCP_PORT, MCP_PATH 8711, /mcp HTTP listener (always 127.0.0.1)
MCP_PUBLIC_HOST – Public hostname(s) in front of it, comma-separated
MCP_ALLOWED_ORIGINS – Extra browser origins allowed to call it, comma-separated, e.g. https://app.example.com
MCP_SCANNER first scanner found SANE device name, e.g. escl:https://192.0.2.10:443
MCP_SCAN_SOURCES, MCP_SCAN_MODES matched by name JSON maps from the tool's names to the scanner's own, e.g. {"adf": "ADF Front", "flatbed": "Flatbed"}
MCP_SCAN_NOTES – Extra guidance for the client about your scanner's quirks
MCP_SCAN_DIR ~/Documents/Scans Where scans are saved
MCP_SCAN_LINK_MINUTES 5 How long download links work, in minutes (up to 10080, 7 days)
S3_ENDPOINT_URL, S3_REGION, S3_BUCKET, S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY, S3_ADDRESSING_STYLE – , us-east-1, …, auto Storage for download links; see examples/s3.env.example. Scanning works without it

If the automatic matching picks the wrong source or mode, list_scan_sources shows the scanner's own names; scan accepts those too, or set MCP_SCAN_SOURCES / MCP_SCAN_MODES.

Connecting remote clients

Remote (web) clients need a public HTTPS URL. The server has no authentication of its own: put it behind a reverse proxy or tunnel that does (for example an OAuth-capable proxy or a zero-trust tunnel), and set MCP_PUBLIC_HOST to that hostname. If the client calls it from a browser page, add that page's origin to MCP_ALLOWED_ORIGINS. To use download links, the client must be able to reach your bucket's endpoint.

Security

  • Run it as a dedicated user; examples/sane-mcp.service shows a sandboxed systemd unit.
  • Use a storage key limited to the one bucket, and a lifecycle rule that deletes old objects.
  • Download links are only made for a scan the client asks for, and the server never downloads from URLs it's given.

Known issues

  • Linux only.

Licence

MIT, see LICENSE.

Metadata

Release files for sane-mcp 0.1.0

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

Source distribution (sdist)

Source distribution for sane-mcp 0.1.0
File Size Uploaded Provenance Actions
sane_mcp-0.1.0.tar.gz 11.5 kB With provenance Details for sane_mcp-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sane-mcp 0.1.0
File Interpreter ABI Platform Actions
sane_mcp-0.1.0-py3-none-any.whl Python 3 none any Details for sane_mcp-0.1.0-py3-none-any.whl

Total release size: 23.5 kB

Release files / sane_mcp-0.1.0.tar.gz

Download URL sane_mcp-0.1.0.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
27e2881b485280f14967c0551f3fe9c7bc7f3778bbb3d0633fd877b461a17537
BLAKE2b-256 checksum
How to use checksums
0055e583b8563e8abfaae593d589b21fde42588cabf2eed7f1852df5e5230e4e
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 28, 2026.

Transparency log

Release files / sane_mcp-0.1.0-py3-none-any.whl

Download URL sane_mcp-0.1.0-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8103e99dfda08bbe6b4755493fb73cf50bad2666c7109e39a742ea244afed0d4
BLAKE2b-256 checksum
How to use checksums
a277e6ae1d65a6c795047fbac41803dc9ef4d8805105b97c22529a83f24af6f9
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 28, 2026.

Transparency log

Security for sane-mcp 0.1.0

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 sane_mcp-0.1.0.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 28, 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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