SF Express MCP Server
Enables integration with SF Express shipping and logistics APIs for order management, shipment tracking, route queries, and logistics services through natural language interactions.
README
SF Express MCP Server
A Model Context Protocol (MCP) server that provides integration with SF Express shipping and logistics APIs. This server enables LLM applications to interact with SF Express services for order management, shipment tracking, route queries, and logistics services.
Features
- Order Management: Create new shipping orders with comprehensive address and cargo information
- Shipment Tracking: Track packages using waybill numbers or order IDs with detailed route history
- Route Queries: Find available shipping routes between locations with pricing information
- Service Inquiry: Check service availability and restrictions between locations
- Logistics Services: Query warehousing, distribution, fulfillment, and return services
Supported SF Express APIs
This MCP server connects to the following SF Express API categories:
- Category 1, apiClassify 1: Order Creation (
EXP_RECE_CREATE_ORDER) - Category 1, apiClassify 2: Shipment Tracking (
EXP_RECE_SEARCH_ORDER_RESP) - Category 1, apiClassify 3: Route Queries (
EXP_RECE_SEARCH_ROUTES) - Category 1, apiClassify 4: Service Inquiry (
EXP_RECE_SEARCH_SERVICE) - Category 6, apiClassify 2: Logistics Services (
EXP_RECE_SEARCH_LOGISTICS)
Installation
Prerequisites
- Node.js 18.0.0 or higher
- SF Express developer account and API credentials
Setup
- Clone or download this project:
git clone https://github.com/100kgforest/sf-express-mcp-server.git
cd sf-express-mcp-server
- Install dependencies:
npm install
- Configure environment variables:
cp .env.example .env
Edit .env and fill in your SF Express API credentials:
SF_EXPRESS_PARTNER_ID=your_partner_id_here
SF_EXPRESS_REQUEST_ID=your_request_id_here
SF_EXPRESS_CHECK_WORD=your_check_word_here
- Build the project:
npm run build
Usage
Running the MCP Server
Start the server directly:
npm start
Or run in development mode:
npm run dev
Configuring with Claude Desktop
Add the server to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"sf-express": {
"command": "node",
"args": ["/path/to/sf-express-mcp-server/dist/index.js"],
"env": {
"SF_EXPRESS_PARTNER_ID": "your_partner_id",
"SF_EXPRESS_REQUEST_ID": "your_request_id",
"SF_EXPRESS_CHECK_WORD": "your_check_word"
}
}
}
}
Using with npx
You can also run the server using npx (after publishing to npm):
npx sf-express-mcp-server
Available Tools
1. sf_express_create_order
Create a new shipping order with SF Express.
Parameters:
orderId(string): Unique customer order IDexpressType(string): Service type (1-Standard, 2-Next Day, 3-Same Day, 4-Economic, 5-International)payMethod(string): Payment method (1-Sender pays, 2-Receiver pays, 3-Third party pays)custId(string): Customer ID from SF ExpressconsigneeInfo(object): Recipient contact and address informationdeliverInfo(object): Sender contact and address informationcargo(array): List of items to ship with quantities and weightsaddedService(array, optional): Additional servicesremark(string, optional): Special instructions
Example:
{
"orderId": "ORDER123456",
"expressType": "1",
"payMethod": "1",
"custId": "CUST001",
"consigneeInfo": {
"contact": {
"contact": "张三",
"tel": "13800138000",
"company": "ABC公司"
},
"address": {
"province": "广东省",
"city": "深圳市",
"county": "南山区",
"address": "科技园南区深南大道10000号"
}
},
"deliverInfo": {
"contact": {
"contact": "李四",
"tel": "13900139000",
"company": "XYZ公司"
},
"address": {
"province": "北京市",
"city": "北京市",
"county": "朝阳区",
"address": "建国门外大街1号"
}
},
"cargo": [
{
"name": "电子产品",
"count": 1,
"weight": 2.5,
"amount": 1000
}
]
}
2. sf_express_track_shipment
Track shipment status and route history.
Parameters:
trackingType(string): Type of tracking (1-waybill number, 2-order ID)trackingNumber(array): List of tracking numbersmethodType(string, optional): Query method
Example:
{
"trackingType": "1",
"trackingNumber": ["SF1234567890123"]
}
3. sf_express_query_routes
Query available shipping routes and pricing.
Parameters:
originCode(string): Origin area codedestCode(string): Destination area codecargoWeight(number, optional): Cargo weight for pricing
Example:
{
"originCode": "010",
"destCode": "021",
"cargoWeight": 5.0
}
4. sf_express_service_inquiry
Inquire about service availability between locations.
Parameters:
originCode(string): Origin area codedestCode(string): Destination area codeserviceType(string, optional): Specific service type
Example:
{
"originCode": "010",
"destCode": "021"
}
5. sf_express_logistics_services
Query logistics services like warehousing and fulfillment.
Parameters:
serviceType(string): Service type (warehouse, distribution, fulfillment, return)locationCode(string): Location coderequirements(object, optional): Specific requirements
Example:
{
"serviceType": "warehouse",
"locationCode": "010",
"requirements": {
"storageType": "general",
"capacity": 1000
}
}
Error Handling
The server provides comprehensive error handling with structured error responses:
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid input parameters",
"details": [...],
"timestamp": "2024-01-01T00:00:00.000Z"
}
}
Common error codes:
VALIDATION_ERROR: Invalid input parametersAUTHENTICATION_ERROR: Invalid API credentialsNETWORK_ERROR: Network connectivity issuesSERVICE_ERROR: SF Express API errorsTIMEOUT_ERROR: Request timeout
Development
Project Structure
src/
├── index.ts # Main MCP server entry point
├── sf-express-client.ts # SF Express API client
├── types.ts # TypeScript type definitions
└── tools/ # MCP tool implementations
├── create-order.ts
├── track-shipment.ts
├── query-routes.ts
├── service-inquiry.ts
└── logistics-services.ts
Building
npm run build
Development Mode
npm run dev
Linting
npm run lint
Configuration
Environment variables:
| Variable | Required | Description |
|---|---|---|
SF_EXPRESS_API_URL |
No | API base URL (default: https://open.sf-express.com) |
SF_EXPRESS_PARTNER_ID |
Yes | Your SF Express Partner ID |
SF_EXPRESS_REQUEST_ID |
Yes | Your SF Express Request ID |
SF_EXPRESS_CHECK_WORD |
Yes | Your SF Express Check Word |
SF_EXPRESS_TIMEOUT |
No | Request timeout in milliseconds (default: 30000) |
Security Notes
- Never commit API credentials to version control
- Use environment variables for sensitive configuration
- Implement proper access controls in production environments
- Monitor API usage to prevent abuse
Troubleshooting
Common Issues
- Authentication Failed: Check your API credentials
- Network Timeout: Increase timeout or check network connectivity
- Invalid Service Code: Ensure you're using the correct SF Express service codes
- Rate Limiting: Implement proper rate limiting to avoid API limits
Debug Mode
Set environment variable for verbose logging:
DEBUG=sf-express-mcp npm start
License
MIT License - see LICENSE file for details.
Support
For SF Express API documentation and developer support:
- Developer Portal: https://open.sf-express.com
- API Documentation: https://open.sf-express.com/Api
For MCP protocol documentation:
- MCP Specification: https://modelcontextprotocol.io
- SDK Documentation: https://github.com/modelcontextprotocol
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
Please ensure all tests pass and follow the existing code style.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。