Production-ready Model Context Protocol (MCP) server for automating Gmail-to-Arcadia inbound order processing.
This MCP server provides automated tools for:
- Extracting inbound order data from Gmail emails
- Creating orders in Arcadia warehouse management system
- Automating the complete Gmail β Arcadia pipeline
Built with FastAPI, NovaAct browser automation, and MCP protocol support.
See RENDER_DEPLOYMENT.md for complete deployment guide.
Quick Deploy:
- Push this repo to GitHub
- Create new Web Service on Render
- Set environment variables:
NOVA_ACT_API_KEYMCP_SECRET
- Deploy!
# Clone repository
git clone <your-repo-url>
cd inbound_mcp
# Install dependencies
pip install -r requirements.txt
# Set environment variables
export NOVA_ACT_API_KEY="your_key_here"
export MCP_SECRET="your_secret_here"
# Install Playwright browsers
playwright install chromium
# Run server
uvicorn mcp.server:app --host 0.0.0.0 --port 8080Environment Variables:
NOVA_ACT_API_KEY- Browser automation API key (required)MCP_SECRET- API authentication secret (required for production)
System Requirements:
- Python 3.11+
- Chromium browser (auto-installed via Playwright)
- 1GB+ RAM recommended
Create a single inbound order in Arcadia with all details.
Parameters:
{
"master_bill_number": "123456789",
"product_code": "PP48F",
"quantity": 24,
"temperature": "FREEZER",
"delivery_date": "12/24/2025",
"delivery_company": "CHR",
"comments": "Additional notes"
}Extract order data from Gmail "Inbound ATL" emails.
Returns: Parsed orders with master bills, products, quantities, and temperatures.
Submit previously extracted orders to Arcadia system.
Parameters:
{
"order_data": {
"email_subject": "Inbound ATL 12/24",
"orders": [...]
}
}Execute complete automation: Gmail extraction β Arcadia submission.
No parameters required - runs end-to-end automation.
All API requests (except /health) require the x-mcp-key header:
curl -X POST https://your-server.com/mcp \
-H "Content-Type: application/json" \
-H "x-mcp-key: your_mcp_secret" \
-d '{"jsonrpc": "2.0", ...}'Without authentication:
{
"error": "Unauthorized",
"message": "Invalid or missing x-mcp-key header"
}Health check endpoint (no auth required)
curl https://your-server.com/health
# Response: {"status": "ok", "service": "inbound_mcp"}List available MCP tools
curl https://your-server.com/tools
# Returns: {"tools": [...]}Main MCP endpoint (JSON-RPC 2.0)
Supported methods:
initialize- Start MCP sessiontools/list- Get available toolstools/call- Execute a tool
Build:
docker build -t arcadia-mcp-server .Run:
docker run -p 10000:10000 \
-e NOVA_ACT_API_KEY="your_key" \
-e MCP_SECRET="your_secret" \
arcadia-mcp-serverβββββββββββββββ
β Gmail β β Extract orders from email
ββββββββ¬βββββββ
β
βΌ
βββββββββββββββ
β MCP Server β β FastAPI + MCP Protocol
β (This) β
ββββββββ¬βββββββ
β
βΌ
βββββββββββββββ
β NovaAct β β Browser automation
β Automation β
ββββββββ¬βββββββ
β
βΌ
βββββββββββββββ
β Arcadia β β Create inbound orders
βββββββββββββββ
Components:
- FastAPI - HTTP server and API framework
- MCP Protocol - Model Context Protocol for tool invocation
- NovaAct - Browser automation for Arcadia/Gmail
- Core Logic - Business logic separated from HTTP layer
Health Check:
curl http://localhost:8080/healthCreate Test Order:
curl -X POST http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-H "x-mcp-key: your_secret" \
-d @test_create_order.jsonThe Python SDK is included for programmatic access:
from sdk.client import InboundOrderClient
client = InboundOrderClient(
base_url="https://your-server.com",
api_key="your_mcp_secret"
)
# Create an order
result = client.create_order(
master_bill_number="123456789",
product_code="PP48F",
quantity=24,
temperature="FREEZER"
)See SDK_USAGE.md for complete documentation.
Project Structure:
inbound_mcp/
βββ mcp/
β βββ server.py # FastAPI app & MCP endpoints
β βββ schemas.py # MCP response formatters
βββ core/
β βββ actions.py # Business logic
β βββ schemas.py # Data models
β βββ errors.py # Custom exceptions
βββ sdk/
β βββ client.py # Python SDK
βββ Dockerfile # Production container
βββ requirements.txt # Python dependencies
βββ env.template # Environment variable template
Adding a New Tool:
- Add business logic to
core/actions.py - Define schema in
core/schemas.py - Add tool definition to
mcp/schemas.py - Handle in
mcp/server.pyMCP endpoint
- β API key authentication via headers
- β Environment-based secrets (no hardcoding)
- β CORS configured for specific origins
- β Health checks don't require auth
- β
All secrets in
.gitignore
Best Practices:
- Rotate
MCP_SECRETregularly - Use HTTPS in production (Render provides this)
- Monitor logs for unauthorized access
- Keep
NOVA_ACT_API_KEYsecure
- RENDER_DEPLOYMENT.md - Deploy to Render
- SDK_USAGE.md - Python SDK guide
- ARCHITECTURE.md - System design details
Service won't start:
- Verify environment variables are set
- Check logs for missing dependencies
- Ensure port 10000 is available
Authentication fails:
- Verify
x-mcp-keyheader matchesMCP_SECRET - Check header spelling (case-sensitive)
Browser automation fails:
- Verify
NOVA_ACT_API_KEYis valid - Check Nova Act account credits
- Ensure Chromium is installed
Orders not creating:
- Check browser profile has valid Arcadia login
- Verify order data format matches schema
- Review logs for detailed error messages
MIT License - See LICENSE file for details
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
For issues or questions:
- Check documentation files
- Review Render logs
- Test with curl commands
- Verify environment variables
Status: β Production Ready
Deploy this MCP server to automate your Arcadia inbound order processing!