Skip to main content
Glama

letgo-mcp

A Model Context Protocol (MCP) server for searching listings, viewing listing details, and applying filters on Letgo.com. It uses Playwright browser automation to bypass Letgo's Akamai anti-bot protection and accesses data in a way that closely mimics real user behavior.

Features

  • City and district-level location setting

  • Autocomplete search suggestions

  • Listing search (with price range, sorting, category, and pagination support)

  • Individual listing details (description, seller info, images)

  • Infinite scroll — automatically clicks "Load More" to collect all results

  • Session refresh against Akamai anti-bot protection

  • Network request debugging via interception

  • No API keys required

Related MCP server: OLX MCP Server

Requirements

  • Node.js v22 or higher

  • npm (ships with Node.js)

  • Playwright browser engine (downloaded automatically during setup)

Installation

# Clone the repository
git clone <repo-url>
cd letgo-mcp

# Install dependencies
npm install

# Download the Playwright browser
npx playwright install chromium

# Build the project
npm run build

After building, executable JavaScript files will be available under the dist/ directory.

MCP Configuration

letgo-mcp runs as a stdio MCP server. Add it to any MCP-compatible client (Claude Desktop, OpenCode, etc.) as follows:

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "letgo-mcp": {
      "command": "node",
      "args": ["/path/to/letgo-mcp/dist/index.js"]
    }
  }
}

OpenCode

Add to .opencode.json:

{
  "mcpServers": {
    "letgo-mcp": {
      "command": "node",
      "args": ["/path/to/letgo-mcp/dist/index.js"]
    }
  }
}

Replace the path with the full path to your project.

Usage

The tools must be called in the correct order. Follow this flow:

  1. Set location — Use letgo_set_location to set the target city for searches. This must be called before every search.

  2. Search — Use letgo_search_listings to search listings. Optionally, use letgo_search_suggestions to get autocomplete suggestions.

  3. Details — Use letgo_get_listing_details to view the full details of a listing.

  4. Maintenance — If session issues arise, call letgo_refresh_session. Use letgo_debug_network to inspect network requests.

Running from the Command Line

# Build
npm run build

# Run (as stdio MCP server)
npm start

# Development mode (build + run)
npm run dev

Tools Reference

Tool

Description

Parameters

letgo_set_location

Sets the search location. Must be called before any search.

city (string, required) — City name, district (string, optional) — District name

letgo_search_suggestions

Returns autocomplete suggestions for a given query.

query (string, required) — Search text

letgo_search_listings

Searches listings on Letgo. Supports filtering, sorting, and pagination.

query (string, required), page (number, default: 1), minPrice (number), maxPrice (number), sortBy (enum: price_asc, price_desc, date_desc, date_asc, distance), categoryId (string)

letgo_get_listing_details

Returns full details of a listing including title, description, seller info, images, and attributes.

listing_id (string, required) — Listing ID

letgo_refresh_session

Refreshes Akamai anti-bot cookies. Use when search results return empty or errors occur.

No parameters

letgo_debug_network

Navigates to a search page and captures all API/network calls made by the page. Useful for discovering which endpoints are used.

query (string, default: "iphone")

Architecture

The project consists of two main components:

Session Management (session.ts): Spawns a Chromium browser instance via Playwright. The browser runs in headless: false (visible) mode. Several measures are taken to bypass Letgo's Akamai bot detection:

  • Realistic user agent and viewport configuration

  • Hiding the navigator.webdriver flag

  • Turkish language and Istanbul timezone settings

  • API calls are made using page.evaluate(fetch) so the browser's existing cookies and session data are used

  • If the browser crashes or an error occurs, it is automatically restarted

API Client (api-client.ts): Accesses Letgo's internal API endpoints (/api/suggestions) and listing pages through the DOM. Search results are collected via DOM scraping: the "Load More" button is automatically clicked to simulate infinite scroll, then listing cards are extracted using the a[href*="/item/"] selector.

Tool Handler (index.ts): Defines 6 tools via the MCP SDK. Routes incoming requests to functions in api-client.ts and session.ts. Input and output schemas are defined according to MCP standards.

Data Flow

MCP Client -> stdio -> index.ts (handler) -> 
  api-client.ts -> session.ts (Playwright) -> Letgo.com

All HTTP requests are made from within the browser context, ensuring Letgo's session and cookie mechanisms work seamlessly.

Important Notes

  • No API key required. It works through Letgo's own web interface — no official API is used.

  • Browser runs visible (headless: false). Letgo's Akamai anti-bot may block headless browsers, so the browser window stays open.

  • Location is required. No search can be performed without calling letgo_set_location. City names must be entered with Turkish characters (e.g., "İzmir", "İstanbul", "Ankara").

  • Session durations are limited. Letgo's Akamai cookies remain valid for a limited time. Use letgo_refresh_session to renew the session.

  • Rate limiting. Sending too many requests in quick succession may cause Letgo to temporarily restrict access. Session refresh usually resolves this.

  • DOM scraping. Search results are extracted from Letgo's HTML DOM. If Letgo changes their UI, the scraping selectors may need to be updated.

  • Turkey only. Designed for the Letgo Turkey platform. Location data covers Turkish cities.

Available Tools

6 tools
letgo_debug_networkB

Navigate to a search URL and capture all API/network calls made by the page. Useful for discovering which API endpoints Letgo uses.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryNoSearch query to test (e.g. 'iphone')iphone

TDQS

B3.4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Lacks details on how network calls are captured (e.g., browser automation), whether it is synchronous, side effects, or output format. No annotations to supplement.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded, no fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema or annotations; fails to describe return value, duration, or how to use results. Incomplete for a debug tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline. Description adds context (e.g., 'test', example) but does not provide new semantics beyond schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states it navigates to a search URL and captures network calls to discover API endpoints. Distinguishes from siblings like letgo_search_listings which directly searches.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Implies usage for discovering endpoints, but does not explicitly state when to use vs. siblings or provide exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

