Skip to main content
Glama

tokopedia-mcp

Disclaimer: Proyek ini dibuat untuk tujuan edukasi semata. Penulis tidak berafiliasi dengan Tokopedia dan tidak bertanggung jawab atas penyalahgunaan proyek ini. Gunakan dengan bijak.

Server MCP untuk pencarian produk Tokopedia — mencakup pencarian produk, detail produk, dan ulasan pelanggan — yang dapat langsung digunakan dari klien LLM (Claude Desktop, Claude Code, Cursor, dan lainnya).

Dibangun dengan mcp 2.x (MCPServer), curl-cffi (untuk impersonasi sidik jari TLS), dan model pydantic. Seluruh harga dalam Rupiah (IDR).

Tools

Tool

Fungsi

search_products

Mencari produk berdasarkan kata kunci dengan filter opsional (rentang harga, kondisi, tipe toko, rating minimum, produk baru, gratis ongkir, diskon, COD, dan lainnya). Mengembalikan {products, count}.

get_product_details

Mengambil detail lengkap satu produk berdasarkan id atau URL: harga, deskripsi, varian, stok, media, dan toko.

get_product_reviews

Mengambil ulasan pelanggan: pesan, rating, informasi pengguna, dan balasan penjual. Mengembalikan {reviews, count}.

Related MCP server: Tokopedia MCP Server

Instalasi

Membutuhkan Python >= 3.10. Pasang uv terlebih dahulu (di Arch: sudo pacman -S uv, di macOS: brew install uv, atau lewat installer resmi dari astral.sh), lalu:

uv sync            # membuat .venv sekaligus memasang dependensi

Tidak memakai uv? Bisa juga dengan pip biasa:

python -m venv .venv
.venv/bin/pip install -e '.[dev]'

Menjalankan

Menggunakan transport stdio (default — untuk klien MCP):

uv run tokopedia-mcp
# atau: uv run python -m tokopedia_mcp

Untuk transport jaringan:

uv run tokopedia-mcp --transport sse --port 8000
uv run tokopedia-mcp --transport streamable-http --port 8000

Contoh konfigurasi di Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "tokopedia": {
      "command": "/absolute/path/to/tokopedia-mcp/.venv/bin/tokopedia-mcp"
    }
  }
}

Pengujian

uv run pytest                 # pengujian offline memakai fixture terekam, tanpa internet
uv run pytest -m live         # pengujian end-to-end: menjalankan server dan memanggil Tokopedia langsung

Cara kerja

Tokopedia tidak menyediakan API pencarian produk publik, sehingga server ini berkomunikasi langsung dengan GraphQL API internal yang digunakan aplikasi iOS resmi:

  • POST gql.tokopedia.com/graphql/SearchResult/getProductResult — pencarian

  • POST gql.tokopedia.com/graphql/ProductDetails/getPDPLayout — detail produk

  • POST gql.tokopedia.com/graphql/ProductReview/getProductReviewReadingList — ulasan

Lapisan edge (Akamai) menolak permintaan yang tidak menyerupai aplikasi asli. Karena itu setiap permintaan membawa header khusus aplikasi beserta identitas perangkat acak yang segar (user id, Bd-Device-Id, payload fingerprint, timestamp) dan sidik jari TLS Safari melalui impersonasi curl-cffi. Klien juga otomatis melakukan retry pada kegagalan sementara (backoff eksponensial) dan membuang duplikat hasil pencarian antar halaman.

Struktur proyek

src/tokopedia_mcp/
  queries.py     # query GraphQL dan path endpoint
  models.py      # model pydantic: Product, Shop, Review, SearchFilters
  extractors.py  # parsing murni: payload API -> model (dapat diuji offline)
  client.py      # TokopediaClient: HTTP asinkron, retry, paginasi
  server.py      # MCPServer + definisi tools
  __main__.py    # titik masuk CLI (stdio / sse / streamable-http)
