Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ Search prefers a name match over a title or description match and accepts camel

### Run the MCP catalog example

Run these commands in a new project. The package contains the example from version 0.0.2 onward.
Run these commands in a new project.

```sh
npm install @checkfu/integrations@0.0.2 @modelcontextprotocol/client@2.4.0
npm install @checkfu/integrations @modelcontextprotocol/client@2.4.0
node node_modules/@checkfu/integrations/examples/mcp-catalog.mjs
```

Expand All @@ -101,7 +101,7 @@ bun install --frozen-lockfile
bun run verify
```

Edit one YAML file per service or provider. Start with [Linear](catalog/services/linear.yaml) for an MCP connector or follow an existing file in [catalog/providers](catalog/providers). Keep the filename and `id` in sync. Runtime fields live alongside the imported `reference` metadata. After editing YAML, run `bun run generate`, then run `bun run verify` and commit the YAML and generated files together so anyone can install directly from Git.
Edit one YAML file per service or provider. Start with [Linear](catalog/services/linear.yaml) for an MCP connector or follow an existing file in [catalog/providers](catalog/providers). Keep the filename and `id` in sync. Set a runtime provider endpoint to `null` to use the corresponding base URL from `reference.speaks`. Give it a URL when the reference does not describe that route. After editing YAML, run `bun run generate`, then run `bun run verify` and commit the YAML and generated files together so anyone can install directly from Git.

`bun run verify` checks generated source, rebuilds the distribution, runs the type checker, and tests under Bun and Node.js. Use `bun run test` for a fresh build and the Bun suite. Use `bun run test:built` or `bun run test:node` after an explicit build to exercise the existing distribution. CI installs the release tarball in clean Node and Bun projects and checks the public types, the MCP example, and signed event verification.

Expand Down
2 changes: 1 addition & 1 deletion catalog/providers/anthropic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: anthropic
name: Anthropic
endpoints:
# The Messages client appends /v1/messages.
anthropic-messages: https://api.anthropic.com
anthropic-messages: null
auth:
kind: api_key_header
header: x-api-key
Expand Down
2 changes: 1 addition & 1 deletion catalog/providers/openai.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ format: 1
id: openai
name: OpenAI
endpoints:
openai-responses: https://api.openai.com/v1
openai-responses: null
auth:
kind: bearer
reference:
Expand Down
2 changes: 1 addition & 1 deletion catalog/providers/openrouter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: openrouter
name: OpenRouter
endpoints:
anthropic-messages: https://openrouter.ai/api
openai-completions: https://openrouter.ai/api/v1
openai-completions: null
auth:
kind: bearer
reference:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@checkfu/integrations",
"version": "0.0.2",
"version": "0.0.3",
"description": "Integration catalogs for Checkfu and other TypeScript and JavaScript hosts.",
"license": "MIT",
"type": "module",
Expand Down
17 changes: 14 additions & 3 deletions scripts/generate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@ function render(entries, folder, exportName, typeName, project) {
].join("\n"))
}

function runtimeProvider({ name, endpoints, auth, reference }) {
if (endpoints === undefined) return null
const routes = Object.entries(endpoints).map(([format, endpoint]) => {
if (endpoint !== null) return [format, endpoint]
const matches = reference?.speaks?.filter((route) => route.format === format) ?? []
if (matches.length !== 1 || typeof matches[0].base_url !== "string") {
throw new Error(`${name} must define one reference base URL for the ${format} endpoint`)
}
return [format, matches[0].base_url]
})
return { name, endpoints: Object.fromEntries(routes), auth }
}

function serviceCapabilities({ surfaces, reference }) {
const upstream = reference?.surfaces
const capabilities = []
Expand Down Expand Up @@ -100,9 +113,7 @@ function renderCatalog(providers, services, triggers) {
if (!check) await mkdir(output, { recursive: true })
const [providers, services, triggers] = await Promise.all(["providers", "services", "triggers"].map(readFolder))
await Promise.all([
render(providers, "providers", "providers", "ProviderDefinition", ({ reference, ...definition }) =>
definition.endpoints === undefined ? null : definition,
),
render(providers, "providers", "providers", "ProviderDefinition", runtimeProvider),
render(services, "services", "connectors", "ConnectorDefinition", ({ name, surfaces }) =>
surfaces?.mcp === undefined ? null : { name, mcp: surfaces.mcp },
),
Expand Down
Loading