Creating a provider

An OpenCtx provider is just an HTTP server that implements the provider API and is available at any URL.

For convenience, you can also just bundle and publish a .js file that implements the simple @openctx/provider TypeScript API (as a default export):


import type { ItemsParams, ItemsResult, CapabilitiesParams, CapabilitiesResult, Provider } from '@openctx/provider'
export default {
capabilities(params: CapabilitiesParams): Promise<CapabilitiesResult> { /* ... */ }
items(params: ItemsParams): Promise<ItemsResult> { /* ... */ }
} satisfies Provider

Then use the URL (file:// or https://) to that .js file. This way, you don't need to deploy a public HTTP server for the provider. See the playground for examples.