| 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, and DHL 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
# 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 srcConfigure with Claude Desktop by adding to your MCP configuration:
{
"mcpServers": {
"tracking-rate-mcp": {
"command": "python",
"args": ["-m", "src"],
"cwd": "/path/to/TrackingRateMCP"
}
}
}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 multiple packages
python main.py --fedex 123456789012 987654321098
python main.py --ups 1Z12345E0123456789 1Z12345E9876543210
python main.py --dhl GM60511234500000001 GM60511234500000002# Validate tracking numbers without tracking
python main.py --validate --fedex 123456789012
python main.py --validate --ups 1Z12345E0123456789
python main.py --validate --dhl GM60511234500000001
# 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 │ ├── tracking/ │ │ ├── __init__.py # Tracking package init │ │ ├── fedex_tracker.py # FedEx tracking implementation │ │ ├── ups_tracker.py # UPS tracking implementation │ │ ├── dhl_tracker.py # DHL 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 ├── 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)
status: TrackingStatus # Current package status
estimated_delivery: Optional[datetime] # Estimated delivery time
events: List[TrackingEvent] # Tracking history
delivery_address: Optional[str] # Delivery location
service_type: Optional[str] # Shipping service type
weight: Optional[str] # Package weight
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 |