Skip to content

feat(kuaidi100): add Kuaidi100 provider - #496

Merged
BlackHole1 merged 2 commits into
oomol-lab:mainfrom
Weaxs:feat/kuaidi100-mcp
Sep 5, 2026
Merged

feat(kuaidi100): add Kuaidi100 provider#496
BlackHole1 merged 2 commits into
oomol-lab:mainfrom
Weaxs:feat/kuaidi100-mcp

Conversation

@Weaxs

@Weaxs Weaxs commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

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 the key query parameter.

Actions (all locally executable):

  • query_trace — real-time logistics trajectory for a tracking number
  • auto_number — detect likely carriers from the number format
  • estimate_time — pre-shipment delivery time estimate
  • estimate_time_with_logistic — in-transit arrival estimate from an existing trajectory
  • estimate_price — shipping price estimate

Also includes the key-query proxy, credential validation via autoNumber, 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)
  • Live audit of all 5 endpoints: params accepted, response keys match, error envelopes mapped

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 86424e86-7d7c-4aa5-a772-b3828d184403

📥 Commits

Reviewing files that changed from the base of the PR and between d61f26d and dbac1cd.

📒 Files selected for processing (3)
  • src/providers/kuaidi100/actions.ts
  • src/providers/kuaidi100/runtime.test.ts
  • src/providers/kuaidi100/runtime.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


Summary by CodeRabbit

  • New Features

    • Added Kuaidi100 integration for shipment tracking and carrier auto-detection.
    • Added delivery-time estimates, including estimates based on current logistics events.
    • Added shipping price estimates.
    • Added API key authentication and credential validation for Kuaidi100.
  • Bug Fixes

    • Improved handling of invalid requests, provider errors, empty responses, and incomplete logistics event data.

Walkthrough

Adds 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
Loading

Merge Risk: ⚪ Minimal · up to dbac1

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)
Check name Status Explanation
Title check ✅ Passed The title follows the required <type>(<scope>): <subject> format and accurately describes the addition of the Kuaidi100 provider.
Description check ✅ Passed The description directly explains the Kuaidi100 provider, supported actions, authentication, error handling, and verification.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code

Comment @coderabbitai help to get the list of available commands.

@BlackHole1 BlackHole1 self-assigned this Sep 5, 2026
…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.
@BlackHole1
BlackHole1 merged commit eb0965b into oomol-lab:main Sep 5, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants