@okdoc-ai/plugin-sdk
v1.13.8
Published
SDK for building OkDoc AI-powered plugins — MCP-aligned types, decorators, AI format converters, and iframe SDK.
Downloads
1,506
Maintainers
Readme
@okdoc-ai/plugin-sdk
SDK for building okDoc AI-powered plugins. Provides MCP-aligned types, decorators, AI format converters, and a standalone iframe SDK for creating plugins that integrate with the okDoc voice assistant.
Plugin types
| Type | Runtime | Best for |
|------|---------|----------|
| Iframe plugin | Standalone HTML page in an <iframe> | Third-party developers, any tech stack, full isolation |
| Remote plugin | Angular web component loaded at runtime | First-party / trusted plugins, deep host integration |
Quick start — Iframe plugin (no npm required)
Add a single <script> tag and declare your tools:
<script src="https://cdn.jsdelivr.net/gh/okDoc-ai/plugin-sdk/cdn/okdoc-iframe-sdk.js"></script>
<script>
const sdk = OkDocIframeSDK.create({
pluginId: 'my-plugin',
displayName: 'My Plugin',
tools: [
{
name: 'greet',
description: 'Say hello',
inputSchema: {
type: 'object',
properties: { name: { type: 'string', description: 'Name to greet' } },
required: ['name'],
},
handler: async ({ name }) => ({
content: [{ type: 'text', text: `Hello, ${name}!` }],
}),
},
],
});
</script>TypeScript support: Drop
okdoc-iframe-sdk-global.d.tsinto your project for full autocompletion.
See the full guide: DOCS/IframePluginGuide.md
Quick start — Remote plugin (Angular)
npm install @okdoc-ai/plugin-sdkimport { OkDocPlugin, McpTool } from '@okdoc-ai/plugin-sdk';
@OkDocPlugin({
pluginId: 'weather',
displayName: 'Weather Plugin',
version: '1.0.0',
})
class WeatherPlugin {
@McpTool({
name: 'get_weather',
description: 'Get the current weather for a city',
inputSchema: {
type: 'object',
properties: { city: { type: 'string', description: 'City name' } },
required: ['city'],
},
})
async getWeather({ city }: { city: string }) {
return { content: [{ type: 'text', text: `Weather in ${city}: Sunny, 25°C` }] };
}
}See the full guide: DOCS/RemotePluginGuide.md
Exports
| Import path | Purpose |
|-------------|---------|
| @okdoc-ai/plugin-sdk | Core types, decorators (@OkDocPlugin, @McpTool), metadata readers, registration |
| @okdoc-ai/plugin-sdk/angular | Angular integration (OkDocNotifier, OKDOC_NOTIFIER_TOKEN) |
| @okdoc-ai/plugin-sdk/handler | Host-side AI format converters (toGeminiFunctionDeclarations, toOpenAiFunctions) |
CDN / jsdelivr
The standalone iframe SDK is served via jsdelivr:
https://cdn.jsdelivr.net/gh/okDoc-ai/plugin-sdk@<version>/cdn/okdoc-iframe-sdk.jsReplace <version> with a specific tag (e.g. 1.0.0) or use semver ranges (@1, @1.0).
Documentation
| Guide | Description | |-------|-------------| | Iframe Plugin Guide | Build iframe plugins (any tech stack, no npm) | | Remote Plugin Guide | Build Angular remote plugins | | Sample Remote Component Guide | Step-by-step sample remote component | | Ionic Angular Project Setup | Host app project setup reference |
Building from source
npm install
npm run build:all # TypeScript compilation + iframe SDK bundleBuild outputs:
dist/— ES module library (main SDK)dist/okdoc-iframe-sdk.js— Standalone IIFE bundle for<script>tagscdn/— jsdelivr-ready copies of the iframe SDK files
Releasing
Use the interactive release script:
npm run release 1.2.0The script walks you through each step (version bump → build → commit → tag → push) with yes / skip / cancel prompts. On push, GitHub Actions creates the release automatically.
Telemetry
The iframe SDK reports anonymous plugin metadata (plugin name, version, tool names) to okDoc servers when a plugin is discovered by a host application. This helps us understand how the SDK and plugins are used in the ecosystem.
License
Apache License 2.0 — Copyright 2025 okDoc AI
