| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A Model Context Protocol (MCP) server that enables AI agents to track packages using FedEx, UPS, DHL, and OnTrac APIs. This server provides standardized tracking tools that can be consumed by any MCP-compatible AI agent or application.
To run the MCP server:
python -m srcTo configure with Claude Desktop, add this to your MCP settings:
{
"mcpServers": {
"tracking-rate-mcp": {
"command": "python",
"args": ["-m", "src"],
"cwd": "/path/to/TrackingRateMCP"
}
}
}Clone the repository:
git clone <repository-url>
cd TrackingRateMCPCreate and activate virtual environment (as specified in CLAUDE.md):
python -m venv venv_linux
source venv_linux/bin/activate # On Linux/macOS
# or
venv_linux\\Scripts\\activate # On WindowsInstall dependencies:
pip install -r requirements.txtSet up environment variables:
cp .env.example .env
# Edit .env with your API credentialsCreate a .env file based on .env.example with the following settings:
# FedEx Configuration (Production)
FEDEX_CLIENT_ID=your_fedex_client_id
FEDEX_CLIENT_SECRET=your_fedex_client_secret
FEDEX_SANDBOX=false
# UPS Configuration
UPS_CLIENT_ID=your_ups_client_id
UPS_CLIENT_SECRET=your_ups_client_secret
UPS_REDIRECT_URI=http://localhost:8000/callback
UPS_SANDBOX=false
# DHL Configuration
DHL_CLIENT_ID=your_dhl_client_id
DHL_CLIENT_SECRET=your_dhl_client_secret
DHL_SANDBOX=true
# OnTrac Configuration
ONTRAC_API_KEY=your_ontrac_api_key
ONTRAC_ACCOUNT_NUMBER=your_ontrac_account_number
ONTRAC_SANDBOX=false
# MCP Configuration
MCP_TRANSPORT=stdio
LOG_LEVEL=INFO# Custom timeout settings
REQUEST_TIMEOUT=30
TOKEN_REFRESH_BUFFER=60Start the MCP server for use with AI agents:
python -m srcThe MCP server supports multiple AI platforms:
Configure with Claude Desktop by adding to your MCP configuration:
{
"mcpServers": {
"tracking-rate-mcp": {
"command": "python",
"args": ["-m", "src"],
"cwd": "/path/to/TrackingRateMCP"
}
}
}This MCP server can be integrated with Microsoft Copilot Studio to enable package tracking capabilities in your Copilot agents.
Start the MCP server locally:
python -m srcExpose your local server using a tunneling service:
Prepare your MCP server for Azure deployment:
Deploy to Azure App Service:
# Using Azure CLI
az webapp up --name tracking-mcp-server --resource-group your-rg --runtime "PYTHON:3.11"Configure environment variables in Azure Portal:
Navigate to Power Apps (make.powerapps.com)
Create a new custom connector:
Configure the connector:
General Information:
Security:
Definition:
x-ms-agentic-protocol: mcp-streamable-1.0Import the OpenAPI specification:
swagger: '2.0'
info:
title: Package Tracking MCP
description: MCP server for package tracking via FedEx, UPS, DHL, and OnTrac
version: 1.0.0
host: your-server.azurewebsites.net
basePath: /
schemes:
- https
paths:
/mcp:
post:
summary: Package Tracking MCP Server
x-ms-agentic-protocol: mcp-streamable-1.0
operationId: InvokeMCP
responses:
'200':
description: SuccessTest and create the connector
Open your Copilot Studio agent
Navigate to Actions:
Configure the action:
Test in Copilot Studio:
Start the HTTP server for REST API access:
python -m src.serverThe package includes a CLI for testing and development:
# Track a FedEx package
python main.py --fedex 123456789012
# Track a UPS package
python main.py --ups 1Z12345E0123456789
# Track a DHL package
python main.py --dhl GM60511234500000001
# Track an OnTrac package
python main.py --ontrac C10000012345678
# Track multiple packages
python main.py --fedex 123456789012 987654321098
python main.py --ups 1Z12345E0123456789 1Z12345E9876543210
python main.py --dhl GM60511234500000001 GM60511234500000002
python main.py --ontrac C10000012345678 D10000012345678# Validate tracking numbers without tracking
python main.py --validate --fedex 123456789012
python main.py --validate --ups 1Z12345E0123456789
python main.py --validate --dhl GM60511234500000001
python main.py --validate --ontrac C10000012345678
# Run test mode with sample tracking numbers
python main.py --test-mode
# Start MCP server
python main.py --serverfrom pydantic_ai import Agent
from mcp import Client
# Configure MCP client to use tracking server
mcp_client = Client("stdio", command=["python", "-m", "src.server"])
# Create agent with tracking capabilities
agent = Agent(
"gpt-4",
tools=[mcp_client],
system_prompt="You can track packages using FedEx and UPS."
)
# Use the agent
result = await agent.run("Track FedEx package 123456789012")The server exposes the following tools to AI agents:
TrackingRateMCP/ ├── src/ │ ├── __init__.py # Package initialization │ ├── server.py # Main MCP server implementation │ ├── models.py # Pydantic models for tracking data │ ├── config.py # Configuration and environment management │ ├── auth/ │ │ ├── __init__.py # Auth package init │ │ ├── fedex_auth.py # FedEx OAuth token management │ │ ├── ups_auth.py # UPS OAuth token management │ │ ├── dhl_auth.py # DHL OAuth token management │ │ └── ontrac_auth.py # OnTrac API key authentication │ ├── tracking/ │ │ ├── __init__.py # Tracking package init │ │ ├── fedex_tracker.py # FedEx tracking implementation │ │ ├── ups_tracker.py # UPS tracking implementation │ │ ├── dhl_tracker.py # DHL tracking implementation │ │ ├── ontrac_tracker.py # OnTrac tracking implementation │ │ └── base_tracker.py # Abstract tracking interface │ └── tools/ │ ├── __init__.py # Tools package init │ ├── fedex_tools.py # FedEx MCP tools │ ├── ups_tools.py # UPS MCP tools │ ├── dhl_tools.py # DHL MCP tools │ └── ontrac_tools.py # OnTrac MCP tools ├── tests/ # Comprehensive test suite ├── venv_linux/ # Virtual environment ├── requirements.txt # Python dependencies ├── pyproject.toml # Project configuration ├── .env.example # Environment variables template ├── README.md # This documentation └── main.py # CLI entry point for testing
Run the comprehensive test suite:
# Activate virtual environment
source venv_linux/bin/activate
# Run all tests with coverage
pytest tests/ -v --cov=src --cov-report=term-missing
# Run specific test modules
pytest tests/test_models.py -v
pytest tests/test_fedex_auth.py -v
pytest tests/test_fedex_tracking.py -v
# Run with detailed output
pytest tests/ -v -sThe project includes code quality tools configured in pyproject.toml:
# Format and lint code
ruff check src/ tests/ --fix
# Type checking
mypy src/ tests/
# Run all quality checks
ruff check src/ tests/ --fix && mypy src/ tests/To add support for additional carriers:
class TrackingResult(BaseModel):
tracking_number: str # Package tracking number
carrier: TrackingCarrier # Shipping carrier (fedex/ups/dhl/ontrac)
status: TrackingStatus # Current package status
estimated_delivery: Optional[datetime] # Estimated delivery time
delivered_at: Optional[datetime] # Actual delivery time
events: List[TrackingEvent] # Tracking history
origin: Optional[PackageLocation] # Origin location
destination: Optional[PackageLocation] # Destination location
delivery_address: Optional[str] # Delivery location
service_type: Optional[str] # Shipping service type
weight: Optional[str] # Package weight
reference_numbers: List[str] # Reference numbers
error_message: Optional[str] # Error details if tracking failedAuthentication Failures:
Tracking Failures:
MCP Integration Issues:
Enable debug logging for detailed troubleshooting:
LOG_LEVEL=DEBUGCheck logs for specific error details and API response information.
This project is for educational and development purposes. Please ensure compliance with FedEx and UPS API terms of service when using tracking functionality.
For issues and questions:
| Back | FazBrowse Home | New Git URL |