tests/
  fixtures/      # respons asli yang terekam, dipakai pengujian offline

Kredit

Query GraphQL beserta format permintaannya diambil dari tokopaedi karya Hilmi Azizi. Terima kasih!

Lisensi

MIT

Available Tools

3 tools
get_product_detailsA

Fetch full details for one Tokopedia product.

Provides price, description, variants, stock, media, and shop info.

Args: product_id: The numeric product id (from search_products). Takes precedence over url. url: A full tokopedia.com product URL, used when product_id is not provided.

ParametersJSON Schema
NameRequiredDescriptionDefault
urlNo
product_idNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.3/5.0
Behavior3/5

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

With no annotations, the description carries the burden of behavioral disclosure. It reveals return field types and the precedence rule, but does not mention authentication, error handling, or side effects. As a fetch operation it implies read-only, but this is not explicit.

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 two concise paragraphs with a clear front-loaded purpose and a focused argument list. Every sentence adds value; no fluff or repetition of schema details.

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?

The description covers purpose, params, and precedence, and the presence of an output schema covers return details. It does not specify behavior when neither parameter is provided, which is a minor gap for a tool with zero required parameters.

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

Parameters5/5

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

The schema has 0% description coverage, so the description fully compensates. It explains that product_id is a numeric id from search_products and takes precedence, and that url is a full tokopedia.com URL used as a fallback. This adds meaningful usage guidance beyond the raw 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?

The description clearly states the tool's action ('Fetch full details for one Tokopedia product') and lists the specific data fields returned (price, description, variants, stock, media, shop info). This distinguishes it from sibling tools like get_product_reviews and search_products, which serve different purposes.

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 provides clear context for when to use the tool, indicating that product_id comes 'from search_products' and that it takes precedence over url. It implies usage after searching for products, though it does not explicitly mention alternatives like get_product_reviews or specify when NOT to use the tool.

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

get_product_reviewsA

Fetch customer reviews for a Tokopedia product.

Returns a dict with a "reviews" list (messages, ratings, user info, seller responses, attached media) and the "count" of reviews returned.

Args: product_id: The numeric product id (from search_products). max_count: Maximum number of reviews (1-100, default 20).

ParametersJSON Schema
NameRequiredDescriptionDefault
max_countNo
product_idYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It transparently explains the return format (a dict with 'reviews' list and 'count') and the effect of max_count (maximum number of reviews, range 1-100, default 20). This adds meaningful context beyond the name and schema, though it does not discuss potential errors, auth, or rate limits, which would elevate it further.

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 optimally concise and well-structured: a one-sentence summary, a clear return value explanation, and a two-line Args section. Every sentence is informative, with no filler or redundant repetition.

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

Completeness5/5

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

For a simple read tool with two parameters and an existing output schema, the description is complete. It covers the return structure, parameter ranges, and source of the key input. The sibling tools are distinct, and nothing critical is missing for an agent to invoke it correctly.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must fully compensate. It does: product_id is explained as 'the numeric product id (from search_products),' and max_count is given a range and default. This adds semantic meaning far beyond the type-only schema, clarifying how and why each parameter is used.

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 'Fetch customer reviews for a Tokopedia product.' This is a specific verb+resource that immediately distinguishes it from siblings like get_product_details and search_products. The scope (reviews, not details or search) is unambiguous.

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?

The description implies usage context by noting that product_id comes 'from search_products', suggesting a typical workflow. However, it does not explicitly state when to prefer this tool over siblings or provide exclusion criteria. The usage guidance is implicit rather than explicit, earning a mid-range score.

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

search_productsA

Search Tokopedia products by keyword.

Returns a dict with a "products" list (name, price in IDR, rating, shop, URL) and the "count" of results returned. Each product can be passed to get_product_details for full information.

