kleinanzeigen-mcp

mcp
Security Audit
Warn
Health Warn
  • License — License: MIT
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Low visibility — Only 5 GitHub stars
Code Pass
  • Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Pass
  • Permissions — No dangerous permissions requested

No AI report is available for this listing yet.

SUMMARY

MCP server for searching Kleinanzeigen listings and fetching ad details, photos and seller info, with filters for category, attributes, location, price and seller type.

README.md

kleinanzeigen-mcp

From the same series: geizhals-mcp · willhaben-mcp

An MCP server that lets an AI search Kleinanzeigen
listings and pull ad and seller details. It wraps the Kleinanzeigen Android
app's API (api.kleinanzeigen.de / gateway.kleinanzeigen.de) and returns the
important fields to the AI.

Listings Monthly visitors Commercial users

Highlights · Setup · Add to Claude · Run · Tools · Notes · Tests · Disclaimer · License

Diese Anleitung auf Deutsch

Highlights

  • Visual Listing Analysis
    Downloads and analyzes the actual ad photos, allowing vision-capable AI to inspect an item's condition, wear, damage, completeness, and other visual details instead of relying only on the seller's description. Small by default, sharp enough to read a label when asked.

  • Filters the API doesn't have
    title_only, require and exclude are applied server-side here and page on automatically, so an AI gets the number of real matches it asked for instead of re-searching to work around accessories and wrong variants.

  • From discovery to full inspection
    Find relevant ads, then retrieve complete descriptions, itemised attributes, locations, seller reputation and all photos for a deeper analysis, for one ad or up to ten at once.

Setup

Pick one of three ways. All of them need nothing running in the background:
the client starts the server when it needs it.

Claude Desktop, no terminal. Download kleinanzeigen-mcp.mcpb from the
latest release
and double-click it. Claude Desktop shows an install dialog and sets up the
dependencies itself. Done; skip the rest of this section.

With uv, no clone. One command runs the
current version straight from GitHub:

uvx --from git+https://github.com/Samxel/kleinanzeigen-mcp kleinanzeigen-mcp --stdio

From a clone. Requires Python 3.10+.

git clone https://github.com/Samxel/kleinanzeigen-mcp
cd kleinanzeigen-mcp
pip install -r requirements.txt
python main.py --stdio

uv run main.py --stdio also works without the pip install: main.py
declares its own dependencies.

Add it to Claude (and other MCP clients)

Claude Code

One command, no config file:

claude mcp add kleinanzeigen -- uvx --from git+https://github.com/Samxel/kleinanzeigen-mcp kleinanzeigen-mcp --stdio

From a clone, point it at main.py instead:

claude mcp add kleinanzeigen -- python /path/to/kleinanzeigen-mcp/main.py --stdio

Add --scope user to have it in every project instead of only the current one.
claude mcp list shows whether the connection came up, claude mcp remove kleinanzeigen takes it out again.

Claude Desktop

The .mcpb from Setup is the easiest way. Without it, open
Settings > Developer > Edit Config, add the kleinanzeigen entry to
claude_desktop_config.json and restart Claude Desktop:

{
  "mcpServers": {
    "kleinanzeigen": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/Samxel/kleinanzeigen-mcp", "kleinanzeigen-mcp", "--stdio"]
    }
  }
}

From a clone, use "command": "python" and "args": ["C:\\path\\to\\kleinanzeigen-mcp\\main.py", "--stdio"] (the full path to
main.py, forward slashes on macOS/Linux).

Custom connectors (Settings > Connectors) connect from Anthropic's cloud,
so they cannot reach a server running only on your own machine. To use the
tools in claude.ai and the mobile apps, expose the HTTP server (see Run it
yourself
) through cloudflared, ngrok or a box with a public
hostname, and add that HTTPS URL under Settings > Connectors > Add custom
connector
. Anyone who finds the URL can use the server too, though, so put
authentication in front of it.

Every tool is marked read-only, so clients that honour that hint won't ask
before each call. In Claude Desktop you can also open Settings > Connectors >
kleinanzeigen
and set the tools' dropdown on the right to Always allow.

Cursor, Codex, VS Code and other JSON-config clients

The same entry as for Claude Desktop, in the client's MCP config:

{
  "mcpServers": {
    "kleinanzeigen": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/Samxel/kleinanzeigen-mcp", "kleinanzeigen-mcp", "--stdio"]
    }
  }
}

Clients that connect to a URL instead take "type": "http" and "url": "http://127.0.0.1:8020/mcp", with the server started as below.

Run it yourself

Without --stdio, the server starts over streamable HTTP and prints where it's
listening:

python main.py
Starting kleinanzeigen-mcp server on http://127.0.0.1:8020/mcp

Point your client at that URL, e.g. claude mcp add --transport http kleinanzeigen http://127.0.0.1:8020/mcp. Host, port and path live at the top of
kleinanzeigen/server.py; the port differs from geizhals-mcp (8000) and
willhaben-mcp (8010), so all three can run side by side. Installed with pip or
uv, the kleinanzeigen-mcp command and python -m kleinanzeigen do the same
as python main.py.

Tools

Results come as compact JSON, and fields without a value are left out. Search
hits carry no link of their own: an ad's page is
https://www.kleinanzeigen.de/s-anzeige/{id}, which the server instructions
tell the AI once instead of repeating it in every hit.

search_kleinanzeigen(query, ...): search listings by keyword and/or category

Search by free-text keyword and/or category (id or name; a name matches the
way a model writes it, so "Handys" finds "Handy & Telefon" and "Laptop" finds
"Laptops & Notebooks", and a miss suggests the closest categories). Filters for
category-specific attributes, location/radius or postcode, price range,
offer/wanted, private/commercial, shipping and "Direkt kaufen", plus sorting
and paging (rows up to 30).

Client-side filters, applied here over what Kleinanzeigen returns, paging on
until rows matches turn up or 250 ads were scanned:

  • title_only: every word of query must be in the title
  • require: terms that must appear in title or description ("128gb" matches
    "128 GB" too). This is where specs belong: sellers write the same storage
    size several ways and often leave it out of the title.
  • exclude: drop ads whose title carries these ("kabel" catches "Ladekabel",
    "pro" spares "Prozessor")

Paid "TOP" placements are left out unless include_top_ads=True. They sit
above any sort order and are mostly repair shops and buyers ("Ankauf"), not
the item. Each hit says whether it ships and how many photos it has
(image_count). total, next_offset and has_more say where to continue;
next_offset points at the exact ad a filtered search stopped at, so no match
is skipped between pages.

get_ad_detail(ad_id | ids): get one ad, or up to ten, in full

Everything about one ad: full description, attributes by the label the ad page
shows ("Zustand", "Speicher", ...), category, location, shipping options, the
seller's rating and how many photos it has. Pass up to 10 ids instead of
ad_id to compare several in one call; they come back as {count, ads, failed}, and an ad that is gone lands in failed instead of failing the rest.

get_ad_images(ad_id, max_images=4, detail="low"): look at an ad's photos

Download an ad's photos server-side (at most 10) and return them as real image
content, so a vision-capable client sees the pictures instead of just URLs.
detail="low" (300×400, about 160 tokens per photo) is enough for condition
and completeness; detail="high" (720×960, about 900 tokens) reads small print
such as a label, a serial number or a screen.

get_seller_info(seller_id): see who is selling

Name, private vs commercial, member-since date, ad counts, followers, reply
speed and Kleinanzeigen's reputation score. The profile half is guarded by
IP-range anti-fraud and can fail from VPN or datacenter addresses; partial
then says so and the reputation still comes back.

search_locations(query, limit=10): find a location id

Look up location ids for the location_id filter by name prefix: states,
cities and districts (at most 50 per call; count says how many matched). For
a postcode, pass zip_code to the search instead.

get_category_filters(category, key): list a category's attribute filters

The attribute filters the search's attributes argument takes for one
category, straight from Kleinanzeigen's own search-options schema, with each
filter's values as a value-to-label map ({"bmw": "BMW"}). They narrow far
better than extra words in query: in "PC-Zubehör & Software" they cut a
search down to grafikkarten or mainboards outright. A category with long
value lists (cars list every make) can be narrowed to one filter with key,
by key or label ("autos.marke" or "Marke").

list_categories(query, limit=40): look up category ids

Browse the category tree for the ids the search takes, each with its path (at
most 100 per call). The tree (159 categories) ships with the server in
kleinanzeigen/data/categories.json, so this costs no request. It stops fairly
high up: finer cuts like "Grafikkarten" are attribute filters.

Notes

  • Search quirks worth knowing: total is capped at 10000 by Kleinanzeigen (so
    that value means "at least"), and a missing price_amount means "zu
    verschenken" or "VB", see price_type.
  • kleinanzeigen/server.py holds the MCP tools; main.py only starts it from
    a checkout. Next to it in the kleinanzeigen package: the API access and
    credential (api.py), title matching, the category tree and the result
    summaries.
  • Results go out as compact JSON with empty fields left out, tool schemas leave
    out the titles and null branches pydantic would add, and what all tools
    share is said once in the server instructions instead of in every tool
    description. All of it keeps what the model has to read small.
  • kleinanzeigen/data/categories.json is a flattened snapshot of
    Kleinanzeigen's category tree (title, id, children), built by
    scripts/build_categories.py from the live api/categories.json (which
    ships the tree wrapped in JAXB envelopes and a single "Alle Kategorien"
    pseudo-root). Re-run it if Kleinanzeigen changes their categories.
  • Releases: bump version in pyproject.toml and manifest.json, then push a
    tag such as v1.0.1. The release workflow runs the tests, builds the wheel,
    the sdist and the .mcpb bundle and attaches them to a GitHub release.
  • The badges read coverage.json from the coverage branch.
    scripts/update_coverage.py refreshes it from Kleinanzeigen's public "Über
    uns" page, and a daily GitHub Action commits any change there, so the counts
    don't add a commit to master every day.
  • API details are documented in search_api.md.
  • This uses Kleinanzeigen's internal mobile API, not an official one. Be nice to it.

Tests

pip install -r requirements.txt pytest
pytest

The suite runs offline against a fake Kleinanzeigen and goes through a real
MCP client, stdio transport included. KLEINANZEIGEN_LIVE=1 pytest adds smoke
tests against the live API. CI runs the offline suite on every push and the
live tests once a day, which is what notices Kleinanzeigen changing its app API
or retiring the client credential.

Disclaimer

This is an independent, unofficial project and is not affiliated with, endorsed
by, or connected to Kleinanzeigen or Adevinta. "Kleinanzeigen" and all related
trademarks belong to their respective owners.

It's published for educational and research purposes only. It talks to
Kleinanzeigen's internal API, which is not meant for public use and may break
or change at any time. You are responsible for how you use it: respect
Kleinanzeigen's Terms of Service, robots rules and applicable law, and don't
hammer their servers.

License

MIT LICENSE. Provided "as is", without warranty.

Diese Anleitung auf Deutsch

Reviews (0)

No results found