letgo-mcp
Enables searching, viewing details, and filtering listings on Letgo.com by using Playwright to bypass Akamai anti-bot protection.
README
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
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:
- Set location — Use
letgo_set_locationto set the target city for searches. This must be called before every search. - Search — Use
letgo_search_listingsto search listings. Optionally, useletgo_search_suggestionsto get autocomplete suggestions. - Details — Use
letgo_get_listing_detailsto view the full details of a listing. - Maintenance — If session issues arise, call
letgo_refresh_session. Useletgo_debug_networkto 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.webdriverflag - 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_sessionto 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.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。