integrations/external-context/examples/provider-extension-local/README.md
This directory is a copyable starting point for a provider team that has an existing REST API but no remote MCP endpoint. The provider team owns the copy, its release process, and all API-specific behavior.
"private": true only in that reviewed copy.qwen-extension.json and
src/provider.ts.src/provider.ts. Do not add model-selected
endpoints, tenants, repositories, namespaces, or filters.context_search schemas and result limits in src/profile.ts
aligned with ../../contracts/v1/.The example endpoint accepts the same small Generic HTTP Search V1 shape as the private reference integration:
POST /v1/context/search
Authorization: Bearer <credential>
Content-Type: application/json
{"query":"normalized query","limit":5}
Configure the environment in an administrator-controlled launcher or trusted Qwen environment:
export PROVIDER_CONTEXT_BASE_URL=https://context.example.com
export PROVIDER_CONTEXT_TOKEN=replace-me
For a managed launch, export both values before starting Qwen. Qwen loads
trusted repository .env and .qwen/.env files before resolving this
manifest; those files can fill a missing value but cannot override an existing
process environment value. Treat the repository, its environment files, and
same-UID code as trusted, or use a separately isolated service boundary.
Do not commit a credential to the manifest. This example intentionally does
not declare Extension settings as a credential path until Qwen's complete
settings-to-MCP-child runtime path has a passing E2E.
Outbound Provider requests honor HTTP_PROXY, HTTPS_PROXY, and NO_PROXY.
npm install
npm run typecheck
npm run build
qwen extensions link "$PWD"
npm run build bundles the MCP server and its runtime dependencies into
dist/main.js. Publish only after that file is present and the provider's own
contract and security tests pass. Installing a released Extension must not need
to run npm install or an install script on the user's machine.
Keep the MCP call timeout longer than the adapter's Provider timeout. This example gives the Provider request 5000ms and Qwen's MCP call 8000ms so the adapter can return a stable, redacted error after aborting the request.