Skip to main content
B

aiqicha-dsh-mcp-oauth

baidu/aiqicha-dsh-mcp-oauth

Connect an Aiqicha account to DeepSeek Harness over OAuth 2.1 (PKCE) and query company registration, shareholders, outbound investments, business and judicial risks, and intellectual property from the official Aiqicha remote MCP server.

Install

dsh plugin --profile web add github:baidu/aiqicha-dsh-mcp-oauth

README

aiqicha-dsh-mcp-oauth

A DeepSeek Harness (DSH) plugin that connects the "Aiqicha Business Information" MCP service to DSH through OAuth sign-in.

Once connected, the model can query company registration data, shareholders, outbound investments, business risks, intellectual property and more. The service endpoint is https://agent.aiqicha.com/mcp/aqc-all.

How it works

The plugin uses the OAuth 2.0 authorization code flow with PKCE (S256 only). The client obtains its client_id through dynamic client registration (RFC 7591), so no secret has to be applied for in advance.

  1. When the plugin activates without a valid authorization, it starts authorization and opens the browser automatically. You can also have the model call aiqicha_connect, which returns an authorization URL.
  2. Open the URL in a browser, sign in to your Aiqicha account and approve access. The browser is redirected back to a callback port on 127.0.0.1.
  3. The plugin exchanges the code for tokens and registers the Aiqicha MCP service with the DSH MCP manager. The model can then use its tools.
  4. Before the access token expires, the plugin replaces it with the refresh token automatically.

Within a DSH profile, the Aiqicha business, legal, and tender plugins share one authorization when using their default connection settings. Authorize from any plugin and the other enabled plugins connect automatically. Only one authorization is started when several plugins activate at the same time. Forced authorization updates the shared account, and disconnecting clears authorization for all three plugins. After upgrading from an older version, authorize once in the current profile. Custom OAuth or MCP settings continue to use separate authorization.

Tokens are stored only in the DSH credential provider. They never appear in logs, tool results or this repository.

Tools

ToolPurpose
aiqicha_connectStarts authorization and returns the authorization URL. Does nothing if already connected; pass force: true to authorize again.
aiqicha_statusShows the connection state: disconnected, pending, connected or reauth-required.
aiqicha_disconnectRevokes the tokens (best effort), unregisters the MCP service and clears local credentials.

reauth-required means the refresh token is no longer valid. Call aiqicha_connect again.

Configuration

Every option has a default, so you normally do not need to change anything. Override them in the profile patch when needed.

OptionDefaultDescription
issuerhttps://agent.aiqicha.comOAuth authorization server
resourcehttps://agent.aiqicha.com/mcp/aqc-allMCP endpoint
clientNameDeepSeek Harness - 爱企查 MCPClient name reported during dynamic registration
scopemcpRequested scope
serverNameaiqichaService name registered with the MCP manager
tokenRefAIQICHA_MCP_ACCESS_TOKENAccess token reference prefix in standalone mode
callbackPort0Local callback port. 0 prefers the previous port and falls back to a random port. A nonzero value uses standalone authorization
openBrowsertrueWhether to try to open the browser when authorization starts
autoConnecttrueStart authorization and open the browser automatically when the plugin activates without a valid grant; set to false to disable
authTimeoutMs300000Maximum time to wait for the user to authorize
refreshSkewSec120How many seconds before expiry the token is refreshed
requestTimeoutMs15000Timeout of a single network request

Usage

The package is published to npm as aiqicha-dsh-mcp-oauth. Install it into a DSH profile; a global npm install -g is not picked up by DSH.

dsh plugin --profile web add aiqicha-dsh-mcp-oauth

Restart DSH afterwards. For the desktop client, fully quit it first and use the desktop profile:

dsh plugin --profile desktop add aiqicha-dsh-mcp-oauth

The package declares dsh.bundle, so the CLI registers it in dsh.profile.bundles of ~/.dsh/profiles/<profile>/package.json. If it does not show up there, add "aiqicha-dsh-mcp-oauth" to that array yourself and restart.

Install from GitHub

dsh plugin --profile web add github:baidu/aiqicha-dsh-mcp-oauth

Install from a local checkout

Clone the repository. No dependency installation is required: the runtime code statically imports only node: built-ins, and @deepseek-ai/schemastery is an optional dependency used for configuration validation and the settings form. Without any node_modules the plugin still loads and registers its tools, and configuration falls back to the built-in defaults (autoConnect, openBrowser, issuer, … can still be overridden in a profile patch).

git clone https://github.com/baidu/aiqicha-dsh-mcp-oauth.git
dsh plugin --profile web add "link:$(pwd)/aiqicha-dsh-mcp-oauth"

On Windows PowerShell, use "file:$((Get-Location).Path)" instead of the link: form. In the desktop client you can also click "Add plugin" on the Plugins page and choose the repository directory.

Without the CLI, write a patch file whose name is the absolute path of lib/index.js, and pass it with --patch when starting DSH:

# my.patch.yml
- insert:
    - id: aiqicha
      name: /absolute/path/to/aiqicha-dsh-mcp-oauth/lib/index.js
dsh web --patch ./my.patch.yml

Run npm install inside the checkout only when you want the settings form and typed validation.

After switching between a local directory and a package installation, fully quit and restart DSH: it may still resolve the old path. Do not keep both a link: installation and a package installation.

Verify

On activation the plugin opens the authorization page automatically and the state is pending. Ask the model to call aiqicha_status; the state becomes connected after authorization. If the page did not open, call aiqicha_connect to get the authorization URL.

Upgrade and uninstall

dsh plugin --profile web update aiqicha-dsh-mcp-oauth
dsh plugin --profile web remove aiqicha-dsh-mcp-oauth

After removing a package that was registered in dsh.profile.bundles, also drop it from that array.

Security

  • Only https URLs are accepted, except loopback addresses. The authorization server metadata and every endpoint are validated.
  • The callback server listens on 127.0.0.1 only and accepts GET /callback only. A request with a mismatched state is rejected and does not consume the authorization.
  • Authorization codes, tokens and PKCE verifiers never appear in logs or error messages.
  • A failed revocation does not block local cleanup.

Development

Requires Node.js 20 or later.

npm install
npm test

Tests use the built-in node:test, and the authorization server is simulated locally, so they do not reach the network. They cover PKCE, metadata discovery, callback validation, the full authorization flow, token refresh and rotation, reauth-required, disconnecting, and the absence of sensitive data in logs.

The host @deepseek-ai/dsh requires Node.js 24.9 or later.

License

Apache-2.0. See LICENSE.

Related plugins