# ShangQian / BestSign MCP

> ShangQian / 上上签 (BestSign) connects your agent to China’s leading B2B digital signature platform. It handles the entire contract lifecycle—from user registration and KYC checks to template creation and final signing. Your agent can initialize contracts, check status updates, or generate download links without you touching the BestSign portal.

## Overview
- **Category:** document-management
- **Price:** Free
- **Tags:** contract-lifecycle, identity-verification, kyc, digital-workflow, b2b-automation

## Description

Listen up: The ShangQian BestSign MCP Server hooks your agent directly into China's B2B digital signature platform. This isn't some basic API wrapper; it handles the whole contract lifecycle—from setting up a new user to getting the final, signed PDF. Your agent runs these processes without you ever having to log into the BestSign portal. You use this server when your workflow demands automated document handling and legal signing.

**User Identity Management:**
You can onboard people or companies using `register_shangqian_user`, which signs up a completely new account in the system. Before anything else, you check who's legit: running `verify_identity_v2` performs the mandatory KYC identity checks against external sources, and if you need to confirm credentials later, `get_user_certificate` retrieves the specific digital certificate details for any authorized user.

**Template and Draft Creation:**
Before a contract can be signed, it needs structure. You control your document library by uploading new reusable templates using `upload_shangqian_template`. Once you've got those definitions stored away, you use `create_shangqian_contract` to generate a brand-new, signature-ready contract document based on one of your existing templates.

**Contract Tracking and Status:**
Need to know where things stand? You don't gotta guess. Calling `get_contract_details` instantly retrieves the current metadata and status for any specific contract ID you feed it. This tells your agent if the contract is pending, partially signed, or fully executed.

**The Signing Process:**
The workflow culminates with signing. When authorized parties are ready to sign, your agent triggers the signature using `sign_contract_now`, recording that digital approval on the document. Once all signatures are collected and the finalization process runs, you get a secure download link for the completed PDF file by calling `get_contract_download`.

## Tools

### create_shangqian_contract
Creates a new contract document ready for signatures using specified templates.

### get_contract_details
Retrieves the current metadata and status details for an existing contract ID.

### get_contract_download
Gets a secure, temporary download URL for a finalized or drafted document.

### get_user_certificate
Retrieves the digital certificate details for a specified user account.

### register_shangqian_user
Registers a completely new personal or corporate user into the ShangQian system.

### sign_contract_now
Initiates and records the digital signature from an authorized account on a contract.

### upload_shangqian_template
Adds a new, structured template to your company's library of reusable contract documents.

### verify_identity_v2
Performs a digital identity check (KYC) on a user against external verification sources.

## Prompt Examples

**Prompt:** 
```
List all contract templates in my ShangQian account.
```

**Response:** 
```
I've retrieved your template list. You have 5 active templates, including 'Standard_Employment_Contract' (ID: `tem_8821`) and 'NDA_v2'. Would you like me to initialize a new contract using one of these?
```

**Prompt:** 
```
Register a new enterprise user 'Vinkius' with account 'vinkius@example.com'.
```

**Response:** 
```
I've successfully registered 'Vinkius' as an enterprise user in the ShangQian system. The account is now ready for digital certificate issuance and signing. Should I retrieve the certificate details?
```

**Prompt:** 
```
What is the status of contract '88210934'?
```

**Response:** 
```
Contract `88210934` ('Sales Agreement') is currently 'PARTIALLY_SIGNED'. 1 out of 2 signers have completed their signatures. Would you like me to generate a download link for the current draft?
```

## Capabilities

### Manage User Identity
The server registers new people or companies and verifies their identity using KYC checks.

### Create Contract Drafts
You can generate a contract document ready to be signed, pulling from existing templates.

### Track Signing Status
The agent checks the current status of any active contract (e.g., 'partially signed' or 'pending').

### Finalize and Retrieve Documents
Once signatures are collected, you can trigger the final sign-off and get a secure download link for the executed PDF.

### Update Contract Templates
You can upload new contract templates or list existing ones in the system's document library.

## Use Cases

### Onboarding a New Employee
HR needs to onboard 'Jane Doe'. First, the agent runs `register_shangqian_user` for her. Then, it calls `verify_identity_v2` to confirm her credentials. Finally, it uses `create_shangqian_contract` with the employment template and waits for confirmation that she can sign.

