feat(kuaidi100): add Kuaidi100 provider - #496
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. Summary by CodeRabbit
WalkthroughAdds the Kuaidi100 provider with five actions for tracking queries, carrier detection, delivery-time estimates, logistic-based estimates, and price estimates. Defines schemas for action inputs and normalized outputs. Implements API requests, response normalization, input validation, and business-error mapping. Adds API-key credential validation and provider proxy wiring. Adds runtime tests for request parameters, logistic serialization, error mapping, and credential metadata. Sequence Diagram(s)sequenceDiagram
participant Client
participant Kuaidi100ActionHandler
participant Kuaidi100Runtime
participant Kuaidi100API
Client->>Kuaidi100ActionHandler: invoke provider action
Kuaidi100ActionHandler->>Kuaidi100Runtime: build validated query
Kuaidi100Runtime->>Kuaidi100API: send API request with key
Kuaidi100API-->>Kuaidi100Runtime: return JSON response
Kuaidi100Runtime-->>Kuaidi100ActionHandler: normalize payload or map error
Kuaidi100ActionHandler-->>Client: return action result
Merge Risk: ⚪ Minimal · up to This adds Kuaidi100 tracking, carrier detection, delivery estimates, and price estimates with validated request and error handling. Current coverage indicates the provider’s runtime and schema contracts are ready to merge. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches✨ Simplify code
Comment |
…dling - Use s.requiredObject for auto_number and estimate_price inputs and for the nested output items so the generated schemas carry a required array. - Give estimate_time_with_logistic its own logistic event schema where status is optional, matching the upstream contract; query_trace output keeps all three fields required. - Read the upstream body with readProviderJsonBody so it is size-capped and never echoed (the API key travels in the query string), and route HTTP status and envelope code through one status mapper. - Read the envelope code with optionalScalarString and use the shared optionalIntegerOrNull / optionalStringOrNull readers. - Mention SF Freight (顺丰快运) in the phone description. - Add tests for the optional status, numeric envelope codes, non-2xx bodies, non-null remainTime, and a bare HTTP 401 during validation.
Add the Kuaidi100 (快递100) MCP API as a provider, calling its
https://api.kuaidi100.com/stdio/<method>HTTP JSON endpoints with the API key sent as thekeyquery parameter.Actions (all locally executable):
query_trace— real-time logistics trajectory for a tracking numberauto_number— detect likely carriers from the number formatestimate_time— pre-shipment delivery time estimateestimate_time_with_logistic— in-transit arrival estimate from an existing trajectoryestimate_price— shipping price estimateAlso includes the
key-query proxy, credential validation viaautoNumber, and runtime tests for the HTTP-200{code, message, result:false}error envelope mapping. Parameter names, response shapes, and error envelopes were verified against the live API and the official reference implementation (https://github.com/kuaidi100-api/kuaidi100-MCP).Verification
npm run fix-check,npm test(1797 tests)