loading…
Search for a command to run...
loading…
Enables AI assistants to search for products and manage order history on Tokopedia using the Model Context Protocol. It supports advanced filtering, sorting dis
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.
A Model Context Protocol (MCP) server that provides AI assistants with tools to interact with Tokopedia's product search and order management APIs. This server offers both MCP tool integration and a web interface for easy setup and monitoring.
search_productSearch for products on Tokopedia with comprehensive filtering options.
Parameters:
query (string): The search queryorderBy (optional): Sort order (23=relevance, 3=price low-high, 4=price high-low)condition (optional): Product condition (1=new, 2=used)rating (optional): Minimum rating (1-5, comma-separated for multiple)priceMin (optional): Minimum pricepriceMax (optional): Maximum pricelocation (optional): Location ID (comma-separated for multiple)get_available_product_filters_and_sortsRetrieve available filters and sorting options for a specific search query.
Parameters:
query (string): The search queryget_order_historyGet user's order history from Tokopedia (requires authenticated session).
Parameters:
page (number): Page number for paginationlimit (number): Number of orders per pageCreate a .env file in the project root:
# Required for order history and personalized features
TOKO_SESSION=your_tokopedia_session_cookie_here
# Optional: Custom port (defaults to 3000)
PORT=3000
To get your TOKO_SESSION:
Install dependencies:
bun install
Build the project:
bun run build
Run the server:
bun run serve
# or directly: node build/index.js
Access the web interface: Open http://localhost:3000 in your browser
# Build the Docker image
docker build -t tokopedia-mcp .
# Run with environment variables
docker run -d \
--name tokopedia-mcp \
-p 3000:3000 \
-e TOKO_SESSION="your_session_cookie_here" \
tokopedia-mcp
Create docker-compose.yml:
version: '3.8'
services:
tokopedia-mcp:
build: .
ports:
- '3000:3000'
environment:
- TOKO_SESSION=${TOKO_SESSION}
- PORT=3000
restart: unless-stopped
Run with:
docker-compose up -d
The server can be deployed to any platform that supports Node.js or Docker:
flyctl deploy using DockerFor cloud deployment, make sure to:
TOKO_SESSION environment variablePORT if needed/mcp is accessiblecurl -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "search_product",
"arguments": {
"query": "laptop gaming",
"orderBy": 4,
"priceMin": 5000000,
"priceMax": 15000000
}
}
}'
curl -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "get_available_product_filters_and_sorts",
"arguments": {
"query": "smartphone"
}
}
}'
curl -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "get_order_history",
"arguments": {
"page": 1,
"limit": 10
}
}
}'
Add to your Claude Desktop configuration:
claude mcp add tokopedia http://localhost:3000/mcp
Or manually add to your claude_desktop_config.json:
{
"mcpServers": {
"tokopedia": {
"command": "node",
"args": ["/path/to/tokopedia-mcp/build/index.js"],
"env": {
"TOKO_SESSION": "your_session_cookie_here"
}
}
}
}
{
"tokopedia": {
"url": "http://localhost:3000/mcp",
"type": "http"
}
}
Request:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "search_product",
"arguments": {
"query": "string (required)",
"orderBy": "number (optional: 23|3|4)",
"condition": "number (optional: 1|2)",
"rating": "string (optional: '1,2,3,4,5')",
"priceMin": "number (optional)",
"priceMax": "number (optional)",
"location": "string (optional: comma-separated IDs)"
}
}
}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"content": [
{
"type": "text",
"text": "Products for laptop gaming:\n\nName: ASUS ROG Strix G15\nPrice: Rp 12.999.000\nRating: 4.8\nURL: https://www.tokopedia.com/...\n---\n..."
}
]
}
}
Request:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "get_available_product_filters_and_sorts",
"arguments": {
"query": "string (required)"
}
}
}
Response:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"content": [
{
"type": "text",
"text": "Filters and sorts for smartphone:\n\n{\n \"filter\": [...],\n \"sort\": [...]\n}"
}
]
}
}
Request:
{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "get_order_history",
"arguments": {
"page": "number (required)",
"limit": "number (required)"
}
}
}
Response:
{
"jsonrpc": "2.0",
"id": 3,
"result": {
"content": [
{
"type": "text",
"text": "Order history for page 1:\n\nOrder ID: abc123\nName: Product Name\nPrice: Rp 500.000\nStatus: completed\nURL: https://www.tokopedia.com/...\nPurchased At: 2024-01-15\n---\n..."
}
]
}
}
# Add server via CLI
claude mcp add tokopedia http://localhost:3000/mcp
# Or add with custom configuration
claude mcp add tokopedia http://localhost:3000/mcp --config '{
"env": {
"TOKO_SESSION": "your_session_here"
}
}'
tokopediahttp://localhost:3000/mcpHTTPsrc/
├── index.ts # Main entry point
├── server/
│ ├── app.ts # Express app setup
│ ├── mcp.ts # MCP server and tools
│ └── routes.ts # HTTP routes
├── templates/ # HTML templates for web UI
├── types/ # TypeScript type definitions
└── utils/
├── template-renderer.ts
└── tokopedia-api.ts # Tokopedia API integration
# TypeScript compilation + template copying
bun run build
# Development with watch mode
bun --watch src/index.ts
You can test individual tools using the web interface or cURL commands shown above.
1. "Failed to retrieve search data"
2. "Failed to retrieve order history" / Authentication errors
TOKO_SESSION environment variable is set correctly3. Port already in use
PORT=3001lsof -ti:3000 | xargs kill4. Docker build issues
docker system prune -a5. MCP connection issues
Set environment variable for verbose logging:
DEBUG=1 node build/index.js
git checkout -b feature/amazing-featuregit commit -m 'Add amazing feature'git push origin feature/amazing-featureThis project is licensed under the MIT License - see the LICENSE file for details.
This project is not officially affiliated with Tokopedia. It's an unofficial tool that interacts with Tokopedia's public APIs. Please use responsibly and in accordance with Tokopedia's Terms of Service.
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"tokopedia-mcp-server": {
"command": "npx",
"args": []
}
}
}