### Tracking a High-Value Agreement
The sales team needs status on 'Client X's NDA'. They ask their agent, which calls `get_contract_details` with the ID. The agent reports: 'It’s currently pending signature from John Smith.' If it's done, they call `get_contract_download`.

### Setting up a New Contract Type
The legal department needs to start using a new vendor agreement. They use `upload_shangqian_template` first. Then, when the next contract is needed, they pass this new template ID directly into `create_shangqian_contract`.

### Batch Processing Signatures
You have 50 contracts ready to sign. Instead of doing them one by one, your agent iterates through the list, calling `sign_contract_now` for each authorized user and logging the result.

## Benefits

- The agent manages complex identity checks. You run `verify_identity_v2` immediately after user registration, ensuring every person who signs a contract is compliant before drafting starts.
- You don't need to remember IDs or navigate portals. Calling `get_contract_details` gives you the live status of any contract—whether it’s pending signature or already finalized.
- Getting documents is simple. Instead of emailing requests, your agent runs `get_contract_download` and hands you a direct link to the final PDF, ready for archiving.
- Managing templates moves from file shares to code. Use `upload_shangqian_template` once, and then call `create_shangqian_contract` anytime, guaranteeing formatting consistency.
- The signing process is instant. You tell your agent to sign the agreement using `sign_contract_now`, and it handles the API calls needed to secure the document.

## How It Works

The bottom line is: You tell your AI client what you need done (e.g., 'Start Contract X'), and it handles the multi-step API calls necessary to get the result.

1. Subscribe to this server and enter your ShangQian Developer ID and RT Secret credentials.
2. Your AI client uses one of the exposed tools (e.g., `create_shangqian_contract`) by passing required parameters like template IDs or user accounts.
3. The server executes the call, communicates with BestSign, and returns structured data—like a contract ID or status update—directly to your agent.

## Frequently Asked Questions

**How do I check if a user is compliant using verify_identity_v2?**
You run `verify_identity_v2` and pass the user’s details. The server returns a success or failure code based on their digital certificate status, letting you know instantly if they are good to go.

**What is the difference between create_shangqian_contract and upload_shangqian_template?**
`upload_shangqian_template` puts a reusable contract format into your library. `create_shangqian_contract` uses that stored template ID to generate an actual, actionable document ready for signing.

**Can I get the final signed PDF using get_contract_download?**
Yes, but only if all required signers have completed their signatures. Running `get_contract_details` first helps you confirm the status is 'FULLY_SIGNED' before attempting to download.

**How do I register a new corporate user in ShangQian?**
Use `register_shangqian_user`. This tool handles creating the account and setting up the framework so that you can later request their digital certificate via `get_user_certificate`.

**What process should I follow to validate a user's digital identity before signing with `sign_contract_now`?**
You must first run the `get_user_certificate` tool. This confirms the individual's valid digital certificate and status within the ShangQian system. It’s a necessary security step that proves the person initiating the signature action is who they claim to be.

**If I need to change or review my contract forms, how do I list my available templates before using `create_shangqian_contract`?**
You'll use a dedicated template listing tool (separate from the main creation call). This step lets you audit your full library of document definitions. You confirm the correct ID and name before initiating the contract, which prevents starting with an outdated form.

**How does `get_contract_details` help me track a contract that is currently in progress?**
The tool provides real-time status updates on the agreement. It doesn't just say 'signed'; it shows exactly which signers have completed their part, and if there are any outstanding actions required to move the workflow forward.

**What credentials do I need for my AI client to successfully execute operations like `register_shangqian_user`?**
You must provide your specific ShangQian Developer ID and RT Secret. These unique keys are required by the server to authenticate your agent and authorize any actions, ensuring that only you can manage user accounts.

**How do I find my ShangQian Developer ID and Secret?**
Log in to the [BestSign Developer Platform](https://open.bestsign.cn/), navigate to the 'Application Management' or 'Credentials' section to find your unique Developer ID and RT Secret.

**What is the 'account' identifier?**
The account identifier is a unique string used to identify a user in the ShangQian system, typically a mobile phone number or an email address. It is required for registration and signing operations.

**Does this server handle HMAC-SHA1 signatures?**
Yes! The server automatically calculates the required HMAC-SHA1 signature using your RT Secret for every request, ensuring secure authorized communication with the ShangQian API.