USPS Address Validation and Standardization MCP Server
Validates and standardizes US addresses using the official USPS Address Validation API, providing tools for address validation and standardization.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@USPS Address Validation and Standardization MCP Servervalidate this address: 1600 Amphitheatre Pkwy, Mountain View, CA 94043"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
USPS Address Validation and Standardization MCP Server
A Model Context Protocol (MCP) server that provides AI assistants with tools to interact with USPS services, specifically address validation and standardization.
Features
Address Validation: Validate and standardize US addresses using the official USPS Address Validation API
OAuth2 Authentication: Secure authentication using USPS OAuth2 Client Credentials flow
MCP Protocol Compliance: Standard MCP server implementation for AI model integration
Comprehensive Error Handling: Robust error handling for API timeouts, rate limits, and validation errors
TypeScript Support: Full TypeScript implementation with type safety
Related MCP server: UPS MCP Server
Prerequisites
USPS Business Account: You need a USPS Business Account to access the APIs. Read the Getting Started at USPS Developer Portal
API Credentials: Obtain Consumer Key and Consumer Secret from your API app
Setup
1. Clone and Install
git clone https://github.com/bailur/usps-mcp-server.git
cd usps-mcp-server
npm install2. Environment Configuration
Copy the example environment file and configure your USPS credentials:
cp .env.example .envEdit .env with your USPS API credentials:
USPS_CLIENT_ID=your_consumer_key_here
USPS_CLIENT_SECRET=your_consumer_secret_here
NODE_ENV=development3. Build and Run as stdio
# Development
npm run dev
# Production build
npm run build
npm start
# Run tests
npm test4. Run as an SSE MCP server
# Production build
npm run start:http
Usage
As a stdio MCP Server
The server runs as a stdio-based MCP server. Configure your AI client to use this server:
{
"mcpServers": {
"usps": {
"command": "node",
"args": ["/path/to/usps-mcp-server/dist/index.js"],
"env": {
"USPS_CLIENT_ID": "your_key",
"USPS_CLIENT_SECRET": "your_secret"
}
}
}
}Usage in Claude as stdio
{
"mcpServers": {
"usps": {
"command": "npx",
"args": [
"tsx",
"/path/to/usps-mcp-server/src/index.ts",
"--env", "USPS_CLIENT_ID=your_client_id",
"--env", "USPS_CLIENT_SECRET=your_consumer_secret",
"--env", "NODE_ENV=prod",
"--env", "MCP_TRANSPORT=stdio",
"--env", "USPS_BASE_URL=https://apis.usps.com",
"--env", "USPS_TEST_BASE_URL=https://apis-tem.usps.com"
]
}
},
"globalShortcut": "CommandOrControl+Shift+Space"
}Usage in VS Code Copilot as SSE
Run the app using SSE
npm run start:httpConfigure VS Code mcp.json
{
"servers": {
"usps-remote-mcp-server": {
"url": "http://localhost:3000/mcp",
"type": "sse"
}
},
"inputs": []
}Available Tools
validate_address
Validates and standardizes a US address using USPS services.
Parameters:
streetAddress(required): Street address (e.g., "123 Main St")city(required): City name (e.g., "New York")state(required): Two-letter state code (e.g., "NY")zipCode(required): ZIP code (e.g., "12345" or "12345-6789")urbanization(optional): Urbanization name (Puerto Rico only)
Example Usage:
{
"tool": "validate_address",
"arguments": {
"streetAddress": "123 Main Street",
"city": "New York",
"state": "NY",
"zipCode": "10001"
}
}Response:
{
"success": true,
"originalAddress": {
"streetAddress": "123 Main Street",
"city": "New York",
"state": "NY",
"zipCode": "10001"
},
"validatedAddress": {
"address": {
"streetAddress": "123 MAIN ST",
"city": "NEW YORK",
"state": "NY",
"ZIPCode": "10001",
"ZIPPlus4": "1234"
},
"additionalInfo": {
"DPVConfirmation": "Y",
"business": "N"
}
},
"summary": "Standardized address: 123 MAIN ST, NEW YORK, NY, 10001-1234 (delivery point confirmed)"
}API Integration
USPS Authentication
The server automatically handles OAuth2 authentication:
Uses Client Credentials flow with your USPS Consumer Key/Secret
Caches access tokens and handles automatic refresh
Adds Bearer token to all API requests
Rate Limiting
USPS APIs have rate limits (default: 60 calls per hour)
The server implements delays between batch requests
Consider implementing additional rate limiting for production use
Testing Environment
For development, set NODE_ENV=development to use the USPS Testing Environment for Mailers (TEM):
Production:
apis.usps.comTesting:
apis-tem.usps.com
Error Handling
The server provides comprehensive error handling:
Authentication Errors: Invalid credentials, expired tokens
Validation Errors: Invalid input parameters, malformed addresses
API Errors: USPS service errors, network timeouts
Rate Limit Errors: Automatic retry with exponential backoff
Development
Project Structure
src/
├── auth/
│ └── oauth-client.ts # OAuth2 client implementation
├── services/
│ └── address-validation.ts # Address validation service
├── tools/
│ └── validate-address-tool.ts # MCP tool definition
├── types/
│ └── address-types.ts # TypeScript type definitions
├── server.ts # Main MCP server
└── index.ts # Entry pointAdding New Tools
Create service class in
src/services/Define tool schema in
src/tools/Register tool in
src/server.tsAdd tests and update documentation
License
MIT License - see LICENSE file for details
Support
For USPS API issues:
For MCP Server issues:
Create an issue in this repository
Check the MCP Specification
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceEnables AI agents to integrate with UPS shipping and logistics capabilities, including package tracking with delivery status and transit information, and address validation for U.S. and Puerto Rico locations.Last updated28MIT
- AlicenseAqualityDmaintenanceEnables AI agents to create shipments, track packages, get rates, validate addresses, schedule pickups, and find UPS locations via the UPS API.Last updated9242MIT
- AlicenseAqualityCmaintenanceEnables AI assistants to connect to Gmail accounts, check connection status, and send emails through a secure OAuth 2.0 interface.Last updated12Apache 2.0
- Alicense-qualityBmaintenanceEnables AI agents to buy US shipping labels (USPS, UPS, FedEx) with automatic cheapest-rate selection, track parcels, and refund unused labels via the EasyPost API. Stateless, bring-your-own API key, free test keys available.Last updatedMIT
Related MCP Connectors
Address validation & geocoding for AI agents: 240+ countries, UK PAF, free US/CA enrichment
Multi-carrier shipping for AI agents: compare rates, buy labels, track packages, validate addresses
Validate EU, UK, AU VAT numbers for AI agents. EU ViDA e-invoicing compliance.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/bailur/usps-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server