letgo_get_listing_detailsA

Get full details of a specific listing including description, seller info, all images, and attributes.

ParametersJSON Schema
NameRequiredDescriptionDefault
listing_idYesThe listing ID from search results

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the tool returns 'full details' but does not disclose whether it is read-only, idempotent, or any auth/rate-limit requirements. While 'Get' implies a read operation, additional behavioral context could improve transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence that front-loads the core action and resource. No unnecessary words or repetitions, earning its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (one required parameter, no output schema), the description adequately covers purpose and output content. It is complete enough for an agent to understand the tool's function, though including that it returns a full listing object could enhance completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, and the description only reiterates that listing_id comes from search results. It adds no additional meaning beyond the schema's parameter description, so the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the verb 'Get' and the resource 'full details of a specific listing', and lists the included components (description, seller info, images, attributes). This effectively distinguishes it from sibling tools like letgo_search_listings, which returns summaries.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implicitly indicates when to use: after obtaining a listing_id from search results. It provides clear context but lacks explicit exclusions or alternatives. However, the sibling tool names help an agent infer when to use this tool versus others.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

letgo_refresh_sessionA

Refresh the anti-bot session cookies. Call this if searches start returning errors or empty results.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so the description carries full burden. It discloses the main action (refresh cookies) but lacks details on side effects, rate limits, or outcomes. Adequate but not thorough.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, no wasted words. All information is essential and front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with no parameters or output schema, the description covers purpose and usage adequately. Could elaborate on expected errors or calling frequency, but sufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters exist, so schema coverage is 100%. The description adds nothing beyond schema, but baseline for 0 params is 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it refreshes anti-bot session cookies, with a specific verb and resource. It distinguishes itself from sibling tools like search and listing tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states when to call this tool ('if searches start returning errors or empty results'). No exclusions or alternatives mentioned, but the context is clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

letgo_search_listingsB

Search listings on Letgo with filters for price, sorting, and pagination. Returns listing cards with ID, title, price, location, and thumbnail.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesSearch text to find listings
pageNoPage number (default: 1)
minPriceNoMinimum price filter (TRY)
maxPriceNoMaximum price filter (TRY)
sortByNoSort order for results
categoryIdNoCategory ID filter

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It only mentions return fields but does not disclose pagination behavior (e.g., page size, total results), rate limits, authentication needs, or error cases.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences with no waste. The purpose and key features are front-loaded, making it easy to scan.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Lists return fields but lacks details on pagination behavior (e.g., page size, total count) and error handling. With 6 parameters and no output schema, more completeness would be beneficial.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so each parameter is described in the schema. The description adds a summary of filter types but does not add significant new meaning beyond the schema. Baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states the verb 'Search' and resource 'listings on Letgo' with specific filters and return fields. Distinguishes itself from siblings like letgo_get_listing_details and letgo_search_suggestions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives. Does not mention when not to use it or provide any context about prerequisites or fallbacks.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

letgo_search_suggestionsB

Get autocomplete search suggestions from Letgo for a given query.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query text (e.g. 'ddr4 desktop ram')

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description should disclose behavioral traits but only states the basic function; no information on result format, limits, or side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with no extraneous information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has no output schema and simple parameters, but the description does not specify what the suggestions look like or any constraints, leaving gaps for the agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3; description adds 'for a given query' but schema already describes the parameter as search query text, no added value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool gets autocomplete search suggestions from Letgo for a query, distinguishing it from sibling tools like letgo_search_listings and letgo_get_listing_details.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus its siblings, such as when to use autocomplete vs full search.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

letgo_set_locationA

Set the search location for Letgo. Must be called before any search. Provide a Turkish city name (e.g. 'İzmir', 'İstanbul', 'Ankara').

ParametersJSON Schema
NameRequiredDescriptionDefault
cityYesCity name in Turkish (e.g. 'İzmir', 'İstanbul', 'Ankara')
districtNoOptional district name for more precise searches

TDQS

A4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations present; description only states the setting action without detailing side effects, persistence, or authentication requirements.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, direct and efficient, with the most critical information (purpose and prerequisite) provided first.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Adequate for a simple setter without output schema; could mention location persistence for subsequent queries but is functional as is.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Adds value beyond 100% schema coverage by providing example city values and noting the district parameter as optional.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action (set search location) and target (Letgo), with explicit prerequisite role for subsequent searches.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly mandates calling before any search and provides Turkish city examples, but does not discuss when not to use or alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 6 tool updatesv1.0.0
    • First observedletgo_debug_network
    • First observedletgo_get_listing_details
    • First observedletgo_refresh_session
    • First observedletgo_search_listings
    • First observedletgo_search_suggestions
    • First observedletgo_set_location

TDQS

A3.9/5.0

Scored across 6 tools

Disambiguation5/5

Each tool targets a distinct function: network debugging, listing details, session management, search, suggestions, and location setting. No overlap in purpose, making it clear which tool to use for each task.

Naming Consistency5/5

All tools follow a consistent 'letgo_verb_noun' pattern in snake_case, e.g., 'letgo_search_listings', 'letgo_set_location'. This uniformity makes the tool set predictable and easy to navigate.

Tool Count5/5

With 6 tools, the server is well-scoped for a classifieds search and details service. Each tool serves a necessary role without redundancy, and the count feels appropriate for the domain.

Completeness4/5

The tool set covers the core workflow: setting location, searching, getting suggestions, and viewing details. Missing listing management (create/update/delete) or user operations, but for a read-heavy use case (scraping/searching) it is largely complete.

Maintenance

ActivityStale
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers