Tiendanube MCP Server

Tiendanube MCP Server

Enables comprehensive management of Tiendanube and Nuvemshop stores, supporting operations for products, orders, customers, and categories. It provides flexible integration through SSE, HTTP, and STDIO transport modes with full Docker support.

Category
访问服务器

README

Tiendanube MCP Server - Docker Setup

A complete Model Context Protocol (MCP) server for Tiendanube/Nuvemshop API with Docker support and SSE transport.

🚀 Features

Resources

  • Products: Full CRUD with advanced filtering (stock, price, categories, SKU)
  • Orders: Complete order management with history tracking
  • Customers: Customer management with addresses and billing
  • Categories: Category hierarchy management
  • Coupons: Discount coupon management
  • Store: Store information and settings

Transport Modes

  • SSE (Server-Sent Events) - For web-based clients
  • Streamable HTTP - Modern HTTP transport
  • STDIO - For CLI/terminal usage

📋 Prerequisites

  • Docker and Docker Compose
  • Tiendanube API credentials:
    • Access Token
    • Store ID

🔧 Setup

1. Clone or Create Project Structure

mkdir tiendanube-mcp
cd tiendanube-mcp

Create the following files:

  • tiendanube_server.py (main server code)
  • Dockerfile
  • docker-compose.yml
  • requirements.txt
  • .env (from .env.example)

2. Configure Environment Variables

Create .env file:

TIENDANUBE_ACCESS_TOKEN=your_access_token_here
TIENDANUBE_STORE_ID=your_store_id_here
TIENDANUBE_BASE_URL=https://api.tiendanube.com/v1

# Server Configuration
MCP_TRANSPORT=sse
MCP_HOST=0.0.0.0
MCP_PORT=8080
LOG_LEVEL=INFO

3. Build and Run

# Build the Docker image
docker-compose build

# Start the server
docker-compose up -d

# View logs
docker-compose logs -f

# Stop the server
docker-compose down

🌐 Accessing the Server

SSE Transport (Default)

URL: http://localhost:8080/sse

Streamable HTTP Transport

Change .env:

MCP_TRANSPORT=streamable-http
URL: http://localhost:8080/mcp

🔍 Health Check

curl http://localhost:8080/health

📊 API Endpoints

Products

  • list_products - List/search products with filters
  • get_product - Get product by ID
  • get_product_by_sku - Get product by SKU
  • create_product - Create new product with variants
  • update_product - Update product information
  • delete_product - Delete product
  • update_product_stock_price - Bulk update stock/prices

Orders

  • list_orders - List orders with filters
  • get_order - Get order details
  • get_order_history_values - Get value change history
  • get_order_history_editions - Get edition changelog
  • create_order - Create new order
  • update_order - Update order
  • close_order - Close order
  • open_order - Reopen order
  • cancel_order - Cancel order

Customers

  • list_customers - List/search customers
  • get_customer - Get customer details
  • create_customer - Create new customer
  • update_customer - Update customer
  • delete_customer - Delete customer

Categories

  • list_categories - List all categories
  • get_category - Get category details
  • create_category - Create category
  • update_category - Update category
  • delete_category - Delete category

Coupons

  • list_coupons - List all coupons
  • get_coupon - Get coupon details
  • create_coupon - Create discount coupon

Store

  • get_store - Get store information

🎯 Usage Examples

Connect from Python Client

import requests
import json

# SSE endpoint
url = "http://localhost:8080/sse"

# List products
payload = {
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
        "name": "list_products",
        "arguments": {
            "query": "shirt",
            "per_page": 10
        }
    },
    "id": 1
}

response = requests.post(url, json=payload)
print(response.json())

Connect from cURL

# List products
curl -X POST http://localhost:8080/sse \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "list_products",
      "arguments": {
        "published": true,
        "per_page": 20
      }
    },
    "id": 1
  }'

Advanced Examples

# Get low stock products
curl -X POST http://localhost:8080/sse \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "list_products",
      "arguments": {
        "max_stock": 10,
        "published": true
      }
    },
    "id": 1
  }'

# Create order
curl -X POST http://localhost:8080/sse \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "create_order",
      "arguments": {
        "products": [{"variant_id": 123456, "quantity": 2}],
        "customer": {
          "name": "John Doe",
          "email": "john@example.com"
        },
        "payment_status": "paid"
      }
    },
    "id": 1
  }'

🐳 Docker Commands

# Build
docker-compose build

# Start
docker-compose up -d

# Logs
docker-compose logs -f tiendanube-mcp

# Restart
docker-compose restart

# Stop
docker-compose down

# Remove everything
docker-compose down -v --rmi all

# Shell access
docker exec -it tiendanube-mcp-server bash

🔐 Security Notes

  1. Never commit .env file - Add to .gitignore
  2. Use environment-specific tokens - Separate dev/prod credentials
  3. Enable HTTPS - Use reverse proxy (nginx/traefik) for production
  4. Rate limiting - Consider adding rate limits for production
  5. CORS configuration - Configure allowed origins if exposing publicly

🔄 Updating

# Pull latest changes
git pull

# Rebuild
docker-compose down
docker-compose build --no-cache
docker-compose up -d

📝 Logging

Logs are configured with rotation:

  • Max size: 10MB per file
  • Max files: 3
  • Location: Docker logs (use docker-compose logs)

View logs:

# All logs
docker-compose logs -f

# Last 100 lines
docker-compose logs --tail=100

# Specific service
docker-compose logs -f tiendanube-mcp

🐛 Troubleshooting

Server won't start

# Check logs
docker-compose logs tiendanube-mcp

# Verify environment variables
docker-compose config

# Test API credentials
curl -H "Authentication: bearer YOUR_TOKEN" \
  https://api.tiendanube.com/v1/YOUR_STORE_ID/store

Connection refused

  • Verify port 8080 is not in use: netstat -tuln | grep 8080
  • Check firewall settings
  • Ensure container is running: docker ps

Permission errors

# Fix permissions
chmod +x start.sh

🌟 Production Deployment

With Nginx Reverse Proxy

server {
    listen 443 ssl http2;
    server_name mcp.yourdomain.com;

    ssl_certificate /path/to/cert.pem;
    ssl_certificate_key /path/to/key.pem;

    location /sse {
        proxy_pass http://localhost:8080/sse;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        
        # SSE specific
        proxy_buffering off;
        proxy_read_timeout 86400;
    }
}

With Docker Swarm

docker stack deploy -c docker-compose.yml tiendanube

Environment Variables for Production

TIENDANUBE_ACCESS_TOKEN=prod_token
TIENDANUBE_STORE_ID=prod_store_id
MCP_TRANSPORT=sse
MCP_HOST=0.0.0.0
MCP_PORT=8080
LOG_LEVEL=WARNING

📚 Resources

📄 License

MIT License - See LICENSE file for details

🤝 Contributing

Contributions are welcome! Please open an issue or submit a pull request.

📧 Support

For issues related to:

  • This MCP Server: Open a GitHub issue
  • Tiendanube API: Contact Tiendanube support
  • MCP Protocol: Check MCP documentation

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选