Args: keyword: Search keyword, e.g. "logitech mouse" or "asus zenbook". max_result: Maximum number of results (1-100, default 20). pmin: Minimum price in IDR. pmax: Maximum price in IDR. condition: Product condition: 1 = new, 2 = used. shop_tier: Shop tier: 2 = Mall, 3 = Power Shop. rt: Minimum average rating, e.g. 4.5. latest_product: Only products listed within the last 7, 30, or 90 days. bebas_ongkir_extra: Only products with extra free-shipping benefit. is_discount: Only discounted products. is_fulfillment: Only products fulfilled by Tokopedia. is_plus: Only Tokopedia PLUS seller products. cod: Only products eligible for cash on delivery.

ParametersJSON Schema
NameRequiredDescriptionDefault
rtNo
codNo
pmaxNo
pminNo
is_plusNo
keywordYes
conditionNo
shop_tierNo
max_resultNo
is_discountNo
is_fulfillmentNo
latest_productNo
bebas_ongkir_extraNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.6/5.0
Behavior4/5

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

With no annotations, the description carries the full transparency burden and does well by revealing the exact return structure (products list with name, price in IDR, rating, shop, URL, and count) and the filtering behavior of every parameter. It does not disclose sorting order or edge-case error handling, a minor gap given the otherwise thorough context.

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 well-structured: a single-sentence purpose, a brief return summary, and a clearly formatted Args list covering all 13 parameters. Every line provides necessary information without redundant prose, making it highly scannable for an agent.

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

Completeness5/5

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

Given the tool's complexity (13 parameters, no annotations), the description is fully complete: it covers purpose, output format, parameter semantics, and the relationship to get_product_details. The output schema also exists, but the description goes beyond it, ensuring an agent can invoke the tool correctly with no missing context.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must explain all parameters, and it does so comprehensively. Each parameter includes specific meanings, value mappings (e.g., condition 1=new, 2=used; shop_tier 2=Mall, 3=Power Shop), and examples, adding substantial value beyond the bare 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?

The description opens with 'Search Tokopedia products by keyword,' a specific verb+resource statement. It goes beyond a vague purpose by specifying the return format (dict with products list and count), clearly distinguishing it from the sibling tools for product details and reviews.

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?

It provides clear guidance for using search results: 'Each product can be passed to get_product_details for full information.' However, it does not explicitly mention when to prefer this over get_product_reviews or when not to use it, so the guidance is strong but not exhaustive.

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

TDQS

A4.6/5.0
Disambiguation5/5

Each tool targets a distinct concern: search_products finds products, get_product_details retrieves full product information, and get_product_reviews fetches customer feedback. There is no ambiguity or overlap between their purposes.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern in snake_case: search_products, get_product_details, get_product_reviews. The naming is clean and predictable, making it easy for an agent to infer function from the name.

Tool Count5/5

With exactly three tools, the server is well-scoped for its purpose of product discovery and research. Each tool earns its place in the set, and the count falls comfortably within the ideal range.

Completeness5/5

The toolkit covers the full product research lifecycle: search for products, get detailed information, and read reviews. The domain is focused on read-only product data, and there are no obvious dead ends or missing operations for that scope.

Maintenance

ActivityMaintained
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that enables large language models to directly access and analyze Amazon product information, including product details, variants, and reviews.
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to search for products and manage order history on Tokopedia using the Model Context Protocol. It supports advanced filtering, sorting discovery, and authenticated session management via a dual MCP and web interface.
    4
    1
    MIT
  • F
    license
    A
    quality
    B
    maintenance
    An MCP server that exposes marketplace seller operations (Shopee first) as tools Claude can call, enabling automation of product, pricing, inventory, customer service, and other seller tasks.
    32
  • A
    license
    A
    quality
    D
    maintenance
    An MCP server that wraps the Universal Commerce Protocol (UCP) Discovery and Catalog capabilities, letting you search and compare products across UCP merchants directly from Claude.
    4
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Fauzanmhr/tokopedia-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server