Content
# Daiso MCP Server
Daiso product information MCP (Model Context Protocol) server. It is built with a Cloudflare Workers-based serverless architecture and can be used via HTTP API on mobile.
## Features
### 1. Product Search (search_products)
Search Daiso products.
- **Input Parameters:**
- `query` (required): Product name or keyword to search for
- `category` (optional): Product category
- `maxPrice` (optional): Maximum price
### 2. Find Stores (find_stores)
Find nearby Daiso stores based on location.
- **Input Parameters:**
- `latitude` (required): Latitude
- `longitude` (required): Longitude
- `radius` (optional): Search radius (km), default 5km
- `limit` (optional): Maximum number of stores, default 10
### 3. Check Inventory (check_inventory)
Check product inventory at a specific store.
- **Input Parameters:**
- `storeId` (required): Store ID
- `productId` (required): Product ID
### 4. Price Information (get_price_info)
Retrieve price information for a product.
- **Input Parameters:**
- `productId` (required): Product ID
## Installation
```bash
npm install
```
## Development
Run the local development server:
```bash
npm run dev
```
Once the server starts, you can access it at `http://localhost:8787`.
## API Endpoints
### GET /
Server information and a list of available endpoints
### GET /tools
Retrieve a list of all available tools
**Response Example:**
```json
{
"tools": [
{
"name": "search_products",
"description": "Search Daiso products...",
"inputSchema": { ... }
}
]
}
```
### POST /execute
Execute a tool
**Request Example:**
```json
{
"name": "search_products",
"arguments": {
"query": "수납박스",
"maxPrice": 5000
}
}
```
**Response Example:**
```json
{
"content": [
{
"type": "text",
"text": "{ ... }"
}
]
}
```
## Usage Examples
### Search Products with cURL
```bash
curl -X POST http://localhost:8787/execute \
-H "Content-Type: application/json" \
-d '{
"name": "search_products",
"arguments": {
"query": "수납박스"
}
}'
```
### Find Stores with JavaScript
```javascript
const response = await fetch('https://your-worker.workers.dev/execute', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
name: 'find_stores',
arguments: {
latitude: 37.5665,
longitude: 126.9780,
radius: 5
}
})
});
const result = await response.json();
console.log(result);
```
## Deployment
Deploy to Cloudflare Workers:
```bash
npm run deploy
```
Before deploying, you need a Cloudflare account and the `wrangler` CLI must be logged in:
```bash
npx wrangler login
```
After deployment, you can access it via a URL in the format `https://your-worker.workers.dev`.
## Architecture
- **Framework:** TypeScript
- **Deployment:** Cloudflare Workers (Serverless)
- **Transport:** HTTP REST API
- **CORS:** Allow all domains (recommend restricting in production)
## Project Structure
```
daiso-mcp/
├── src/
│ ├── index.ts # HTTP server main file
│ └── tools/ # Tool implementation
│ ├── searchProducts.ts # Product search
│ ├── findStores.ts # Find stores
│ ├── checkInventory.ts # Check inventory
│ └── getPriceInfo.ts # Price information
├── package.json
├── tsconfig.json
├── wrangler.toml # Cloudflare Workers configuration
└── README.md
```
## Mobile App Integration
Since this server provides an HTTP API, it can be easily integrated with mobile apps (iOS, Android).
### iOS (Swift) Example
```swift
let url = URL(string: "https://your-worker.workers.dev/execute")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
let body: [String: Any] = [
"name": "search_products",
"arguments": ["query": "수납박스"]
]
request.httpBody = try? JSONSerialization.data(withJSONObject: body)
URLSession.shared.dataTask(with: request) { data, response, error in
// 응답 처리
}.resume()
```
### Android (Kotlin) Example
```kotlin
val client = OkHttpClient()
val json = JSONObject()
.put("name", "search_products")
.put("arguments", JSONObject().put("query", "수납박스"))
val request = Request.Builder()
.url("https://your-worker.workers.dev/execute")
.post(json.toString().toRequestBody("application/json".toMediaType()))
.build()
client.newCall(request).enqueue(object : Callback {
override fun onResponse(call: Call, response: Response) {
// 응답 처리
}
})
```
## Precautions
The current implementation uses mock data. In a real production environment, the following tasks are required:
1. **Data Source Integration:**
- Integrate with the official Daiso API (if provided)
- Or implement web scraping
- Or build a database using Cloudflare D1/KV
2. **Data Updates:**
- Regularly update product information
- Real-time inventory synchronization
- Update price information
3. **Security and Performance:**
- Implement API key/authentication (Authorization header)
- Rate limiting (using Cloudflare Workers' Rate Limiting API)
- Caching strategy (using Cloudflare Cache API or KV)
- Strengthen CORS policy (allow only specific domains)
- Strengthen error handling
4. **Production Recommendations:**
- Configuration management via environment variables
- Logging and monitoring (Cloudflare Workers Analytics)
- Strengthen input value validation
- Error tracking (Sentry, etc.)
## License
MIT
Connection Info
You Might Also Like
AP2
AP2 provides code samples and demos for the Agent Payments Protocol.
nuwax
Nuwax AI enables easy building and deployment of private Agentic AI solutions.
daydreams
Daydreams is an AI agent framework in TypeScript for scalable and composable...
ai-infrastructure-agent
AI Infrastructure Agent for intelligent AWS management via natural language.
BifrostMCP
BifrostMCP is a VS Code extension that provides an MCP server for AI tools,...
langchain-mcp
Model Context Protocol tool support for LangChain