feat(apps): add community connectors and contributor tools (#1019)

This commit is contained in:
Albert Alises authored and GitHub committed 2026-11-17 17:56:19 +01:00
1 parent 3a47f4de74
commit 54a6b509e1
61 files changed
+2791 -73

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
---
name: create-nod-app
description: Create or update a Nod app folder, its required synthetic contract fixture, and its public docs listing. Use for community or partner app contributions in the Nod repository.
---
Build the app in the Nod repository. Read `AGENTS.md` and `docs/src/content/docs/contribute/apps/index.md` first. Read the format, testing, and approval pages before editing a connection.
Use official provider documentation for the MCP address, authentication, scopes, required plan, and read-tool contract. Do not guess a server address or claim an API is MCP. State any required MCP server work before proceeding with an unsupported service.
Use `pnpm create:app <app-id> --name <display-name> --url <public-mcp-url> --auth <oauth2|bearer|x-api-key>` for a fixed server. Select the authentication method from the provider documentation. Use n8n's existing app folder as the source example for owner-supplied instances. Keep the app ID stable when changing an existing app.
Complete all generated fields. Put maintainer details in `plugin.json`, Nod settings in `io.n8n.nod/app.json`, and the read fixture in `io.n8n.nod/contract.json`. Keep the generated schema URLs and manifest reference. Add concrete prompts, requirements, and limits. Use the documented tool name and input schema. Keep credentials and private content out of files and prompts.
Keep changes in the app folder unless the shared runtime needs a new supported behavior. Do not change a schema, validator, or shared test to make an invalid app pass. Do not add a service-name branch to make a folder work. Do not weaken URL checks, Trust, credential removal, or account ownership checks.
Run `pnpm check:apps` and the relevant integration tests. Use only synthetic data and disposable database schemas. Report skipped checks. Never use a live model, saved account, or real recipient in automated tests.
The docs catalog and app page come from the manifest. Build the docs and inspect the app page and its `social.png` at desktop and mobile widths. Check the card text and image crop.
Provider acceptance is a separate maintainer step. Do not claim it passed from offline fixtures. Report the checks run, their results, supported scope, and the remaining provider acceptance work. AI output and passing tests do not grant approval. Do not push, publish, or post to social media without explicit authorization.
+1
View File
@@ -18,4 +18,5 @@
- [ ] New tests would catch a real regression ([test policy](https://github.com/n8n-io/nod/blob/main/AGENTS.md#tests)), or none are needed.
- [ ] No keys, credentials, real accounts, private conversations or other people's data in code, tests, fixtures, logs or screenshots.
- [ ] Docs are updated where setup or behaviour changed.
- [ ] For an app connector, I ran `pnpm check:apps`, included separate provider acceptance results, and completed the [app approval requirements](https://nod.n8n.io/docs/contribute/apps/approval/).
- [ ] Changes to approvals, the trust check, Vault, sign-in, the sandbox or owner isolation are called out in the summary.
+2
View File
@@ -153,6 +153,8 @@ jobs:
pids=()
(node --test .github/scripts/ci-scope.test.mjs && node .github/scripts/ci-scope.mjs --format) &
pids+=("$!")
pnpm run check:apps &
pids+=("$!")
if [[ "$NOD_CHECK_LINT" == true ]]; then
pnpm run lint &
pids+=("$!")
+2
View File
@@ -5,6 +5,7 @@ on:
branches: [main]
paths:
- 'docs/**'
- 'src/apps/**'
- 'public/fonts/Geist*'
- 'public/logos/**'
- 'src/shared/app-links.ts'
@@ -13,6 +14,7 @@ on:
pull_request:
paths:
- 'docs/**'
- 'src/apps/**'
- 'public/fonts/Geist*'
- 'public/logos/**'
- 'src/shared/app-links.ts'
+3 -1
View File
@@ -6,10 +6,12 @@ Everyone taking part follows the [code of conduct](CODE_OF_CONDUCT.md).
## Ways to help
- **Create an app connector.** Follow [Creating your own connectors](docs/src/content/docs/contribute/apps/index.md) for the format, AI builder skill, required tests, and approval process. Browse [custom connections](https://nod.n8n.io/docs/connect/community-apps/) for examples.
- **Report a bug** with the [bug report form](https://github.com/n8n-io/nod/issues/new/choose).
- **Ask a question or share an idea** in [Discussions](https://github.com/n8n-io/nod/discussions).
- **Report a vulnerability** privately, as described in the [security policy](SECURITY.md). Never in a public issue.
- **Send a pull request.** For anything larger than a small fix, open an issue or discussion first.
- **Send a pull request.** App-only contributions that use the supported profile follow the app guide. For other work larger than a small fix, open an issue or discussion first.
## Set up and check
+4
View File
@@ -8,3 +8,7 @@ GPL-3.0-or-later. Its source file src/providers/local-speech/phonemizer-worker.t
is distributed under GPL-3.0-or-later. See desktop/licenses/speech.md for component
attribution and corresponding source. Desktop builds include the license and
verified source archives under engine/licenses/speech.
Agent Plugins 1.0.0 JSON Schemas
Source: https://github.com/agentplugins/agent-plugins-spec
Schemas in src/server/agent-plugins/ are distributed under Apache-2.0.
+2
View File
@@ -277,6 +277,8 @@ See [Install from source](https://nod.n8n.io/docs/get-started/install-from-sourc
<p align="center">Nod is open source, from the team behind <a href="https://n8n.io">n8n</a>.<br />Read <a href="CONTRIBUTING.md">CONTRIBUTING</a> to send your first change.</p>
<p align="center"><a href="https://nod.n8n.io/docs/contribute/apps/">Creating your own connectors</a><br />Add an app folder, run the required tests, and submit a PR.<br />The guide includes an AI builder skill, approval requirements, and shareable app pages.<br /><a href="https://nod.n8n.io/docs/connect/community-apps/">Browse custom connections</a></p>
<p align="center">
<a href="https://github.com/n8n-io/nod/issues/new/choose">Report a bug</a> · <a href="https://github.com/n8n-io/nod/discussions">Share an idea</a> · <a href="https://discord.gg/n8n">Discord</a> · <a href="https://community.n8n.io/c/n8n-labs/48">Forum</a> · <a href="SECURITY.md">Security</a>
</p>
+11 -8
View File
@@ -10,13 +10,16 @@ pnpm --dir docs build
The dev server opens at `http://localhost:4321/docs/`. The build fails on a broken link.
| Path | What it holds |
| -------------------------- | ------------------------------------------------------------------------------------------------------ |
| `src/content/docs/` | Every page. The folder and file name make the URL. |
| `src/assets/` | Logos and screenshots, with synthetic data only. |
| `src/styles/theme.css` | The Nod theme, from the n8n brand palette. |
| `src/pages/waitlist.astro` | The waitlist page at `/waitlist/`. Sign-ups go to the waitlist workflow on n8n, then Customer.io. |
| `src/pages/next.astro` | The landing page at `/next/` and the root of nod.n8n.io, with `src/scripts/` and `src/styles/nod.css`. |
| `astro.config.mjs` | Sidebar sections, plugins and the site address. |
Start with [Creating your own connectors](src/content/docs/contribute/apps/index.md) to add an app. The [custom app catalog](src/content/docs/connect/community-apps.mdx) and shareable pages use the same app folders as Nod.
| Path | What it holds |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------ |
| `src/content/docs/` | Written guides and reference pages. The folder and file name make the URL. |
| `src/pages/connect/community-apps/` | App landing pages and social images generated from `src/apps/` in the repository root. |
| `src/assets/` | Logos and screenshots, with synthetic data only. |
| `src/styles/theme.css` | The Nod theme, from the n8n brand palette. |
| `src/pages/waitlist.astro` | The waitlist page at `/waitlist/`. Sign-ups go to the waitlist workflow on n8n, then Customer.io. |
| `src/pages/next.astro` | The landing page at `/next/` and the root of nod.n8n.io, with `src/scripts/` and `src/styles/nod.css`. |
| `astro.config.mjs` | Sidebar sections, plugins and the site address. |
Read [Write docs](src/content/docs/contribute/write-docs.mdx) for the house style, the page template, components and diagrams.
+1 -1
View File
@@ -69,7 +69,7 @@ export default defineConfig({
features: { smartPunctuation: false },
}),
},
vite: { server: { fs: { allow: ['.', '../public/fonts', '../public/logos'] } } },
vite: { server: { fs: { allow: ['.', '../public/fonts', '../public/logos', '../src/apps'] } } },
integrations: [
sitemap({
filter: (page) => !/\/docs\/(next|open)\/$/.test(page),
+182
View File
@@ -0,0 +1,182 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"$schema": {
"type": "string",
"const": "https://nod.n8n.io/docs/schemas/apps/v1/app.schema.json"
},
"displayName": {
"type": "string",
"minLength": 1,
"maxLength": 80,
"pattern": "^\\S(?:[\\s\\S]*\\S)?$"
},
"icon": {
"type": "string",
"pattern": "^\\.\\/io\\.n8n\\.nod\\/(?:[a-zA-Z0-9_-]+\\/)*[a-zA-Z0-9_-]+\\.(?:svg|png|webp)$"
},
"categories": {
"default": [],
"maxItems": 10,
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 50,
"pattern": "^\\S(?:[\\s\\S]*\\S)?$"
}
},
"prompts": {
"minItems": 2,
"maxItems": 4,
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 240,
"pattern": "^\\S(?:[\\s\\S]*\\S)?$"
}
},
"requirements": {
"minItems": 1,
"maxItems": 8,
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 300,
"pattern": "^\\S(?:[\\s\\S]*\\S)?$"
}
},
"limitations": {
"minItems": 1,
"maxItems": 8,
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 300,
"pattern": "^\\S(?:[\\s\\S]*\\S)?$"
}
},
"connection": {
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "mcp"
},
"server": {
"type": "string",
"minLength": 1,
"maxLength": 80,
"pattern": "^\\S(?:[\\s\\S]*\\S)?$"
},
"authentication": {
"type": "array",
"prefixItems": [
{
"type": "string",
"const": "oauth2"
}
],
"items": false,
"minItems": 1,
"maxItems": 1
},
"scopes": {
"maxItems": 30,
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 100,
"pattern": "^\\S(?:[\\s\\S]*\\S)?$"
}
}
},
"required": ["type", "server", "authentication"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "mcp"
},
"server": {
"type": "string",
"minLength": 1,
"maxLength": 80,
"pattern": "^\\S(?:[\\s\\S]*\\S)?$"
},
"authentication": {
"type": "array",
"prefixItems": [
{
"type": "string",
"enum": ["bearer", "x-api-key"]
}
],
"items": false,
"minItems": 1,
"maxItems": 1
}
},
"required": ["type", "server", "authentication"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "mcp"
},
"endpoint": {
"type": "object",
"properties": {
"source": {
"type": "string",
"const": "owner"
},
"path": {
"type": "string",
"pattern": "^\\/(?:[a-zA-Z0-9_-]+\\/)*[a-zA-Z0-9_-]+$"
}
},
"required": ["source", "path"],
"additionalProperties": false
},
"authentication": {
"type": "array",
"prefixItems": [
{
"type": "string",
"const": "oauth2"
},
{
"type": "string",
"const": "bearer"
}
],
"items": false,
"minItems": 2,
"maxItems": 2
}
},
"required": ["type", "endpoint", "authentication"],
"additionalProperties": false
}
]
}
},
"required": ["$schema", "displayName", "prompts", "requirements", "limitations", "connection"],
"additionalProperties": false,
"$id": "https://nod.n8n.io/docs/schemas/apps/v1/app.schema.json",
"title": "Nod app profile v1"
}
@@ -0,0 +1,175 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"$schema": {
"type": "string",
"const": "https://nod.n8n.io/docs/schemas/apps/v1/contract.schema.json"
},
"source": {
"allOf": [
{
"type": "string",
"format": "uri"
},
{
"type": "string",
"pattern": "^[hH][tT][tT][pP][sS]:\\/\\/"
}
]
},
"tool": {
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 100,
"pattern": "^(?!replace_)"
},
"description": {
"type": "string",
"minLength": 1,
"maxLength": 2000
},
"inputSchema": {
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "object"
}
},
"required": ["type"],
"additionalProperties": {
"$ref": "#/$defs/__schema0"
}
},
"annotations": {
"type": "object",
"properties": {
"readOnlyHint": {
"type": "boolean",
"const": true
}
},
"required": ["readOnlyHint"],
"additionalProperties": false
}
},
"required": ["name", "description", "inputSchema", "annotations"],
"additionalProperties": false
},
"input": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"$ref": "#/$defs/__schema1"
}
},
"output": {
"$ref": "#/$defs/__schema2"
}
},
"required": ["$schema", "source", "tool", "input", "output"],
"additionalProperties": false,
"$defs": {
"__schema0": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "null"
},
{
"type": "array",
"items": {
"$ref": "#/$defs/__schema0"
}
},
{
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"$ref": "#/$defs/__schema0"
}
}
]
},
"__schema1": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "null"
},
{
"type": "array",
"items": {
"$ref": "#/$defs/__schema1"
}
},
{
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"$ref": "#/$defs/__schema1"
}
}
]
},
"__schema2": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "null"
},
{
"type": "array",
"items": {
"$ref": "#/$defs/__schema2"
}
},
{
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"$ref": "#/$defs/__schema2"
}
}
]
}
},
"$id": "https://nod.n8n.io/docs/schemas/apps/v1/contract.schema.json",
"title": "Nod app contract fixture v1"
}
+27
View File
@@ -0,0 +1,27 @@
---
import { apps } from '../data/apps';
const base = import.meta.env.BASE_URL.replace(/\/$/, '');
---
<div class="app-catalog">
{apps.map((app) => (
<a class="app-entry" href={`${base}/connect/community-apps/${app.slug}/`}>
{app.icon && <img src={`${base}/connect/community-apps/${app.slug}/icon.png`} alt="" width="44" height="44" loading="lazy" />}
<div>
<strong>{app.name}</strong>
<p>{app.description}</p>
<span>{app.categories.join(' · ') || 'MCP app'} →</span>
</div>
</a>
))}
</div>
<style>
.app-catalog { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; margin-block: 1.5rem; }
.app-entry { display: flex; align-items: start; gap: 1rem; padding: 1.5rem; border: 1px solid var(--sl-color-gray-5); border-radius: .75rem; color: var(--sl-color-text); text-decoration: none; }
.app-entry:hover { border-color: var(--sl-color-accent); }
.app-entry img { flex: none; margin: 0; border-radius: .35rem; }
.app-entry strong { font-size: 1.2rem; color: var(--sl-color-white); }
.app-entry p { margin: .5rem 0 .9rem; font-size: .95rem; line-height: 1.5; }
.app-entry span { color: var(--sl-color-gray-2); font-size: .8rem; }
</style>
+2
View File
@@ -51,6 +51,8 @@ The trust check protects requests made through Nod. It cannot block someone who
## Connect your apps
Browse [custom connections](/connect/community-apps/) for apps that use their own MCP servers. To add a community or partner app, follow [Creating your own connectors](/contribute/apps/).
<Steps>
1. Open **Apps**, find an app and select **Connect**.
@@ -0,0 +1,30 @@
---
title: Custom apps for Nod
description: Browse Nod's custom app connections, setup requirements, example requests, and shareable app pages.
sidebar:
order: 5
---
import AppCatalog from '../../../components/app-catalog.astro';
Browse the custom app connections included in Nod.
These apps connect through their own MCP servers. Open an app page for setup requirements, example requests, limits, source files, and a social preview image.
<AppCatalog />
The catalog is generated from the same app folders that Nod loads. It lists shipped definitions and does not report live provider health.
## Add your app
Community contributors and partners use the same format and required tests. Add a folder, complete the checks, and submit a PR for maintainer review.
Start with [Build an app for Nod](/contribute/apps/), or use [the AI builder skill](/contribute/apps/build-with-ai/).
Composio supplies the wider app catalog in Nod. See [Connect apps](/connect/apps/) for those connections.
## Related resources
- [Connect apps](/connect/apps/)
- [MCP servers, APIs and CLIs](/connect/mcp-api-cli/)
- [Approval requirements](/contribute/apps/approval/)
@@ -7,6 +7,8 @@ sidebar:
Besides [Composio apps](/connect/apps/), Nod connects to Notion, Linear and n8n through their own MCP servers. For other services, it can set up an MCP server, an HTTP API or a command-line tool (CLI).
These built-in MCP apps use the same folder format as community apps. Browse their [app pages](/connect/community-apps/), or follow [Creating your own connectors](/contribute/apps/) to add one.
## Notion and Linear
Notion and Linear connect through their own hosted MCP servers, the same way as any [other MCP server](#connect-another-service). Open **Apps**, select **Connect** and sign in.
@@ -0,0 +1,54 @@
---
title: Get an app approved
description: The required evidence and maintainer review before an app connection ships with Nod.
sidebar:
order: 7
---
An app ships after its required tests pass and a maintainer approves the pull request.
Passing a schema check does not make a connection approved. An AI-generated folder has the same requirements as a hand-written contribution.
## Approval requirements
| Area | Required evidence |
| ----------------- | -------------------------------------------------------------------------------------------------- |
| Provider contract | Official documentation for the address, authentication, scopes, and read tool |
| Account setup | Separate provider acceptance for each advertised authentication method |
| Useful scope | Concrete example requests, account requirements, and honest limits |
| Required tests | Passing `pnpm check:apps` and the applicable integration checks |
| Privacy and Trust | No credentials in files; account bindings, normal Trust checks, and specific errors preserved |
| Recovery | Reconnect, disconnect, denied access, and expired or revoked credentials checked |
| Writes | Any advertised write checked with a reversible synthetic record; no automatic replay after failure |
| Public page | Correct name, icon rights, requirements, examples, limits, links, and social preview |
| Maintenance | A named maintainer and a way to report a provider change |
When the contributor supplies the MCP server, include its source or supported service documentation and its own test results. A Nod protocol fixture cannot prove that server's internal behavior.
## Submit the pull request
Include the app ID, provider documentation, required permissions, automated command results, and separate provider acceptance results. State what was not checked.
Use synthetic screenshots or a short recording when they help review setup. Keep acceptance artifacts outside the repository and attach only material suitable for public review.
A maintainer checks the file changes and the evidence. The maintainer can request a narrower scope or refuse unsupported authentication. Authors and AI tools cannot approve their own app by adding a manifest field.
Repository branch protection determines how GitHub enforces maintainer approval. The app validator does not grant review approval or change branch protection.
## What the public page means
The catalog lists app definitions included in Nod. It is not a live status page, certification, or provider endorsement. The page version identifies the app definition, not the provider's current health.
Approval applies to the reviewed scope and version. It does not guarantee future provider availability. Report broken setup or changed permissions through the linked app source.
## Maintain the connection
Run the required tests when an address, scope, authentication method, or fixture changes. Record new provider acceptance for changes that affect sign-in or supported work.
Keep existing app IDs stable so saved accounts keep their service binding. Explain migrations and any required reconnect. New permissions must go through the provider's consent flow.
## Related resources
- [Build an app for Nod](/contribute/apps/)
- [Test the app](/contribute/apps/test/)
- [Pull requests and releases](/contribute/pull-requests/)
@@ -0,0 +1,41 @@
---
title: Build an app with AI
description: Use the repository's Agent Skill and scaffold command to create and check a Nod app.
sidebar:
order: 8
---
Use the `create-nod-app` Agent Skill with the same scaffold and checks used by human contributors.
The skill lives at [`.agents/skills/create-nod-app/SKILL.md`](https://github.com/n8n-io/nod/blob/main/.agents/skills/create-nod-app/SKILL.md). It uses the open Agent Skills format.
## Start from the Nod repository
In an agent that discovers repository Agent Skills, ask:
```text
Use $create-nod-app to add an app for <service>.
Use the provider's official MCP documentation.
Scaffold the app, add synthetic contract data, and run the required checks.
Report provider checks separately from offline test results.
```
If the agent does not discover `.agents/skills`, ask it to read that `SKILL.md` path first. No provider key is needed to generate files or run the offline checks.
## What the skill does
The skill checks the supported interface, reads the provider's official contract, and runs `pnpm create:app`. It fills the manifest and required fixture, then runs `pnpm check:apps` and the relevant integration checks.
It also checks the generated public page and social preview. It reports missing provider acceptance instead of inventing a successful sign-in.
## Review the result
Check the server address, scopes, required account plan, fixture tool name, and example requests. Confirm the public page does not promise unsupported work.
AI output still needs the [approval review](/contribute/apps/approval/). The skill cannot grant permissions, create a provider OAuth application, or approve the contribution.
## Related resources
- [Build an app for Nod](/contribute/apps/)
- [Build your first app](/contribute/apps/build/)
- [Test the app](/contribute/apps/test/)
@@ -0,0 +1,92 @@
---
title: Build your first app
description: Scaffold a remote MCP app and complete the files needed for a contribution.
sidebar:
order: 4
---
Create an app folder with the scaffold command, then replace its unfinished fields.
## Generate the files
Replace the example address with the provider's real public MCP address. Then run this command from the repository root:
```sh
pnpm create:app my-app --name "My App" --url https://mcp.example.com/mcp --auth oauth2
```
The command rejects private, local, and reserved example addresses. It writes files only. It does not contact the provider or create a connection.
Set `--auth` to the provider's documented method: `oauth2`, `bearer`, or `x-api-key`. The command requires this choice.
```text
src/apps/my-app/
plugin.json
mcp.json
io.n8n.nod/
app.json
contract.json
```
The command refuses to replace an existing directory. The generated read-tool placeholder deliberately fails validation until you complete it.
## Complete the manifest
Set the maintainer, description, and version in `plugin.json`. Keep its Nod reference unchanged.
Edit `io.n8n.nod/app.json`:
1. Set the display name.
2. Add concrete example requests in `prompts`.
3. State account, plan, scope, and provider-version requirements.
4. State unsupported behavior in `limitations`.
5. Add OAuth scopes only when the provider requires them.
For an icon, add `io.n8n.nod/icon.svg` and set `icon` to `./io.n8n.nod/icon.svg`. PNG and WebP are also supported. Keep the image under 128 KB. Use letters, digits, underscores, or hyphens in asset names.
Keep the generated `$schema` values. Editors that support JSON Schema use them for field completion and error checks. CI uses the same definitions.
Do not put tokens, passwords, private server addresses, or customer data in these files.
## Complete the required fixture
Edit `io.n8n.nod/contract.json`. Set `source` to the provider documentation. Replace the read-tool name and input schema with the documented contract. Use invented IDs and content for `input` and `output`.
The fixture feeds a synthetic MCP server in the shared test framework. It does not connect to the real provider. See [Test the app](/contribute/apps/test/).
## Add a guide when needed
Use `skills/<app-id>/SKILL.md` for procedures the model cannot infer from the tool definitions. Keep required `name` and `description` frontmatter. Put detailed procedures in Markdown reference files.
App skills load with Nod's other guides. Skill names must be unique across the complete library. Credentials and permissions stay in the runtime.
## Check and preview
```sh
pnpm check:apps my-app
pnpm dev
```
Open **Apps** and find the new entry. Review setup without connecting a private account. Run the docs build and preview its catalog page:
Nod reads app definitions at startup. Restart the development server after changing an app folder.
```sh
pnpm --dir docs install --frozen-lockfile
pnpm --dir docs build
pnpm --dir docs preview
```
The page appears at `/docs/connect/community-apps/my-app/`. Its social image is `social.png` under that address.
## Use an instance address
Copy n8n's connection shape when users supply their own server address. Use an owner-supplied endpoint in the Nod extension and omit `mcp.json`. See [Format reference](/contribute/apps/format/).
Only n8n currently uses private or local instance addresses. A new app cannot enable private network access through its manifest.
## Related resources
- [Build an app for Nod](/contribute/apps/)
- [Format reference](/contribute/apps/format/)
- [Test the app](/contribute/apps/test/)
@@ -0,0 +1,139 @@
---
title: App format reference
description: The supported Agent Plugins fields, Nod extension, and mandatory contract fixture.
sidebar:
order: 5
---
Every shipped app must pass the Agent Plugins schemas and Nod's app profile.
## Standards used
| Standard | Purpose |
| ------------------------------------------------------------------------------ | ----------------------------------------------------------------- |
| [Agent Plugins 1.0.0](https://agent-plugins.org/specification) | Folder layout, manifest, MCP configuration, and client extensions |
| [Model Context Protocol](https://modelcontextprotocol.io/specification/latest) | Tool discovery, calls, responses, and OAuth setup |
| [Agent Skills](https://agentskills.io/specification) | Optional instructions and reference files |
| [Semantic Versioning](https://semver.org/) | App definition versions |
Nod adds display fields, private setup choices, required fixtures, and approval rules. A plugin for another client can use features outside this profile. Check this reference before copying a Codex or Claude plugin.
## Folder and package identity
Use `src/apps/<app-id>/plugin.json`. The folder and manifest `name` must match. Nod app IDs use two to 40 lowercase letters, digits, or single hyphens. Start with a letter and end with a letter or digit. Agent Plugins itself permits a broader name format.
Set `$schema` to `https://agent-plugins.org/schemas/1.0.0/plugin.schema.json`. Nod also requires a semantic `version` and a non-empty `description` of up to 1,000 characters.
Set `author.name` to the maintainer's public name or organization. Complete every generated placeholder before submission.
The standard root fields are `$schema`, `name`, `version`, `description`, `author`, `homepage`, `repository`, `license`, `keywords`, and `extensions`. Shipped app checks reject unknown root fields. Set the Nod extension to this fixed reference:
```json
{
"io.n8n.nod": { "app": "./io.n8n.nod/app.json" }
}
```
This object is the value of `extensions`. Nod settings live in `io.n8n.nod/app.json`. The standard manifest keeps its official `$schema` value.
The canonical schemas are bundled in `src/server/agent-plugins/`. The loader does not download schemas. Schema sources are the [manifest schema](https://agent-plugins.org/schemas/1.0.0/plugin.schema.json) and [MCP schema](https://agent-plugins.org/schemas/1.0.0/mcp.schema.json).
## Nod extension
The required `io.n8n.nod/app.json` starts with `"$schema": "https://nod.n8n.io/docs/schemas/apps/v1/app.schema.json"`.
The [app schema](https://nod.n8n.io/docs/schemas/apps/v1/app.schema.json) and [fixture schema](https://nod.n8n.io/docs/schemas/apps/v1/contract.schema.json) are versioned JSON Schema documents. Editors can read them directly. Their source is `src/shared/app-definitions.ts`, which also supplies TypeScript types and runtime validation.
| Field | Requirement |
| -------------- | -------------------------------------------------------------------- |
| `$schema` | Required app profile v1 schema URL |
| `displayName` | Required display name, up to 80 characters |
| `icon` | Optional path under `./io.n8n.nod/`; SVG, PNG, or WebP, up to 128 KB |
| `categories` | Optional array of up to 10 category names |
| `prompts` | Two to four concrete example requests |
| `requirements` | One to eight account, plan, scope, or version requirements |
| `limitations` | One to eight statements of unsupported or restricted behavior |
| `connection` | Required MCP connection definition |
Unknown fields and unsupported connection combinations fail validation. Other client extension namespaces keep their own meaning. A profile version change requires an explicit migration.
Text fields must contain visible text. Do not start or end them with whitespace.
The published schema files are generated. `pnpm check:apps` fails if they differ from their TypeScript source. Maintainers update them with `pnpm generate:app-schemas` when the profile changes.
## Fixed MCP address
Select one named server from `mcp.json`:
```json
{
"type": "mcp",
"server": "my-app",
"authentication": ["oauth2"],
"scopes": ["read"]
}
```
The `scopes` field is optional and is valid only with `oauth2`. Fixed connections select one authentication method: `oauth2`, `bearer`, or `x-api-key`. Nod sends API keys in `X-API-Key`.
`mcp.json` must target the matching Agent Plugins schema version. It must contain exactly one server with `type: "streamable-http"`. Its address must be public HTTPS without credentials, a query, or a fragment. DNS and network checks also run when Nod connects.
Static headers, stdio servers, and legacy SSE servers are outside the current Nod app profile. A schema-valid Agent Plugin can still use features Nod does not support.
## Owner-supplied instance
Use this connection shape and omit `mcp.json`:
```json
{
"type": "mcp",
"endpoint": {
"source": "owner",
"path": "/mcp-server/http"
},
"authentication": ["oauth2", "bearer"]
}
```
The path contains slash-separated letters, digits, underscores, and hyphens. Nod appends it to the address the user enters. Use the authentication tuple in the order shown. Fixed scopes are not supported for this setup.
Nod applies its address policy outside the manifest. Only n8n has the existing local-address exception and fixed localhost probe. Tokens go only to the saved address.
## Required contract fixture
Every folder includes `io.n8n.nod/contract.json`:
```json
{
"$schema": "https://nod.n8n.io/docs/schemas/apps/v1/contract.schema.json",
"source": "https://provider.example/docs/mcp",
"tool": {
"name": "find_records",
"description": "Find records by a query.",
"inputSchema": {
"type": "object",
"properties": { "query": { "type": "string" } },
"required": ["query"]
},
"annotations": { "readOnlyHint": true }
},
"input": { "query": "synthetic example" },
"output": { "records": [{ "id": "synthetic-record" }] }
}
```
Use a documented read tool. `input` must match its schema. `output` must contain synthetic JSON data. Objects, arrays, strings, numbers, booleans, and null are supported. The read-only hint describes the fixture; it does not bypass Trust.
The tool name must have one to 100 characters and must not start with `replace_`. The description must have one to 2,000 characters. Set `inputSchema.type` to `object`. The framework validates it as JSON Schema 2020-12. It then checks the sample input against every declared constraint, including patterns.
The fixture exercises Nod's MCP transport. It does not prove the external server still offers that tool. Provider acceptance remains a separate review requirement.
## Optional skills
Put each skill in `skills/<skill-name>/SKILL.md`, with Agent Skills frontmatter. Files must remain inside their skill directory after link resolution. The current loader supports Markdown guides and references. It does not install or execute skill scripts.
## Related resources
- [Build an app for Nod](/contribute/apps/)
- [Test the app](/contribute/apps/test/)
- [Agent Plugins specification](https://agent-plugins.org/specification)
@@ -0,0 +1,47 @@
---
title: Build an app for Nod
description: Create, test, and submit an app connection for Nod.
sidebar:
label: Overview
order: 2
---
Add an app folder, run the required checks, and submit a pull request.
This guide is for community contributors and partners. An app is a service listed in **Apps**. A connection is one account or instance of that service. Nod stores account credentials separately from the app files.
App folders use [Agent Plugins 1.0.0](https://agent-plugins.org/specification). The `io.n8n.nod` extension points to a settings file with Nod's display and setup fields. Versioned schemas, TypeScript types, runtime validation, and required checks share one source. The current format supports remote MCP servers and owner-supplied instance addresses. It does not execute package code or install dependencies.
## Before you start
- Set up a [source install](/get-started/install-from-source/).
- Learn the provider's MCP address, authentication methods, scopes, and limits.
- Find a documented read tool for the required synthetic fixture.
- Check the [app catalog](/connect/community-apps/) for an existing app entry.
You do not need to write TypeScript for a supported MCP connection. A service without MCP needs an MCP server before it can use this format.
App-only contributions that use this profile can start with a folder and a PR. If the app needs a Nod runtime change, open an issue or discussion before you implement that change.
## Build and submit
| Step | Guide |
| ----------------------------------- | ------------------------------------------------- |
| Choose the access method and scope | [Plan the app](/contribute/apps/plan/) |
| Generate and complete an app folder | [Build your first app](/contribute/apps/build/) |
| Check every field | [Format reference](/contribute/apps/format/) |
| Run the required offline checks | [Test the app](/contribute/apps/test/) |
| Meet the review requirements | [Get an app approved](/contribute/apps/approval/) |
| Use an AI coding agent | [Build with AI](/contribute/apps/build-with-ai/) |
## What a contribution creates
The folder supplies the app card and connection setup. The same metadata supplies a public docs page and a social preview image. The docs build adds the app to the catalog automatically.
Nod's n8n, Linear, and Notion folders are working source examples. They use the same loader and checks as community contributions.
## Related resources
- [Contribute to Nod](/contribute/)
- [Browse custom apps](/connect/community-apps/)
- [MCP servers, APIs and CLIs](/connect/mcp-api-cli/)
@@ -0,0 +1,50 @@
---
title: Plan the app
description: Choose a supported connection method and define the app's scope before you build it.
sidebar:
order: 3
---
Use the provider's supported remote MCP server when one exists.
## Check the connection method
| Provider interface | Current app format |
| ------------------------------------- | ----------------------------------------------- |
| Fixed public HTTPS MCP address | Supported through `mcp.json` |
| Owner-supplied HTTPS instance address | Supported through the Nod setup extension |
| Local n8n instance | Supported through n8n's existing address checks |
| REST, GraphQL, or SDK without MCP | Supply an MCP server first |
| Local stdio server or MCPB package | Requires additional runtime support |
Other Agent Plugins clients can support more transports. Nod checks its narrower app profile before a contribution can ship.
## Define the scope
Write down the service, users, accounts, and operations the app supports. One folder describes one service. The first version uses one fixed server or one instance setup.
Choose the smallest useful OAuth scopes. Explain any write scope. Identify paid-plan requirements, administrator restrictions, and version requirements. Check whether a disconnected or revoked account can reconnect.
Check OAuth registration and consent with Nod itself. Another client's working configuration does not prove that Nod supports the same setup. Add runtime support and tests before advertising a method the app profile cannot express.
Use a separate account for each identity. Do not make the model select or handle credentials. Nod's private setup owns credential entry and storage.
## Check the server
Confirm the exact address from provider documentation. A website home page, legacy SSE endpoint, or API root is not necessarily an MCP endpoint.
Check the server's tool names and schemas. Select one read tool for the contract fixture. Include required inputs and a synthetic response. Do not copy an account's private records into the repository.
MCP tool descriptions and read-only hints do not grant permission. Nod keeps its normal Trust checks for every app call.
## Plan the public page
Choose two to four useful example requests. State account requirements and limits. Keep these examples within the access the server actually provides.
Do not describe event monitoring, email checks, or automatic work as supported unless the connection implements the required change signals.
## Related resources
- [Build an app for Nod](/contribute/apps/)
- [Build your first app](/contribute/apps/build/)
- [Approval requirements](/contribute/apps/approval/)
@@ -0,0 +1,80 @@
---
title: Test the app
description: Required automated checks, synthetic fixtures, and separate provider acceptance for every app.
sidebar:
order: 6
---
Every app must include a contract fixture and pass the shared offline test framework.
## Run the required command
```sh
pnpm check:apps
```
To exercise one app's protocol fixture, run:
```sh
pnpm check:apps my-app
```
All folders still pass format validation before that selected fixture runs. This prevents a second broken folder from entering a release.
The command runs from `pnpm check` and always runs in the required CI workflow. Application integration tests also exercise every shipped app. App JSON changes select the full integration suite in CI.
## What the framework checks
| Check | Failure caught |
| -------------------------------- | ---------------------------------------------------------------------------------------------------- |
| Standard schemas and Nod profile | Misspelled fields, missing fixtures, unsupported transports, and incomplete setup |
| Shared typed contract | Wrong types, unknown fields, invalid authentication combinations, and stale generated editor schemas |
| Tool schema validation | Invalid JSON Schema 2020-12 and sample inputs that violate its constraints |
| Package path checks | Files or links that leave their app directory |
| Shared skill loading | Invalid metadata, duplicate skill names, and invalid references |
| MCP discovery | A read tool that is lost during protocol negotiation |
| Authentication headers | A token sent with the wrong scheme or to a different endpoint |
| Read request and response | Changed arguments or damaged structured data |
| Provider and tool failures | A specific reason that is lost or converted into success |
| Permission and rate failures | A failed call that is sent more than once |
| Stop before dispatch | A cancelled call that reaches the provider |
The shared integration suite covers private setup, OAuth completion, account ownership, revoked access, credential removal, and Trust. Contributors must extend it when a new setup behavior requires a new branch.
## Keep the fixture useful
Use the provider's documented tool name, required input fields, and realistic response shape. Add its documentation URL in `source`. Replace private IDs, names, URLs, and content with synthetic values.
Do not add a test that asserts only that the manifest equals itself. Test requests, saved account bindings, failure handling, or another observable connection contract.
The framework supplies the fake MCP responses. It runs the real Nod transport and MCP client against them. No automated test may contact a live model, connected account, or real recipient.
## Run wider checks when needed
```sh
pnpm exec tsx --test tests/integrations.test.ts
pnpm --dir docs build
```
Database cases need `TEST_DATABASE_URL` for a disposable PostgreSQL fixture. Without it, those cases are skipped. The repository's Linux integration runner creates isolated fixtures and treats skipped cases as failures.
For a runtime change, run the relevant integration cases with that fixture or use `pnpm test:integration`. Never point tests at your normal local database.
Review the app page at desktop and mobile widths. Open its `social.png` image and check the title, logo, description, and crop.
## Provider acceptance is separate
Offline tests cannot establish whether an external server is available or its OAuth application is configured correctly.
Before approval, record a separate provider acceptance check with a disposable account and synthetic content. Check sign-in, a known read, reconnect, and disconnect. Check every advertised authentication method. Confirm denied access produces a useful reason.
For write support, use a reversible synthetic record in that disposable account. Verify the result and clean it up. Do not contact real recipients. Keep this work outside automated tests and obtain the account operator's authorization.
Record the provider version when available, the date, the methods checked, and any limits in the PR. Keep credentials and private content out of the evidence.
## Related resources
- [Build an app for Nod](/contribute/apps/)
- [Format reference](/contribute/apps/format/)
- [Approval requirements](/contribute/apps/approval/)
- [Checks and tests](/contribute/checks-and-tests/)
@@ -31,6 +31,8 @@ pnpm exec tsx --test tests/approvals.test.ts
## Available application checks
App connector changes must pass `pnpm check:apps`. The required CI workflow always runs this command. See [Test the app](/contribute/apps/test/) for fixtures and separate provider acceptance.
Use these commands when needed to verify an application change. They are not a condition for opening every pull request.
```sh title="Terminal"
+9 -7
View File
@@ -14,14 +14,16 @@ Everyone taking part follows the [code of conduct](https://github.com/n8n-io/nod
## Ways to help
| You want to | Do this |
| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| Report a bug | Fill in the [bug report form](https://github.com/n8n-io/nod/issues/new/choose). |
| Ask a question or share an idea | Start a thread in [Discussions](https://github.com/n8n-io/nod/discussions). |
| Report a vulnerability | [Report it privately](https://github.com/n8n-io/nod/security/advisories/new). Never in a public issue. |
| Fix or build something | Send a [pull request](/contribute/pull-requests/). For anything larger than a small fix, open an issue or discussion first. |
To add an app connection, start with [Creating your own connectors](/contribute/apps/). The guide covers the format, scaffold, AI skill, required tests, and approval process.
Agreeing on the approach first saves you from building something that can't merge.
| You want to | Do this |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Report a bug | Fill in the [bug report form](https://github.com/n8n-io/nod/issues/new/choose). |
| Ask a question or share an idea | Start a thread in [Discussions](https://github.com/n8n-io/nod/discussions). |
| Report a vulnerability | [Report it privately](https://github.com/n8n-io/nod/security/advisories/new). Never in a public issue. |
| Fix or build something | Send a [pull request](/contribute/pull-requests/). Use the [app guide](/contribute/apps/) for app folders. Open an issue or discussion first for other work larger than a small fix. |
App-only contributions that use the supported profile follow the [app guide](/contribute/apps/). Other work larger than a small fix starts with an issue or discussion. Agreeing on the approach first saves you from building something that can't merge.
## Set up a development copy
@@ -159,7 +159,7 @@ When the connection service refuses a file for an app, the error shows its HTTP
- For `tool_account_mismatch`, pick the account that belongs to that app.
- For other reasons, try again later.
If it keeps failing, [send feedback with a diagnostic report](/deploy/troubleshooting/#send-feedback-with-a-diagnostic-report).
If it keeps failing, [report a bug with a diagnostic report](/deploy/troubleshooting/#report-a-bug-with-a-diagnostic-report).
### App sign-in opens an unreachable address on a remote server
@@ -69,6 +69,7 @@ For calendar plans, Pi uses availability tools when available and code for durat
<FileTree>
- src/
- apps/ app definitions, required contract fixtures, icons, and optional guides
- ports/ capabilities as interfaces, without vendor types
- providers/ vendor SDKs and protocols, such as Pi, Docker, agent-browser and Composio
- runtime/ the agent's tools, prompts and turn loop
+4 -2
View File
@@ -30,7 +30,7 @@ The connected apps, schedules and watches, artifacts, and video links guides use
## The task guides
The library has 27 task guides in [`src/runtime/skills`](https://github.com/n8n-io/nod/tree/main/src/runtime/skills).
The library combines task guides in [`src/runtime/skills`](https://github.com/n8n-io/nod/tree/main/src/runtime/skills) with app guides in [`src/apps`](https://github.com/n8n-io/nod/tree/main/src/apps). The table includes both sources. The n8n guide lives with its app definition.
| Home and life | Work | Mail, files and research |
| ------------------------- | ----------------------- | ------------------------ |
@@ -60,6 +60,8 @@ The system prompt tells the model to pick a guide by the task's purpose, the use
## Add or change a guide
For an app-specific guide, use `src/apps/<app-id>/skills/<name>/SKILL.md`. See [Build an app for Nod](/contribute/apps/). General task guides use the path below.
1. Create `src/runtime/skills/<name>/SKILL.md`, using a lowercase name with hyphens.
2. Add front matter with `name`, which must match the folder, and `description`, which says when the model must use the guide.
3. In the body, write the task decisions, the failure cases and the evidence needed to check the result.
@@ -78,7 +80,7 @@ Restart after you change the catalog or any metadata. Task guide bodies and refe
## File and permission limits
The library reads only its own folder in the server source tree. Pi's default skill discovery is off, so it never searches the workspace, the home folder, `.pi` folders or connected accounts.
The library reads only the task-guide folder and the app-guide folders loaded from the server source tree. Pi's default skill discovery is off. It never searches the workspace, the home folder, `.pi` folders, or connected accounts.
- Hidden folders and folder symlinks are ignored.
- Each read must stay inside the selected skill folder after the real path is resolved.
+49
View File
@@ -0,0 +1,49 @@
import type {
AppManifest,
AppDefinitionInput,
AppContract,
} from '../../../src/shared/app-definitions';
const manifests = import.meta.glob<AppManifest>('../../../src/apps/*/plugin.json', {
eager: true,
import: 'default',
});
const definitions = import.meta.glob<AppDefinitionInput>(
'../../../src/apps/*/io.n8n.nod/app.json',
{
eager: true,
import: 'default',
},
);
const contracts = import.meta.glob<AppContract>('../../../src/apps/*/io.n8n.nod/contract.json', {
eager: true,
import: 'default',
});
const icons = import.meta.glob<string>('../../../src/apps/*/io.n8n.nod/**/*.{svg,png,webp}', {
eager: true,
query: '?url&inline',
import: 'default',
});
export const apps = Object.entries(manifests)
.map(([path, manifest]) => {
const directory = path.slice(0, -'plugin.json'.length);
const details = definitions[`${directory}io.n8n.nod/app.json`];
const contract = contracts[`${directory}io.n8n.nod/contract.json`];
return {
slug: manifest.name,
name: details.displayName,
description: manifest.description,
version: manifest.version,
author: manifest.author.name,
categories: details.categories ?? [],
prompts: details.prompts,
requirements: details.requirements,
limitations: details.limitations,
authentication: details.connection.authentication,
instance: 'endpoint' in details.connection,
source: contract.source,
icon: details.icon ? icons[directory + details.icon.replace(/^\.\//, '')] : undefined,
};
})
.sort((a, b) => a.name.localeCompare(b.name));
@@ -0,0 +1,73 @@
---
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
import { apps } from '../../../data/apps';
export function getStaticPaths() {
return apps.map((app) => ({ params: { app: app.slug }, props: { app } }));
}
const { app } = Astro.props;
const base = import.meta.env.BASE_URL.replace(/\/$/, '');
const path = `${base}/connect/community-apps/${app.slug}/`;
const url = new URL(path, Astro.site).href;
const image = new URL(`${path}social.png`, Astro.site).href;
const share = `Use ${app.name} with Nod. ${app.description}`;
const headings = [
['try-asking-nod', 'Try asking Nod'], ['connect', `Connect ${app.name}`],
['requirements', 'Requirements'], ['limits', 'Limits'], ['share', 'Share this app'],
['source-and-checks', 'Source and checks'],
].map(([slug, text]) => ({ depth: 2, slug, text }));
const head = [
{ tag: 'meta', attrs: { property: 'og:image', content: image } },
{ tag: 'meta', attrs: { property: 'og:image:width', content: '1200' } },
{ tag: 'meta', attrs: { property: 'og:image:height', content: '630' } },
{ tag: 'meta', attrs: { property: 'og:image:alt', content: `${app.name} app for Nod` } },
{ tag: 'meta', attrs: { name: 'twitter:card', content: 'summary_large_image' } },
{ tag: 'meta', attrs: { name: 'twitter:image', content: image } },
] as const;
---
<StarlightPage frontmatter={{ title: `${app.name} app for Nod`, description: app.description, head: [...head] }} headings={headings}>
<div class="app-intro">
{app.icon && <img src={`${path}icon.png`} alt="" width="72" height="72" />}
<p>{app.description}</p>
</div>
<p>Included in Nod{app.categories.length ? ` · ${app.categories.join(' · ')}` : ''}</p>
<h2 id="try-asking-nod">Try asking Nod</h2>
<ul>{app.prompts.map((prompt) => <li>{prompt}</li>)}</ul>
<h2 id="connect">Connect {app.name}</h2>
<ol>
<li>Open <strong>Apps</strong> in Nod and select <strong>Connect</strong> on {app.name}.</li>
{app.instance && <li>Enter your {app.name} instance address.</li>}
<li>Complete the private connection setup and review the access you grant.</li>
<li>Return to Nod and ask it to read a record you can access.</li>
</ol>
<p>Authentication: {app.authentication.map((method) => method === 'oauth2' ? 'OAuth browser sign-in' : method === 'bearer' ? 'access token' : 'API key').join(' or ')}.</p>
<h2 id="requirements">Requirements</h2>
<ul>{app.requirements.map((item) => <li>{item}</li>)}</ul>
<h2 id="limits">Limits</h2>
<ul>{app.limitations.map((item) => <li>{item}</li>)}</ul>
<p>Nod checks each app call through Trust. App permissions still limit what the connection can do.</p>
<h2 id="share">Share this app</h2>
<p>Share <a href={url}>this page</a> or <a href={`${path}social.png`} download={`${app.slug}-nod.png`}>download the social preview image</a>.</p>
<p class="app-links">
<a href={`https://twitter.com/intent/tweet?${new URLSearchParams({ text: share, url })}`} target="_blank" rel="noopener noreferrer">Share on X</a>
<a href={`https://www.linkedin.com/sharing/share-offsite/?${new URLSearchParams({ url })}`} target="_blank" rel="noopener noreferrer">Share on LinkedIn</a>
</p>
<h2 id="source-and-checks">Source and checks</h2>
<p>App definition version {app.version}. This listing comes from the app folder shipped with Nod. It does not report a live provider health check.</p>
<ul>
<li><a href={app.source}>Provider documentation</a></li>
<li><a href={`https://github.com/n8n-io/nod/tree/main/src/apps/${app.slug}`}>App files and required test fixture</a></li>
<li><a href={`${base}/contribute/apps/approval/`}>Approval requirements</a></li>
<li><a href={`${base}/contribute/apps/`}>Build an app for Nod</a></li>
<li><a href={`${base}/connect/community-apps/`}>Browse custom apps</a></li>
</ul>
</StarlightPage>
<style>
.app-intro { display: flex; align-items: center; gap: 1.5rem; margin-block: 1rem 1.5rem; }
.app-intro img { flex: none; margin: 0; border-radius: .5rem; }
.app-intro p { margin: 0; font-size: 1.2rem; line-height: 1.5; }
.app-links { display: flex; flex-wrap: wrap; gap: 1.5rem; }
</style>
@@ -0,0 +1,45 @@
import type { APIRoute } from 'astro';
import sharp from 'sharp';
import { apps } from '../../../../data/apps';
export function getStaticPaths() {
return apps.flatMap((app) =>
['icon.png', 'social.png'].map((asset) => ({ params: { app: app.slug, asset } })),
);
}
const escape = (text: string) =>
text.replace(
/[<>&"']/g,
(value) => ({ '<': '&lt;', '>': '&gt;', '&': '&amp;', '"': '&quot;', "'": '&apos;' })[value]!,
);
export const GET: APIRoute = async ({ params }) => {
const app = apps.find((app) => app.slug === params.app)!;
const icon = app.icon
? await sharp(
app.icon.slice(0, app.icon.indexOf(',')).endsWith(';base64')
? Buffer.from(app.icon.slice(app.icon.indexOf(',') + 1), 'base64')
: Buffer.from(decodeURIComponent(app.icon.slice(app.icon.indexOf(',') + 1))),
)
.resize(120, 120, { fit: 'contain' })
.png()
.toBuffer()
: undefined;
if (params.asset === 'icon.png')
return new Response(
new Uint8Array(
icon ??
(await sharp({ create: { width: 120, height: 120, channels: 4, background: '#ff91ac' } })
.png()
.toBuffer()),
),
{ headers: { 'Content-Type': 'image/png' } },
);
const lines = app.description.match(/.{1,58}(?:\s|$)|.{1,58}/g)?.slice(0, 3) ?? [
app.description.slice(0, 58),
];
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="630"><rect width="1200" height="630" fill="#191919"/><rect x="56" y="56" width="1088" height="518" rx="24" fill="#242424" stroke="#464646"/><text x="100" y="124" font-family="Arial,sans-serif" font-size="23" letter-spacing="4" fill="#ff91ac">NOD / APPS</text>${icon ? `<rect x="990" y="94" width="108" height="108" rx="20" fill="#fafafa"/><image x="1004" y="108" width="80" height="80" href="data:image/png;base64,${icon.toString('base64')}"/>` : ''}<text x="100" y="282" font-family="Arial,sans-serif" font-size="${app.name.length > 20 ? 50 : 70}" font-weight="700" fill="#fafafa">${escape(app.name.slice(0, 32))}</text>${lines.map((line, index) => `<text x="100" y="${352 + index * 38}" font-family="Arial,sans-serif" font-size="27" fill="#bfbfbf">${escape(line.trim())}</text>`).join('')}<text x="100" y="526" font-family="Arial,sans-serif" font-size="22" fill="#ff91ac">Your apps. Your assistant.</text><text x="1096" y="526" text-anchor="end" font-family="Arial,sans-serif" font-size="20" fill="#bfbfbf">nod.n8n.io</text></svg>`;
const bytes = await sharp(Buffer.from(svg)).png().toBuffer();
return new Response(new Uint8Array(bytes), { headers: { 'Content-Type': 'image/png' } });
};
+5 -2
View File
@@ -18,8 +18,10 @@
"desktop:windows:build": "node desktop/scripts/build-windows.mjs",
"desktop:test": "pnpm --dir desktop test",
"build": "pnpm run typecheck && vite build && node desktop/scripts/build-ui.mjs",
"check": "pnpm run typecheck && pnpm run lint && pnpm run format:check",
"check": "pnpm run check:apps && pnpm run typecheck && pnpm run lint && pnpm run format:check",
"lint": "oxlint && node scripts/check-architecture.mjs",
"create:app": "tsx scripts/create-app.ts",
"check:apps": "tsx scripts/check-apps.ts",
"test": "tsx --test tests/*.test.ts",
"start": "node scripts/start.mjs --production",
"test:integration": "node scripts/test-integration.mjs",
@@ -27,7 +29,8 @@
"format:check": "prettier --check .",
"eval:voice": "tsx scripts/voice-eval.ts",
"eval:capability": "tsx evals/src/cli.ts",
"typecheck": "bun check --no-script"
"typecheck": "bun check --no-script",
"generate:app-schemas": "tsx scripts/app-schemas.ts"
},
"dependencies": {
"@1password/sdk": "0.5.0",
+34
View File
@@ -0,0 +1,34 @@
import { mkdir, writeFile } from 'node:fs/promises';
import { fileURLToPath } from 'node:url';
import { join } from 'node:path';
import { z } from 'zod';
import {
appDefinitionSchema,
appContractSchema,
appSchemaId,
appContractSchemaId,
} from '../src/shared/app-definitions.ts';
export const appSchemaFiles = {
'app.schema.json': {
...z.toJSONSchema(appDefinitionSchema, { io: 'input' }),
$id: appSchemaId,
title: 'Nod app profile v1',
},
'contract.schema.json': {
...z.toJSONSchema(appContractSchema, { io: 'input' }),
$id: appContractSchemaId,
title: 'Nod app contract fixture v1',
},
};
export const appSchemaDirectory = fileURLToPath(
new URL('../docs/public/schemas/apps/v1/', import.meta.url),
);
if (import.meta.main) {
await mkdir(appSchemaDirectory, { recursive: true });
for (const [name, schema] of Object.entries(appSchemaFiles))
await writeFile(join(appSchemaDirectory, name), `${JSON.stringify(schema, null, 2)}\n`);
console.log('Updated the Nod app v1 schemas.');
}
+153
View File
@@ -0,0 +1,153 @@
import assert from 'node:assert/strict';
import { Compile } from 'typebox/compile';
import { bundledApps, type BundledApp } from '../src/server/app-catalog.ts';
import { createDiscoveredTransport } from '../src/providers/discovered/remote.ts';
import { createSkillLibrary } from '../src/providers/pi/skills.ts';
import { coreSkills } from '../src/runtime/prompt.ts';
import { fileURLToPath } from 'node:url';
import { posix } from 'node:path';
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { appSchemaDirectory, appSchemaFiles } from './app-schemas.ts';
import { Meta } from 'typebox/schema';
const schemaCheck = Compile(Meta['https://json-schema.org/draft/2020-12/schema']);
export async function checkAppContract(app: BundledApp) {
const { contract } = app;
const schema = contract.tool.inputSchema;
assert.equal(schema.type, 'object', `${app.slug}: the read tool needs an object input schema.`);
assert(
schemaCheck.Check(schema),
`${app.slug}: the tool schema is not valid JSON Schema 2020-12.`,
);
assert(
Compile(schema as Parameters<typeof Compile>[0]).Check(contract.input),
`${app.slug}: the sample input does not match the tool schema.`,
);
const endpoint = app.endpoint ?? `https://instance.example.test${app.instancePath}`;
const credential = 'synthetic-app-contract-token';
const headers: Record<string, string> =
app.auth === 'x-api-key'
? { 'X-API-Key': credential }
: { Authorization: `Bearer ${credential}` };
let failure: 'tool' | 'permission' | 'rate' | undefined;
let calls = 0;
const transport = createDiscoveredTransport(
async (input, init) => {
const request = new Request(input, init);
assert.equal(request.url, endpoint, `${app.slug}: a request left the configured endpoint.`);
assert.equal(
request.headers.get(app.auth === 'x-api-key' ? 'x-api-key' : 'authorization'),
app.auth === 'x-api-key' ? credential : `Bearer ${credential}`,
);
if (request.method === 'GET') return new Response(null, { status: 405 });
if (request.method === 'DELETE') return new Response(null, { status: 200 });
const message = JSON.parse(await request.text());
if (message.id === undefined) return new Response(null, { status: 202 });
if (message.method === 'tools/call') {
calls++;
assert.equal(message.params.name, contract.tool.name);
assert.deepEqual(message.params.arguments, contract.input);
if (failure === 'permission' || failure === 'rate')
return Response.json(
{
error:
failure === 'permission' ? 'synthetic_permission_denied' : 'synthetic_rate_limit',
},
{ status: failure === 'permission' ? 403 : 429 },
);
}
let result;
if (message.method === 'initialize')
result = {
protocolVersion: message.params.protocolVersion,
capabilities: { tools: {} },
serverInfo: { name: `synthetic-${app.slug}`, version: '1.0.0' },
};
else if (message.method === 'tools/list') result = { tools: [contract.tool] };
else {
assert.equal(message.method, 'tools/call');
result =
failure === 'tool'
? { isError: true, content: [{ type: 'text', text: 'synthetic_record_unavailable' }] }
: { content: [{ type: 'text', text: JSON.stringify(contract.output) }] };
}
return Response.json({ jsonrpc: '2.0', id: message.id, result });
},
async (value) => {
assert.equal(value, endpoint);
return value;
},
);
const listed = await transport.listTools(endpoint, headers);
assert(
listed.tools.some((tool) => tool.name === contract.tool.name),
`${app.slug}: the read tool was not discovered.`,
);
const result = (await transport.callTool(
endpoint,
headers,
contract.tool.name,
contract.input,
)) as { content: Array<{ text: string }> };
assert.deepEqual(JSON.parse(result.content[0].text), contract.output);
for (const mode of ['tool', 'permission', 'rate'] as const) {
failure = mode;
const before = calls;
await assert.rejects(
transport.callTool(endpoint, headers, contract.tool.name, contract.input),
mode === 'tool'
? /synthetic_record_unavailable/
: mode === 'permission'
? /synthetic_permission_denied/
: /synthetic_rate_limit/,
);
assert.equal(calls, before + 1, `${app.slug}: a failed call was sent more than once.`);
}
const stopped = new AbortController();
stopped.abort(new Error('synthetic_stop'));
const before = calls;
await assert.rejects(
transport.callTool(endpoint, headers, contract.tool.name, contract.input, stopped.signal),
/synthetic_stop/,
);
assert.equal(calls, before, `${app.slug}: a stopped call reached the provider.`);
}
if (import.meta.main) {
for (const [name, schema] of Object.entries(appSchemaFiles))
assert.deepEqual(
JSON.parse(readFileSync(join(appSchemaDirectory, name), 'utf8')),
schema,
`The ${name} schema changed. Run pnpm generate:app-schemas.`,
);
const selected = process.argv[2];
const apps = selected ? [bundledApps.get(selected)] : [...bundledApps.values()];
if (apps.some((app) => !app)) throw new Error(`App ${selected} was not found.`);
const library = createSkillLibrary(
[
fileURLToPath(new URL('../src/runtime/skills/', import.meta.url)),
...[...bundledApps.values()].flatMap((app) => (app.skills ? [app.skills] : [])),
],
coreSkills,
);
for (const name of [...coreSkills, ...library.catalog.map((skill) => skill.name)]) {
const pending = ['SKILL.md'];
const checked = new Set<string>();
while (pending.length) {
const path = pending.pop()!;
if (checked.has(path)) continue;
checked.add(path);
const { content } = library.read(name, path);
for (const match of content.matchAll(/\[[^\]]*\]\(([^)\s]+\.md(?:#[^)\s]*)?)\)/g)) {
if (/^[a-z]+:|^\//i.test(match[1])) continue;
pending.push(posix.join(posix.dirname(path), decodeURIComponent(match[1].split('#')[0])));
}
}
}
for (const app of apps as BundledApp[]) {
await checkAppContract(app);
console.log(`${app.slug}: format, discovery, read, errors, rate limit, and Stop passed.`);
}
}
+122
View File
@@ -0,0 +1,122 @@
import { mkdir, writeFile } from 'node:fs/promises';
import { resolve, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { parseArgs } from 'node:util';
import { isIP } from 'node:net';
import {
appConnectionSchema,
appSchemaId,
appContractSchemaId,
type AppDefinitionInput,
type AppManifest,
type AppMcpConfig,
type AppContract,
} from '../src/shared/app-definitions.ts';
export async function createApp(
slug: string,
options: { url: string; name?: string; auth: string; directory?: string },
) {
if (!/^[a-z][a-z0-9-]{0,38}[a-z0-9]$/.test(slug) || /--/.test(slug))
throw new Error(
'Use two to 40 lowercase letters, digits, or single hyphens. Start with a letter and end with a letter or digit.',
);
const url = URL.parse(options.url);
if (
!url ||
url.protocol !== 'https:' ||
url.username ||
url.password ||
/[?#]/.test(options.url) ||
isIP(url.hostname.replace(/^\[|\]$/g, '')) ||
/(?:^|\.)(?:localhost|local|internal|invalid|test|example|example\.(?:com|org|net))$/.test(
url.hostname.replace(/\.$/, ''),
)
)
throw new Error(
'Enter the public HTTPS MCP address without credentials, a query, or a fragment.',
);
const connection = appConnectionSchema.safeParse({
type: 'mcp',
server: slug,
authentication: [options.auth],
});
if (!connection.success) throw new Error('Select oauth2, bearer, or x-api-key authentication.');
const name = (options.name ?? slug).trim();
if (!name || name.length > 80) throw new Error('Enter an app name with one to 80 characters.');
const root = resolve(
options.directory ?? fileURLToPath(new URL('../src/apps/', import.meta.url)),
);
const directory = join(root, slug);
await mkdir(root, { recursive: true });
await mkdir(directory);
await mkdir(join(directory, 'io.n8n.nod'));
const files = {
'plugin.json': {
$schema: 'https://agent-plugins.org/schemas/1.0.0/plugin.schema.json',
name: slug,
version: '0.1.0',
description: `Connect ${name} to Nod.`,
license: 'Apache-2.0',
author: { name: 'Replace with the maintainer name' },
extensions: {
'io.n8n.nod': { app: './io.n8n.nod/app.json' },
},
} satisfies AppManifest,
'mcp.json': {
$schema: 'https://agent-plugins.org/schemas/1.0.0/mcp.schema.json',
mcpServers: { [slug]: { type: 'streamable-http', url: url.href } },
} satisfies AppMcpConfig,
'io.n8n.nod/app.json': {
$schema: appSchemaId,
displayName: name,
prompts: [`Find a record in ${name}.`, `Summarize a record in ${name}.`],
requirements: ['Replace with the required account plan and permissions.'],
limitations: ['Replace with the limits of this connection.'],
connection: connection.data,
} satisfies AppDefinitionInput,
'io.n8n.nod/contract.json': {
$schema: appContractSchemaId,
source: 'https://example.com/replace-with-provider-docs',
tool: {
name: 'replace_with_read_tool',
description: 'Replace with the documented read tool.',
inputSchema: {
type: 'object',
properties: { query: { type: 'string' } },
required: ['query'],
},
annotations: { readOnlyHint: true },
},
input: { query: 'synthetic example' },
output: { records: [{ id: 'synthetic-record', title: 'Sample record' }] },
} satisfies AppContract,
};
for (const [path, value] of Object.entries(files))
await writeFile(join(directory, path), `${JSON.stringify(value, null, 2)}\n`, { flag: 'wx' });
return directory;
}
if (import.meta.main) {
const { positionals, values } = parseArgs({
allowPositionals: true,
options: {
url: { type: 'string' },
name: { type: 'string' },
auth: { type: 'string' },
directory: { type: 'string' },
},
});
if (positionals.length !== 1 || !values.url || !values.auth)
throw new Error(
'Use pnpm create:app <app-id> --url <public-mcp-url> --auth oauth2|bearer|x-api-key [--name <display-name>].',
);
const directory = await createApp(positionals[0], {
...values,
url: values.url,
auth: values.auth,
});
console.log(
`Created ${directory}. Replace the maintainer, requirements, limits, provider documentation, and read tool fixture. Then run pnpm check:apps ${positionals[0]}.`,
);
}
+21
View File
@@ -0,0 +1,21 @@
{
"$schema": "https://nod.n8n.io/docs/schemas/apps/v1/app.schema.json",
"displayName": "Linear",
"icon": "./io.n8n.nod/icon.svg",
"categories": ["Project management"],
"connection": {
"type": "mcp",
"server": "linear",
"authentication": ["oauth2"],
"scopes": ["read", "write"]
},
"prompts": [
"Find issues assigned to me that need a reply.",
"Create a draft issue description from these notes."
],
"requirements": ["A Linear account with access to the workspace you want to connect."],
"limitations": [
"Workspace permissions and granted OAuth scopes limit access.",
"This app does not start automatic monitoring from its MCP connection alone."
]
}
+31
View File
@@ -0,0 +1,31 @@
{
"$schema": "https://nod.n8n.io/docs/schemas/apps/v1/contract.schema.json",
"source": "https://linear.app/docs/mcp",
"tool": {
"name": "list_issues",
"description": "List issues that match a query.",
"inputSchema": {
"type": "object",
"properties": {
"query": {
"type": "string"
}
},
"required": ["query"]
},
"annotations": {
"readOnlyHint": true
}
},
"input": {
"query": "synthetic issue"
},
"output": {
"issues": [
{
"id": "synthetic-issue",
"title": "Sample issue"
}
]
}
}
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="img" aria-hidden="true"><path fill="#5E6AD2" d="M2.886 4.18A11.982 11.982 0 0 1 11.99 0C18.624 0 24 5.376 24 12.009c0 3.64-1.62 6.903-4.18 9.105L2.887 4.18ZM1.817 5.626l16.556 16.556c-.524.33-1.075.62-1.65.866L.951 7.277c.247-.575.537-1.126.866-1.65ZM.322 9.163l14.515 14.515c-.71.172-1.443.282-2.195.322L0 11.358a12 12 0 0 1 .322-2.195Zm-.17 4.862 9.823 9.824a12.02 12.02 0 0 1-9.824-9.824Z"/></svg>

After

Width:  |  Height:  |  Size: 467 B

+9
View File
@@ -0,0 +1,9 @@
{
"$schema": "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json",
"mcpServers": {
"linear": {
"type": "streamable-http",
"url": "https://mcp.linear.app/mcp"
}
}
}
+17
View File
@@ -0,0 +1,17 @@
{
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
"name": "linear",
"version": "1.0.0",
"description": "Find and work with your projects and issues.",
"homepage": "https://linear.app",
"license": "Apache-2.0",
"extensions": {
"io.n8n.nod": {
"app": "./io.n8n.nod/app.json"
}
},
"author": {
"name": "n8n",
"url": "https://github.com/n8n-io/nod"
}
}
+23
View File
@@ -0,0 +1,23 @@
{
"$schema": "https://nod.n8n.io/docs/schemas/apps/v1/app.schema.json",
"displayName": "n8n",
"icon": "./io.n8n.nod/icon.svg",
"categories": ["Automation"],
"connection": {
"type": "mcp",
"endpoint": {
"source": "owner",
"path": "/mcp-server/http"
},
"authentication": ["oauth2", "bearer"]
},
"prompts": [
"Find my workflows that handle support requests.",
"Build a draft workflow that records a sample form submission."
],
"requirements": ["An n8n account with instance-level MCP access enabled."],
"limitations": [
"Workflow access follows the permissions and MCP settings in your n8n instance.",
"Publishing and running a workflow can change other services."
]
}
+30
View File
@@ -0,0 +1,30 @@
{
"$schema": "https://nod.n8n.io/docs/schemas/apps/v1/contract.schema.json",
"source": "https://docs.n8n.io/advanced-ai/accessing-n8n-mcp-server/",
"tool": {
"name": "get_workflow_details",
"description": "Read a workflow by its ID.",
"inputSchema": {
"type": "object",
"properties": {
"workflowId": {
"type": "string"
}
},
"required": ["workflowId"]
},
"annotations": {
"readOnlyHint": true
}
},
"input": {
"workflowId": "synthetic-workflow"
},
"output": {
"workflow": {
"id": "synthetic-workflow",
"name": "Sample workflow",
"active": false
}
}
}
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -72 240 240" role="img" aria-hidden="true"><path fill="#EA4B71" d="M48 96C52.5 96 54 94.5 54 90V78C54 60 60 54 78 54H90C108 54 114 60 114 78V90C114 94.5 115.5 96 120 96C124.5 96 126 94.5 126 90V78C126 60 132 54 150 54H162C180 54 186 60 186 78V90C186 94.5 187.5 96 192 96C196.5 96 198 94.5 198 90V78C198 60 204 54 222 54H234C238.5 54 240 52.5 240 48C240 43.5 238.5 42 234 42H222C204 42 198 36 198 18V6C198 1.5 196.5 0 192 0C187.5 0 186 1.5 186 6V18C186 36 180 42 162 42H150C132 42 126 36 126 18V6C126 1.5 124.5 0 120 0C115.5 0 114 1.5 114 6V18C114 36 108 42 90 42H78C60 42 54 36 54 18V6C54 1.5 52.5 0 48 0C43.5 0 42 1.5 42 6V18C42 36 36 42 18 42H6C1.5 42 0 43.5 0 48C0 52.5 1.5 54 6 54H18C36 54 42 60 42 78V90C42 94.5 43.5 96 48 96Z"/></svg>

After

Width:  |  Height:  |  Size: 792 B

+17
View File
@@ -0,0 +1,17 @@
{
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
"name": "n8n",
"version": "1.0.0",
"description": "Build, test and run your workflows and agents.",
"homepage": "https://n8n.io",
"license": "Apache-2.0",
"extensions": {
"io.n8n.nod": {
"app": "./io.n8n.nod/app.json"
}
},
"author": {
"name": "n8n",
"url": "https://github.com/n8n-io/nod"
}
}
File renamed without changes.
+20
View File
@@ -0,0 +1,20 @@
{
"$schema": "https://nod.n8n.io/docs/schemas/apps/v1/app.schema.json",
"displayName": "Notion",
"icon": "./io.n8n.nod/icon.svg",
"categories": ["Productivity"],
"connection": {
"type": "mcp",
"server": "notion",
"authentication": ["oauth2"]
},
"prompts": [
"Find the project plan and summarize its open decisions.",
"Turn these notes into a draft page for my project."
],
"requirements": ["A Notion account with access to the pages you want to use."],
"limitations": [
"Notion permissions limit the pages and workspaces this connection can access.",
"This app does not start automatic monitoring from its MCP connection alone."
]
}
+31
View File
@@ -0,0 +1,31 @@
{
"$schema": "https://nod.n8n.io/docs/schemas/apps/v1/contract.schema.json",
"source": "https://developers.notion.com/docs/mcp",
"tool": {
"name": "notion-search",
"description": "Search pages by a query.",
"inputSchema": {
"type": "object",
"properties": {
"query": {
"type": "string"
}
},
"required": ["query"]
},
"annotations": {
"readOnlyHint": true
}
},
"input": {
"query": "synthetic page"
},
"output": {
"results": [
{
"id": "synthetic-page",
"title": "Sample page"
}
]
}
}
+11
View File
@@ -0,0 +1,11 @@
<svg width="128" height="128" viewBox="0 0 335 350" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_913_11)">
<path d="M21.056 15.0565L214.701 0.796296C238.481 -1.24326 244.599 0.122938 259.545 10.9802L321.359 54.4257C331.558 61.8966 334.958 63.9307 334.958 72.0749V310.358C334.958 325.292 329.518 334.124 310.498 335.475L85.6192 349.054C71.3416 349.735 64.5464 347.701 57.0693 338.19L11.5487 279.13C3.3919 268.259 0 260.126 0 250.61V38.8077C0 26.5954 5.44153 16.4088 21.056 15.0565Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M214.701 0.796296L21.056 15.0565C5.44153 16.4088 0 26.5954 0 38.8077V250.61C0 260.126 3.3919 268.259 11.5487 279.13L57.0693 338.19C64.5464 347.701 71.3416 349.735 85.6192 349.054L310.498 335.475C329.518 334.124 334.958 325.292 334.958 310.358V72.0749C334.958 64.3554 331.904 62.1254 322.899 55.5518C322.404 55.1901 321.891 54.8153 321.359 54.4257L259.545 10.9802C244.599 0.122938 238.481 -1.24326 214.701 0.796296ZM90.718 68.1664C72.3581 69.4062 68.1862 69.6879 57.7599 61.2177L31.2457 40.1737C28.5415 37.4525 29.8978 34.0579 36.6871 33.3847L222.855 19.8061C238.478 18.4455 246.629 23.8852 252.747 28.635L284.678 51.7183C286.038 52.3944 289.429 56.4624 285.351 56.4624L93.0882 68.0071C92.2729 68.0614 91.4837 68.1147 90.719 68.1664L90.718 68.1664ZM69.3031 308.318V106.024C69.3031 97.2006 72.021 93.1245 80.1694 92.4398L300.977 79.5458C308.466 78.867 311.857 83.6223 311.857 92.4398V293.376C311.857 302.208 310.495 309.686 298.261 310.358L86.9643 322.584C74.7361 323.257 69.3031 319.19 69.3031 308.318ZM277.894 116.876C279.249 122.992 277.894 129.102 271.768 129.789L261.586 131.817V281.164C252.747 285.915 244.596 288.631 237.804 288.631C226.929 288.631 224.206 285.234 216.06 275.056L149.467 170.513V271.662L170.539 276.417C170.539 276.417 170.539 288.631 153.538 288.631L106.67 291.349C105.308 288.631 106.67 281.848 111.424 280.488L123.654 277.099V143.362L106.672 142.001C105.311 135.886 108.703 127.068 118.221 126.383L168.501 122.994L237.804 228.898V135.212L220.135 133.184C218.778 125.707 224.206 120.278 231.001 119.605L277.894 116.876Z" fill="black"/>
</g>
<defs>
<clipPath id="clip0_913_11">
<rect width="335" height="349.948" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

+9
View File
@@ -0,0 +1,9 @@
{
"$schema": "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json",
"mcpServers": {
"notion": {
"type": "streamable-http",
"url": "https://mcp.notion.com/mcp"
}
}
}
+17
View File
@@ -0,0 +1,17 @@
{
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
"name": "notion",
"version": "1.0.0",
"description": "Find and work with your pages and databases.",
"homepage": "https://www.notion.so",
"license": "Apache-2.0",
"extensions": {
"io.n8n.nod": {
"app": "./io.n8n.nod/app.json"
}
},
"author": {
"name": "n8n",
"url": "https://github.com/n8n-io/nod"
}
}
+22 -13
View File
@@ -4,10 +4,13 @@ import { loadSkills } from '@earendil-works/pi-coding-agent';
import type { SkillLibrary } from '../../ports/agent.ts';
export function createSkillLibrary(
directory: string,
directory: string | readonly string[],
excluded: readonly string[] = [],
): SkillLibrary {
const root = realpathSync(directory);
const roots = (typeof directory === 'string' ? [directory] : directory).map((path) =>
realpathSync(path),
);
if (!roots.length) throw new Error('At least one skill directory is required.');
const checkedPath = (base: string, file: string) => {
const path = realpathSync(resolve(base, file));
if (!path.startsWith(base + sep) || !path.endsWith('.md'))
@@ -15,21 +18,26 @@ export function createSkillLibrary(
if (!statSync(path).isFile()) throw new Error('The skill file must be a regular file.');
return path;
};
const skillPaths = readdirSync(root, { withFileTypes: true })
.filter(
(entry) =>
entry.isDirectory() && !entry.name.startsWith('.') && !excluded.includes(entry.name),
)
.sort((a, b) => a.name.localeCompare(b.name))
.map((entry) => checkedPath(resolve(root, entry.name), 'SKILL.md'));
const skillPaths = roots.flatMap((root, index) =>
readdirSync(root, { withFileTypes: true })
.filter((entry) => entry.isDirectory() && !entry.name.startsWith('.'))
.filter((entry) => {
if (!excluded.includes(entry.name)) return true;
if (index === 0) return false;
throw new Error(`The app skill ${entry.name} conflicts with a core skill.`);
})
.sort((a, b) => a.name.localeCompare(b.name))
.map((entry) => checkedPath(resolve(root, entry.name), 'SKILL.md')),
);
const { skills, diagnostics } = loadSkills({
cwd: root,
agentDir: root,
cwd: roots[0],
agentDir: roots[0],
skillPaths,
includeDefaults: false,
});
if (
diagnostics.length ||
new Set(skills.map((skill) => skill.name)).size !== skills.length ||
skills.length !== skillPaths.length ||
skills.some((skill) => skill.name !== basename(skill.baseDir))
)
@@ -40,8 +48,9 @@ export function createSkillLibrary(
core: excluded,
catalog: enabled.map(({ name, description }) => ({ name, description: description.trim() })),
read(name: string, file = 'SKILL.md') {
const base = byName.get(name) ?? (excluded.includes(name) ? resolve(root, name) : undefined);
if (!base || !base.startsWith(root + sep))
const base =
byName.get(name) ?? (excluded.includes(name) ? resolve(roots[0], name) : undefined);
if (!base || !roots.some((root) => base.startsWith(root + sep)))
throw new Error('Select a skill from the skill library.');
return { name, file, content: readFileSync(checkedPath(base, file), 'utf8').trim() };
},
+120
View File
@@ -0,0 +1,120 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json",
"title": "Agent Plugins MCP Configuration",
"description": "Machine-readable schema for mcp.json in Agent Plugins 1.0.0. The Agent Plugins specification defines additional semantic and operational requirements.",
"type": "object",
"properties": {
"$schema": {
"const": "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json",
"description": "Canonical identifier of the MCP configuration schema for the Agent Plugins version targeted by this document."
},
"mcpServers": {
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/server"
}
}
},
"required": ["$schema", "mcpServers"],
"additionalProperties": false,
"$defs": {
"server": {
"title": "MCP server",
"oneOf": [
{
"$ref": "#/$defs/stdioServer"
},
{
"$ref": "#/$defs/streamableHttpServer"
},
{
"$ref": "#/$defs/sseServer"
}
]
},
"stdioServer": {
"title": "stdio MCP server",
"type": "object",
"properties": {
"type": {
"const": "stdio"
},
"command": {
"type": "string",
"minLength": 1,
"description": "Executable token. Resolution rules are defined by the Agent Plugins specification."
},
"args": {
"type": "array",
"items": {
"type": "string"
}
},
"env": {
"type": "object",
"propertyNames": {
"not": {
"enum": ["PLUGIN_ROOT", "PLUGIN_DATA"]
}
},
"additionalProperties": {
"type": "string"
}
},
"cwd": {
"type": "string",
"pattern": "^(?:\\./|\\$\\{PLUGIN_ROOT\\}(?:/|$)|\\$\\{PLUGIN_DATA\\}(?:/|$))",
"description": "Plugin-relative, PLUGIN_ROOT-rooted, or PLUGIN_DATA-rooted working directory. Filesystem containment is validated separately."
}
},
"required": ["type", "command"],
"additionalProperties": false
},
"streamableHttpServer": {
"title": "Streamable HTTP MCP server",
"type": "object",
"properties": {
"type": {
"const": "streamable-http"
},
"url": {
"type": "string",
"minLength": 1,
"description": "MCP endpoint URL. URL semantics are defined by the Agent Plugins specification."
},
"headers": {
"$ref": "#/$defs/headers"
}
},
"required": ["type", "url"],
"additionalProperties": false
},
"sseServer": {
"title": "Legacy HTTP+SSE MCP server",
"type": "object",
"properties": {
"type": {
"const": "sse"
},
"url": {
"type": "string",
"minLength": 1,
"description": "MCP endpoint URL. URL semantics are defined by the Agent Plugins specification."
},
"headers": {
"$ref": "#/$defs/headers"
}
},
"required": ["type", "url"],
"additionalProperties": false
},
"headers": {
"title": "HTTP headers",
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
@@ -0,0 +1,65 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
"title": "Agent Plugins Manifest",
"description": "Machine-readable schema for plugin.json in Agent Plugins 1.0.0. The Agent Plugins specification defines additional semantic and operational requirements.",
"type": "object",
"properties": {
"$schema": {
"const": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
"description": "Canonical identifier of the plugin manifest schema for the Agent Plugins version targeted by this document."
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"pattern": "^(?!.*(?:--|\\.\\.))[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$",
"description": "Human-readable plugin name."
},
"version": {
"type": "string"
},
"description": {
"type": "string"
},
"author": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"email": {
"type": "string"
},
"url": {
"type": "string"
}
},
"additionalProperties": false
},
"homepage": {
"type": "string"
},
"repository": {
"type": "string"
},
"license": {
"type": "string"
},
"keywords": {
"type": "array",
"items": {
"type": "string"
}
},
"extensions": {
"type": "object",
"description": "Client-specific manifest data keyed by reverse-domain extension namespace. Agent Plugins assigns no semantics to namespace object contents.",
"additionalProperties": {
"type": "object"
}
}
},
"required": ["$schema", "name"],
"additionalProperties": false
}
+201
View File
@@ -0,0 +1,201 @@
import { readFileSync, readdirSync, realpathSync, statSync, existsSync } from 'node:fs';
import { isIP } from 'node:net';
import { resolve, sep, extname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { Compile } from 'typebox/compile';
import {
appDefinitionSchema,
appContractSchema,
appExtensionSchema,
type AppContract,
} from '../shared/app-definitions.ts';
import pluginSchema from './agent-plugins/plugin.schema.json' with { type: 'json' };
import mcpSchema from './agent-plugins/mcp.schema.json' with { type: 'json' };
const manifestCheck = Compile(pluginSchema as Parameters<typeof Compile>[0]);
const mcpCheck = Compile(mcpSchema as Parameters<typeof Compile>[0]);
export interface BundledApp {
slug: string;
name: string;
description: string;
categories: string[];
endpoint?: string;
instancePath?: string;
auth: 'oauth' | 'bearer' | 'x-api-key';
scope?: string;
icon?: { bytes: Uint8Array; mimeType: string };
skills?: string;
contract: AppContract;
}
export function loadAppCatalog(directory = fileURLToPath(new URL('../apps/', import.meta.url))) {
const root = realpathSync(directory);
const result = new Map<string, BundledApp>();
for (const entry of readdirSync(root, { withFileTypes: true })
.filter((item) => !item.name.startsWith('.'))
.sort((a, b) => a.name.localeCompare(b.name))) {
if (!entry.isDirectory())
throw new Error(`App ${entry.name}: use one directory per app without symbolic links.`);
const base = realpathSync(resolve(root, entry.name));
if (!base.startsWith(root + sep))
throw new Error(`App ${entry.name}: the directory leaves the app catalog.`);
function file(path: string) {
const target = realpathSync(resolve(base, path));
if (!target.startsWith(base + sep))
throw new Error(`App ${entry.name}: ${path} leaves the app directory.`);
if (!statSync(target).isFile())
throw new Error(`App ${entry.name}: ${path} must be a regular file.`);
return target;
}
function json(path: string) {
try {
return JSON.parse(readFileSync(file(path), 'utf8'));
} catch (cause) {
const reason =
cause instanceof SyntaxError
? `invalid JSON${/position \d+/.exec(cause.message)?.[0] ? ` at ${/position \d+/.exec(cause.message)![0]}` : ''}`
: cause instanceof Error
? cause.message
: 'unknown file error';
throw new Error(`App ${entry.name}: could not read ${path}: ${reason}`);
}
}
const rawManifest = json('plugin.json');
if (!manifestCheck.Check(rawManifest))
throw new Error(
`App ${entry.name}: plugin.json does not match Agent Plugins 1.0.0: ${manifestCheck
.Errors(rawManifest)
.slice(0, 3)
.map((error) => `${error.instancePath || '/'} ${error.message}`)
.join('; ')}`,
);
const manifest = rawManifest as {
name: string;
version?: string;
description?: string;
extensions?: Record<string, unknown>;
author?: { name?: string };
};
if (
manifest.name !== entry.name ||
!/^[a-z][a-z0-9-]{0,38}[a-z0-9]$/.test(manifest.name) ||
/--/.test(manifest.name)
)
throw new Error(
`App ${entry.name}: name must match its folder and use two to 40 lowercase letters, digits, or single hyphens. Start with a letter and end with a letter or digit.`,
);
if (
typeof manifest.version !== 'string' ||
!/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/.test(
manifest.version,
)
)
throw new Error(`App ${entry.name}: set a semantic version in plugin.json.`);
if (
typeof manifest.description !== 'string' ||
!manifest.description.trim() ||
manifest.description.length > 1000
)
throw new Error(`App ${entry.name}: add a description of up to 1,000 characters.`);
const extension = appExtensionSchema.safeParse(manifest.extensions?.['io.n8n.nod']);
if (!extension.success)
throw new Error(
`App ${entry.name}: invalid io.n8n.nod reference: ${extension.error.message}`,
);
const parsed = appDefinitionSchema.safeParse(json('io.n8n.nod/app.json'));
if (!parsed.success)
throw new Error(`App ${entry.name}: invalid app.json: ${parsed.error.message}`);
const app = parsed.data;
const contract = appContractSchema.safeParse(json('io.n8n.nod/contract.json'));
if (!contract.success)
throw new Error(`App ${entry.name}: invalid contract.json: ${contract.error.message}`);
if (
!manifest.author?.name?.trim() ||
JSON.stringify({ manifest, app }).includes('Replace with') ||
contract.data.source.includes('replace-with-')
)
throw new Error(
`App ${entry.name}: complete the maintainer, provider documentation, requirements, and limits.`,
);
const connection = app.connection;
const instance = 'endpoint' in connection;
const scopes = 'scopes' in connection ? connection.scopes : undefined;
let server: { url: string } | undefined;
if (existsSync(resolve(base, 'mcp.json'))) {
const rawMcp = json('mcp.json');
if (!mcpCheck.Check(rawMcp))
throw new Error(
`App ${entry.name}: mcp.json does not match Agent Plugins 1.0.0: ${mcpCheck
.Errors(rawMcp)
.slice(0, 3)
.map((error) => `${error.instancePath || '/'} ${error.message}`)
.join('; ')}`,
);
const mcp = rawMcp as {
mcpServers: Record<string, { type: string; url: string; headers?: Record<string, string> }>;
};
if (instance || Object.keys(mcp.mcpServers).length !== 1)
throw new Error(
`App ${entry.name}: fixed apps need one MCP server; owner-supplied endpoints must omit mcp.json.`,
);
const selected = mcp.mcpServers[!instance ? connection.server : ''];
if (!selected || selected.type !== 'streamable-http')
throw new Error(`App ${entry.name}: the selected server must use streamable-http.`);
const url = URL.parse(selected.url);
if (
!url ||
url.protocol !== 'https:' ||
url.username ||
url.password ||
/[?#]/.test(selected.url) ||
isIP(url.hostname.replace(/^\[|\]$/g, '')) ||
/(?:^|\.)(?:localhost|local|internal|invalid|test|example|example\.(?:com|org|net))$/.test(
url.hostname.replace(/\.$/, ''),
)
)
throw new Error(
`App ${entry.name}: use a fixed public HTTPS MCP address without credentials, a query, or a fragment.`,
);
if (Object.keys(selected.headers ?? {}).length)
throw new Error(
`App ${entry.name}: fixed MCP headers are not supported. Use private connection setup for credentials.`,
);
server = { url: url.href };
} else if (!instance)
throw new Error(`App ${entry.name}: add mcp.json for the selected server.`);
let icon: BundledApp['icon'];
if (app.icon) {
if (!app.icon.startsWith('./io.n8n.nod/'))
throw new Error(`App ${entry.name}: keep the icon in ./io.n8n.nod/.`);
const mimeType = { '.svg': 'image/svg+xml', '.png': 'image/png', '.webp': 'image/webp' }[
extname(app.icon)
];
const bytes = readFileSync(file(app.icon));
if (!mimeType || bytes.length === 0 || bytes.length > 128 * 1024)
throw new Error(`App ${entry.name}: use an SVG, PNG, or WebP icon of up to 128 KB.`);
icon = { bytes, mimeType };
}
let skills: string | undefined;
if (existsSync(resolve(base, 'skills'))) {
skills = realpathSync(resolve(base, 'skills'));
if (!skills.startsWith(base + sep) || !statSync(skills).isDirectory())
throw new Error(`App ${entry.name}: skills must be a directory inside the app.`);
}
result.set(manifest.name, {
slug: manifest.name,
name: app.displayName,
description: manifest.description.trim(),
categories: app.categories,
auth: connection.authentication[0] === 'oauth2' ? 'oauth' : connection.authentication[0],
...(server ? { endpoint: server.url } : {}),
...(instance ? { instancePath: connection.endpoint.path } : {}),
...(scopes?.length ? { scope: scopes.join(' ') } : {}),
...(icon ? { icon } : {}),
...(skills ? { skills } : {}),
contract: contract.data,
});
}
return result;
}
export const bundledApps = loadAppCatalog();
+5 -1
View File
@@ -89,6 +89,7 @@ import {
} from '../providers/discovered/remote.ts';
import { createDiscoveredOAuth } from '../providers/discovered/oauth.ts';
import { createDiscoveredConnections } from './discovered-connections.ts';
import { bundledApps } from './app-catalog.ts';
import { createLocalFiles, isLocalFilesAction } from './local-files.ts';
import { createAppGrantVault } from './vault-app-grants.ts';
import { createDockerWorkspace } from '../providers/docker/index.ts';
@@ -895,7 +896,10 @@ async function initializeApplication(
};
const mailCheck = createMailCheck({ curator, decisions });
const skillLibrary = createSkillLibrary(
fileURLToPath(new URL('../runtime/skills/', import.meta.url)),
[
fileURLToPath(new URL('../runtime/skills/', import.meta.url)),
...[...bundledApps.values()].flatMap((app) => (app.skills ? [app.skills] : [])),
],
coreSkills,
);
const analyzeImages =
+37 -27
View File
@@ -1,4 +1,5 @@
import { createHash, randomBytes, randomUUID } from 'node:crypto';
import { bundledApps, type BundledApp } from './app-catalog.ts';
import { posix } from 'node:path';
import type { FastifyInstance } from 'fastify';
import type { Pool, PoolClient } from 'pg';
@@ -153,15 +154,6 @@ const oauthErrors = [
'account_selection_required',
];
export const officialMcp = new Map<
string,
{ name: string; endpoint?: string; scope?: string; instancePath?: string; local?: string }
>([
['notion', { name: 'Notion', endpoint: 'https://mcp.notion.com/mcp' }],
['linear', { name: 'Linear', endpoint: 'https://mcp.linear.app/mcp', scope: 'read write' }],
['n8n', { name: 'n8n', instancePath: '/mcp-server/http', local: 'http://localhost:5678' }],
]);
export class DiscoveredConnectionError extends Error {
constructor(
message: string,
@@ -269,6 +261,7 @@ export async function createDiscoveredConnections(
pool: Pool,
options: {
ownerId: string;
apps?: ReadonlyMap<string, BundledApp>;
analytics?: CaptureAnalytics;
analyticsConsent?: () => { enabled: boolean; revision?: string };
baseUrl: string;
@@ -289,6 +282,7 @@ export async function createDiscoveredConnections(
},
) {
const owner = options.ownerId;
const apps = options.apps ?? bundledApps;
function connection(path: AccessPath): AnalyticsConnection {
return {
connection_method: path.kind,
@@ -509,12 +503,13 @@ export async function createDiscoveredConnections(
return bound;
}
async function nearby(service: string) {
const server = officialMcp.get(service);
if (!server?.local || !options.local) return undefined;
const server = apps.get(service);
const local = service === 'n8n' ? 'http://localhost:5678' : undefined;
if (!server?.instancePath || !local || !options.local) return undefined;
const answer = await options
.local(server.local)
.local(local)
.transport.http(
`${server.local}/.well-known/oauth-protected-resource${server.instancePath}`,
`${local}/.well-known/oauth-protected-resource${server.instancePath}`,
{},
'GET',
undefined,
@@ -522,7 +517,7 @@ export async function createDiscoveredConnections(
)
.catch(() => undefined);
const body = answer && 'body' in answer ? (answer.body as { resource?: unknown }) : null;
return typeof body?.resource === 'string' ? server.local : undefined;
return typeof body?.resource === 'string' ? local : undefined;
}
async function addressProposal(
service: string,
@@ -530,7 +525,7 @@ export async function createDiscoveredConnections(
connectionId?: string,
returnTo?: ReturnTarget,
) {
const server = officialMcp.get(service)!;
const server = apps.get(service)!;
let name = server.name;
if (connectionId) {
const existing = await account(connectionId);
@@ -555,7 +550,7 @@ export async function createDiscoveredConnections(
.strict()
.parse(input);
const pending = await proposal(id);
const server = officialMcp.get(pending.service);
const server = apps.get(pending.service);
if (!server?.instancePath || pending.paths.length)
throw error('This connection does not take an address.');
if (
@@ -576,7 +571,8 @@ export async function createDiscoveredConnections(
let endpoint = `${url.origin}${servicePath}`;
let local = false;
await options.transport.validateEndpoint(endpoint).catch(async () => {
if (!options.local) throw error(`Use a public HTTPS address for ${server.name}.`);
if (pending.service !== 'n8n' || !options.local)
throw error(`Use a public HTTPS address for ${server.name}.`);
if (schemeless) url.protocol = 'http:';
endpoint = `${url.origin}${servicePath}`;
await options
@@ -633,9 +629,12 @@ export async function createDiscoveredConnections(
[id, owner, JSON.stringify([path]), url.host, same ?? null],
);
if (!updated.rowCount) throw error('This connection request expired.', 409);
const unreachable = parsed.token
? `Nod could not use this token at ${url.host}. Check the address and the token in ${server.name} under Settings, Instance-level MCP.`
: `${server.name} did not answer at ${url.host}. Check the address, and turn on MCP access in ${server.name} under Settings, Instance-level MCP.`;
const unreachable =
pending.service !== 'n8n'
? `${server.name} MCP setup failed.`
: parsed.token
? `Nod could not use this token at ${url.host}. Check the address and the token in ${server.name} under Settings, Instance-level MCP.`
: `${server.name} did not answer at ${url.host}. Check the address, and turn on MCP access in ${server.name} under Settings, Instance-level MCP.`;
try {
return parsed.token
? await complete(id, { token: parsed.token, accountName: url.host })
@@ -652,11 +651,15 @@ export async function createDiscoveredConnections(
cause.statusCode !== 409
)
throw cause;
throw error(unreachable, 502);
const detail = cause instanceof Error ? cause.message : 'The MCP setup failed.';
throw error(
`${unreachable} ${parsed.token ? String(redact(detail, parsed.token)) : detail}`,
502,
);
}
}
function official(service: string, connectionId?: string) {
const server = officialMcp.get(service);
const server = apps.get(service);
if (!server?.endpoint) throw error('This service is unavailable.', 404);
return {
service,
@@ -665,7 +668,7 @@ export async function createDiscoveredConnections(
{
kind: 'mcp',
endpoint: server.endpoint,
auth: 'oauth',
auth: server.auth,
...(server.scope ? { scope: server.scope } : {}),
},
],
@@ -673,7 +676,7 @@ export async function createDiscoveredConnections(
};
}
async function signIn(service: string, turn?: TurnRef, connectionId?: string) {
if (officialMcp.get(service)?.instancePath) return addressProposal(service, turn, connectionId);
if (apps.get(service)?.instancePath) return addressProposal(service, turn, connectionId);
return propose(official(service, connectionId), turn);
}
async function authorize(
@@ -698,10 +701,16 @@ export async function createDiscoveredConnections(
...(await beginOAuth(pending.id, { restart: true, returnTo }, hash)),
};
}
if (officialMcp.get(service)?.instancePath)
if (apps.get(service)?.instancePath)
return addressProposal(service, undefined, connectionId, returnTo);
const { id, name } = await create(official(service, connectionId), undefined, returnTo);
return { name, ...(await beginOAuth(id, { returnTo })) };
const server = apps.get(service)!;
return {
name,
...(server.auth === 'oauth'
? await beginOAuth(id, { returnTo })
: { url: `/apps?connect=${id}` }),
};
}
async function abandonSetup(linkHash: string, reason: 'cancelled' | 'unavailable' | 'unknown') {
const abandoned = await transaction(async (client) => {
@@ -1608,7 +1617,7 @@ export async function createDiscoveredConnections(
typeof saved?.url === 'string' && (saved.attempt === undefined || attempt)
? saved.url
: undefined;
const address = officialMcp.get(row.service)?.instancePath && !row.paths.length;
const address = apps.get(row.service)?.instancePath && !row.paths.length;
const localAddress = address ? await nearby(row.service) : undefined;
return reply.header('Cache-Control', 'no-store').send({
service: row.service,
@@ -1665,6 +1674,7 @@ export async function createDiscoveredConnections(
);
}
return {
apps,
binding,
analyticsConnections,
list,
+33 -8
View File
@@ -24,9 +24,9 @@ import { integrationMetadata, integrationServiceIds } from '../shared/integratio
import { untrustedBlock } from '../shared/untrusted.ts';
import {
DiscoveredConnectionError,
officialMcp,
type createDiscoveredConnections,
} from './discovered-connections.ts';
import { bundledApps } from './app-catalog.ts';
import { transaction } from './transaction.ts';
import type { WorkAdmission } from './work-admission.ts';
import type { SiteIcon } from '../ports/link-preview.ts';
@@ -297,6 +297,7 @@ function protectedCallback(row: Pick<ConnectionRow, 'callback_claim_id' | 'callb
}
export async function createIntegrations(pool: Pool, options: IntegrationOptions) {
const directApps = options.discovered?.apps ?? bundledApps;
const mailCheck = options.mailCheck ?? noMailCheck;
const configuredOwner = z.string().min(1).max(200).parse(options.ownerId);
const provider = options.provider;
@@ -337,6 +338,15 @@ export async function createIntegrations(pool: Pool, options: IntegrationOptions
.parse(provider.id);
let serviceCatalog: Map<string, IntegrationServiceInfo> | undefined;
function serviceInfo(slug: string): IntegrationServiceInfo {
const direct = directApps.get(slug);
if (direct)
return {
slug,
name: direct.name,
description: direct.description,
categories: direct.categories,
...(direct.icon ? { logoUrl: `/api/apps/catalog/${slug}/icon` } : {}),
};
const info = serviceCatalog?.get(slug);
return { slug, ...info, ...integrationMetadata(slug, info) };
}
@@ -512,9 +522,9 @@ export async function createIntegrations(pool: Pool, options: IntegrationOptions
}
async function catalog(): Promise<Connection[]> {
const services = await providerCatalog();
if (options.discovered && !services.has('notion'))
services.set('notion', serviceInfo('notion'));
const services = new Map(await providerCatalog());
if (options.discovered)
for (const slug of directApps.keys()) services.set(slug, serviceInfo(slug));
return [...services.values()]
.sort((left, right) => {
const featured = (slug: string) => {
@@ -696,11 +706,12 @@ export async function createIntegrations(pool: Pool, options: IntegrationOptions
const result: Connection[] = [];
const services = new Set<string>([
...integrationServiceIds,
...directApps.keys(),
...rows.filter((row) => row.account_id).map((row) => row.slug),
]);
for (const slug of services) {
const service = serviceInfo(slug);
if (officialMcp.has(slug)) {
if (directApps.has(slug)) {
result.push({
slug,
name: service.name,
@@ -1703,7 +1714,7 @@ export async function createIntegrations(pool: Pool, options: IntegrationOptions
Object.entries(found.tools as Record<string, unknown>).filter(([action]) => {
const slug = matchingService(action, services);
return (
!(slug && officialMcp.has(slug)) &&
!(slug && directApps.has(slug)) &&
slug !== retiredNotionMcp &&
(!connectionId || rows.some((row) => row.slug === slug))
);
@@ -2610,6 +2621,20 @@ export async function createIntegrations(pool: Pool, options: IntegrationOptions
apps,
} satisfies AppSetupStatus);
});
scope.get<{ Params: { slug: string } }>(
'/api/apps/catalog/:slug/icon',
async (request, reply) => {
const value = directApps.get(request.params.slug)?.icon;
if (!value) return reply.code(404).send({ error: 'The app icon is unavailable.' });
return reply
.header('Content-Type', value.mimeType)
.header('X-Content-Type-Options', 'nosniff')
.header('Content-Security-Policy', "default-src 'none'; sandbox")
.header('Cross-Origin-Resource-Policy', 'same-origin')
.header('Cache-Control', 'private, max-age=300')
.send(Buffer.from(value.bytes));
},
);
scope.get<{ Params: { id: string } }>('/api/apps/:id/icon', async (request, reply) => {
const value = await icon(request.params.id);
if (!value) return reply.code(404).send({ error: 'The app icon is unavailable.' });
@@ -2662,7 +2687,7 @@ export async function createIntegrations(pool: Pool, options: IntegrationOptions
const service = request.params.slug === retiredNotionMcp ? 'notion' : request.params.slug;
if (request.params.slug === retiredNotionMcp && input.connectionId)
throw new IntegrationError(retiredNotionMessage, 409);
if (officialMcp.has(service)) {
if (directApps.has(service)) {
if (!options.discovered)
throw new IntegrationError('Discovered connections are unavailable.', 503);
const selected = (await options.discovered.list()).find(
@@ -3065,7 +3090,7 @@ export async function createIntegrations(pool: Pool, options: IntegrationOptions
const slug = slugSchema.parse(service === retiredNotionMcp ? 'notion' : service);
if (service === retiredNotionMcp && connectionId)
throw new IntegrationError(retiredNotionMessage, 409);
if (officialMcp.has(slug)) {
if (directApps.has(slug)) {
if (!options.discovered)
throw new IntegrationError('Discovered connections are unavailable.', 503);
const accounts = (await options.discovered.list())
+90
View File
@@ -0,0 +1,90 @@
import { z } from 'zod';
export const appSchemaId = 'https://nod.n8n.io/docs/schemas/apps/v1/app.schema.json';
export const appContractSchemaId = 'https://nod.n8n.io/docs/schemas/apps/v1/contract.schema.json';
export const appExtensionSchema = z.strictObject({ app: z.literal('./io.n8n.nod/app.json') });
const text = (max: number) =>
z
.string()
.min(1)
.max(max)
.regex(/^\S(?:[\s\S]*\S)?$/, 'Remove leading and trailing whitespace.');
const fixedServer = { type: z.literal('mcp'), server: text(80) };
export const appConnectionSchema = z.union([
z.strictObject({
...fixedServer,
authentication: z.tuple([z.literal('oauth2')]),
scopes: z.array(text(100)).max(30).optional(),
}),
z.strictObject({
...fixedServer,
authentication: z.tuple([z.enum(['bearer', 'x-api-key'])]),
}),
z.strictObject({
type: z.literal('mcp'),
endpoint: z.strictObject({
source: z.literal('owner'),
path: z.string().regex(/^\/(?:[a-zA-Z0-9_-]+\/)*[a-zA-Z0-9_-]+$/),
}),
authentication: z.tuple([z.literal('oauth2'), z.literal('bearer')]),
}),
]);
export const appDefinitionSchema = z.strictObject({
$schema: z.literal(appSchemaId),
displayName: text(80),
icon: z
.string()
.regex(/^\.\/io\.n8n\.nod\/(?:[a-zA-Z0-9_-]+\/)*[a-zA-Z0-9_-]+\.(?:svg|png|webp)$/)
.optional(),
categories: z.array(text(50)).max(10).default([]),
prompts: z.array(text(240)).min(2).max(4),
requirements: z.array(text(300)).min(1).max(8),
limitations: z.array(text(300)).min(1).max(8),
connection: appConnectionSchema,
});
export const appContractSchema = z.strictObject({
$schema: z.literal(appContractSchemaId),
source: z.intersection(z.url(), z.string().regex(/^[hH][tT][tT][pP][sS]:\/\//)),
tool: z.strictObject({
name: z
.string()
.min(1)
.max(100)
.regex(/^(?!replace_)/),
description: z.string().min(1).max(2000),
inputSchema: z.object({ type: z.literal('object') }).catchall(z.json()),
annotations: z.strictObject({ readOnlyHint: z.literal(true) }),
}),
input: z.record(z.string(), z.json()),
output: z.json(),
});
export type AppDefinition = z.output<typeof appDefinitionSchema>;
export type AppDefinitionInput = z.input<typeof appDefinitionSchema>;
export type AppContract = z.output<typeof appContractSchema>;
export interface AppManifest {
$schema: 'https://agent-plugins.org/schemas/1.0.0/plugin.schema.json';
name: string;
version: string;
description: string;
author: { name: string; email?: string; url?: string };
homepage?: string;
repository?: string;
license?: string;
keywords?: string[];
extensions: { 'io.n8n.nod': z.output<typeof appExtensionSchema> } & Record<
string,
Record<string, unknown>
>;
}
export interface AppMcpConfig {
$schema: 'https://agent-plugins.org/schemas/1.0.0/mcp.schema.json';
mcpServers: Record<string, { type: 'streamable-http'; url: string }>;
}
+5 -1
View File
@@ -546,7 +546,11 @@ export function AppDiscoveryDialog({
onChange={(event) => setInstanceUrl(event.target.value)}
required
maxLength={2048}
placeholder="https://you.app.n8n.cloud"
placeholder={
discovery.service === 'n8n'
? 'https://you.app.n8n.cloud'
: 'https://app.example.com'
}
autoComplete="off"
spellCheck={false}
disabled={saving}
+1
View File
@@ -18,6 +18,7 @@ export function ServiceLogo({
const [failed, setFailed] = useState<string[]>([]);
const base = slug.replace(/_mcp$/, '');
const source = [
logoUrl?.startsWith('/api/apps/catalog/') ? logoUrl : undefined,
bundled.has(base) ? `/logos/${base}.svg` : undefined,
logoUrl,
connectionId ? `/api/apps/${encodeURIComponent(connectionId)}/icon` : undefined,
+509 -1
View File
@@ -11,7 +11,19 @@ import {
verify,
webcrypto,
} from 'node:crypto';
import { chmod, copyFile, mkdir, mkdtemp, readdir, rm, stat, symlink } from 'node:fs/promises';
import {
chmod,
copyFile,
mkdir,
mkdtemp,
readdir,
rm,
stat,
symlink,
cp,
readFile,
writeFile,
} from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import test, { type TestContext } from 'node:test';
@@ -72,6 +84,502 @@ import { connectedGmail } from '../src/shared/onboarding.ts';
import { fileBytes } from '../src/shared/files.ts';
import { connectionGroups } from '../src/web/lib/secondary-pages.ts';
import { fakeComputer, fakeExecution, fakeWorkspace } from './runtime-fixtures.ts';
import { bundledApps, loadAppCatalog } from '../src/server/app-catalog.ts';
import { checkAppContract } from '../scripts/check-apps.ts';
import { createApp } from '../scripts/create-app.ts';
import { createSkillLibrary } from '../src/providers/pi/skills.ts';
import { appDefinitionSchema, appContractSchema } from '../src/shared/app-definitions.ts';
import { appSchemaFiles } from '../scripts/app-schemas.ts';
import { Compile } from 'typebox/compile';
test('app folders reject escaped paths, incomplete contracts, and unsupported server definitions', async (t) => {
const root = await mkdtemp(join(tmpdir(), 'nod-app-profile-'));
t.after(() => rm(root, { recursive: true, force: true }));
const source = fileURLToPath(new URL('../src/apps/linear', import.meta.url));
async function fixture(name: string) {
const directory = join(root, name);
await mkdir(directory);
await cp(source, join(directory, 'linear'), { recursive: true });
return directory;
}
async function change(directory: string, file: string, update: (value: any) => void) {
const path = join(directory, 'linear', file);
const value = JSON.parse(await readFile(path, 'utf8'));
update(value);
await writeFile(path, JSON.stringify(value));
}
const valid = await fixture('valid');
await writeFile(join(valid, '.DS_Store'), 'synthetic system metadata');
await checkAppContract(loadAppCatalog(valid).get('linear')!);
const arrayApp = loadAppCatalog(valid).get('linear')!;
await checkAppContract({
...arrayApp,
contract: { ...arrayApp.contract, output: [{ id: 'synthetic-array-record' }] },
});
const invalidJson = await fixture('invalid-json');
await writeFile(join(invalidJson, 'linear/plugin.json'), 'synthetic-private-value: {');
assert.throws(
() => loadAppCatalog(invalidJson),
(error: Error) => {
assert.match(error.message, /invalid JSON/);
assert(!error.message.includes('synthetic-private-value'));
return true;
},
);
const missing = await fixture('missing');
await rm(join(missing, 'linear/io.n8n.nod/contract.json'));
assert.throws(() => loadAppCatalog(missing), /contract.json/);
const escaped = await fixture('escaped');
await rm(join(escaped, 'linear/io.n8n.nod/icon.svg'));
await symlink(
join(valid, 'linear/io.n8n.nod/icon.svg'),
join(escaped, 'linear/io.n8n.nod/icon.svg'),
);
assert.throws(() => loadAppCatalog(escaped), /leaves the app directory/);
const linked = join(root, 'linked');
await mkdir(linked);
await symlink(join(valid, 'linear'), join(linked, 'linear'));
assert.throws(() => loadAppCatalog(linked), /without symbolic links/);
const cases: Array<[string, string, (value: any) => void, RegExp]> = [
[
'version',
'mcp.json',
(value) => {
value.$schema = 'https://agent-plugins.org/schemas/9.0.0/mcp.schema.json';
},
/Agent Plugins 1.0.0/,
],
[
'secret',
'mcp.json',
(value) => {
value.mcpServers.linear.headers = { Authorization: 'synthetic-never-display-this' };
},
/headers are not supported/,
],
[
'private',
'mcp.json',
(value) => {
value.mcpServers.linear.url = 'https://127.0.0.1/mcp';
},
/public HTTPS/,
],
...['?', '#'].map((delimiter, index): [string, string, (value: any) => void, RegExp] => [
`empty-url-delimiter-${index}`,
'mcp.json',
(value) => {
value.mcpServers.linear.url += delimiter;
},
/public HTTPS/,
]),
[
'stdio',
'mcp.json',
(value) => {
value.mcpServers.linear = { type: 'stdio', command: 'node' };
},
/streamable-http/,
],
[
'server',
'io.n8n.nod/app.json',
(value) => {
value.connection.server = 'missing';
},
/selected server/,
],
[
'placeholder',
'io.n8n.nod/contract.json',
(value) => {
value.tool.name = 'replace_with_read_tool';
},
/invalid contract/,
],
];
for (const [name, file, update, reason] of cases) {
const directory = await fixture(name);
await change(directory, file, update);
assert.throws(
() => loadAppCatalog(directory),
(error: Error) => {
assert.match(error.message, reason);
assert(!error.message.includes('synthetic-never-display-this'));
return true;
},
);
}
const invalidInput = await fixture('input');
await change(invalidInput, 'io.n8n.nod/contract.json', (value) => {
value.input = { query: 42 };
});
await assert.rejects(
checkAppContract(loadAppCatalog(invalidInput).get('linear')!),
/does not match/,
);
const patternInput = await fixture('pattern-input');
await change(patternInput, 'io.n8n.nod/contract.json', (value) => {
value.tool.inputSchema.properties.query.pattern = '^allowed_';
});
await assert.rejects(
checkAppContract(loadAppCatalog(patternInput).get('linear')!),
/does not match/,
);
await change(patternInput, 'io.n8n.nod/contract.json', (value) => {
value.input.query = 'allowed_synthetic_query';
});
await checkAppContract(loadAppCatalog(patternInput).get('linear')!);
await change(patternInput, 'io.n8n.nod/contract.json', (value) => {
value.tool.inputSchema.required = 'query';
});
await assert.rejects(
checkAppContract(loadAppCatalog(patternInput).get('linear')!),
/not valid JSON Schema 2020-12/,
);
});
test('app scaffolding refuses replacement and requires contributors to complete the read contract', async (t) => {
const directory = await mkdtemp(join(tmpdir(), 'nod-app-scaffold-'));
t.after(() => rm(directory, { recursive: true, force: true }));
const options = {
directory,
url: 'https://mcp.linear.app/mcp',
name: 'Synthetic app',
auth: 'oauth2',
};
for (const slug of ['../escape', 'trailing-', 'double--hyphen', 'a'])
await assert.rejects(createApp(slug, options));
for (const url of [
'https://127.0.0.1/mcp',
'https://[::1]/mcp',
'https://localhost/mcp',
'https://mcp.example.com/mcp',
'https://mcp.internal/mcp',
'https://mcp.test/mcp',
`${options.url}?`,
`${options.url}#`,
])
await assert.rejects(createApp('synthetic-app', { ...options, url }), /public HTTPS/);
for (const name of ['', ' ', 'n'.repeat(81)])
await assert.rejects(createApp('synthetic-app', { ...options, name }), /app name/);
assert.deepEqual(await readdir(directory), []);
await createApp('synthetic-app', options);
await assert.rejects(createApp('synthetic-app', options), { code: 'EEXIST' });
assert.throws(() => loadAppCatalog(directory), /invalid contract/);
const manifestPath = join(directory, 'synthetic-app/plugin.json');
const manifest = JSON.parse(await readFile(manifestPath, 'utf8'));
manifest.author.name = 'Synthetic maintainer';
await writeFile(manifestPath, JSON.stringify(manifest));
const appPath = join(directory, 'synthetic-app/io.n8n.nod/app.json');
const app = JSON.parse(await readFile(appPath, 'utf8'));
app.requirements = ['A disposable account with read access.'];
app.limitations = ['Automatic monitoring is not supported.'];
await writeFile(appPath, JSON.stringify(app));
await writeFile(
join(directory, 'synthetic-app/io.n8n.nod/contract.json'),
JSON.stringify(bundledApps.get('linear')!.contract),
);
await checkAppContract(loadAppCatalog(directory).get('synthetic-app')!);
});
test('app skills cannot shadow core guides or load without a trusted root', async (t) => {
const directory = await mkdtemp(join(tmpdir(), 'nod-app-skills-'));
t.after(() => rm(directory, { recursive: true, force: true }));
assert.throws(() => createSkillLibrary([]), /At least one skill directory/);
const builtin = join(directory, 'builtin');
const apps = join(directory, 'apps');
await mkdir(join(builtin, 'artifacts'), { recursive: true });
await mkdir(join(apps, 'artifacts'), { recursive: true });
await writeFile(join(builtin, 'artifacts/SKILL.md'), 'Synthetic core guide.');
await writeFile(
join(apps, 'artifacts/SKILL.md'),
'---\nname: artifacts\ndescription: A synthetic app guide.\n---\nApp content.',
);
assert.throws(() => createSkillLibrary([builtin, apps], ['artifacts']), /conflicts with a core/);
await rm(join(apps, 'artifacts'), { recursive: true });
await mkdir(join(apps, 'community-guide'));
const body = '---\nname: community-guide\ndescription: A synthetic app guide.\n---\nApp content.';
await writeFile(join(apps, 'community-guide/SKILL.md'), body);
const library = createSkillLibrary([builtin, apps], ['artifacts']);
assert.equal(library.read('artifacts').content, 'Synthetic core guide.');
assert.equal(library.read('community-guide').content, body);
await mkdir(join(builtin, 'community-guide'));
await writeFile(join(builtin, 'community-guide/SKILL.md'), body);
assert.throws(() => createSkillLibrary([builtin, apps], ['artifacts']), /metadata is invalid/);
});
test('published app schemas reject unsupported definitions with the runtime validators', async () => {
const editorApp = Compile(appSchemaFiles['app.schema.json'] as Parameters<typeof Compile>[0]);
const editorContract = Compile(
appSchemaFiles['contract.schema.json'] as Parameters<typeof Compile>[0],
);
const app = JSON.parse(
await readFile(new URL('../src/apps/linear/io.n8n.nod/app.json', import.meta.url), 'utf8'),
);
const instance = JSON.parse(
await readFile(new URL('../src/apps/n8n/io.n8n.nod/app.json', import.meta.url), 'utf8'),
);
assert(editorApp.Check(app));
assert(editorApp.Check(instance));
for (const change of [
(value: any) => {
value.displayName = 42;
},
(value: any) => {
value.displayName = ' ';
},
(value: any) => {
value.displayName = ' Leading space';
},
(value: any) => {
value.requirements = [' '];
},
(value: any) => {
value.unknownSetting = true;
},
(value: any) => {
value.$schema = value.$schema.replace('/v1/', '/v2/');
},
(value: any) => {
value.prompts = 'Read my records.';
},
(value: any) => {
value.connection.authentication = ['password'];
},
(value: any) => {
value.connection.authentication = ['bearer'];
},
(value: any) => {
value.connection.authentication = ['oauth2', 'bearer'];
},
(value: any) => {
value.connection.endpoint = { source: 'owner', path: '/mcp' };
},
(value: any) => {
value.connection.headers = { Authorization: 'synthetic-private-token' };
},
]) {
const invalid: unknown = structuredClone(app);
change(invalid);
assert.equal(appDefinitionSchema.safeParse(invalid).success, false);
assert.equal(editorApp.Check(invalid), false);
}
const contract = structuredClone(bundledApps.get('linear')!.contract);
assert(editorContract.Check(contract));
for (const change of [
(value: any) => {
value.extraSetting = true;
},
(value: any) => {
value.source = 'http://provider.invalid/docs';
},
(value: any) => {
value.tool.annotations.readOnlyHint = false;
},
(value: any) => {
value.tool.inputSchema.type = 'array';
},
(value: any) => {
value.tool.name = 'replace_with_read_tool';
},
]) {
const invalid: unknown = structuredClone(contract);
change(invalid);
assert.equal(appContractSchema.safeParse(invalid).success, false);
assert.equal(editorContract.Check(invalid), false);
}
});
test('every shipped app passes the required offline MCP contract suite', async (t) => {
t.mock.method(globalThis, 'fetch', async () =>
assert.fail('App contract checks must not make external requests.'),
);
for (const app of bundledApps.values()) await t.test(app.slug, () => checkAppContract(app));
});
for (const authentication of ['oauth2', 'bearer', 'x-api-key'] as const)
test(
`an added app folder uses private setup, account binding, and credential removal with ${authentication}`,
{ skip: !process.env.TEST_DATABASE_URL },
async (t) => {
t.mock.method(globalThis, 'fetch', async () =>
assert.fail('App setup must use the synthetic provider.'),
);
const directory = await mkdtemp(join(tmpdir(), 'nod-app-connection-'));
t.after(() => rm(directory, { recursive: true, force: true }));
await cp(
fileURLToPath(new URL('../src/apps/linear', import.meta.url)),
join(directory, 'community-fixture'),
{ recursive: true },
);
const manifestPath = join(directory, 'community-fixture/plugin.json');
const manifest = JSON.parse(await readFile(manifestPath, 'utf8'));
manifest.name = 'community-fixture';
await writeFile(manifestPath, JSON.stringify(manifest));
const appPath = join(directory, 'community-fixture/io.n8n.nod/app.json');
const app = JSON.parse(await readFile(appPath, 'utf8'));
app.displayName = 'Community fixture';
app.connection.authentication = [authentication];
if (authentication !== 'oauth2') delete app.connection.scopes;
await writeFile(appPath, JSON.stringify(app));
const apps = loadAppCatalog(directory);
const definition = apps.get('community-fixture')!;
const database = await hostedDatabase();
const server = Fastify();
t.after(async () => {
await server.close();
await database.close();
});
const token = 'synthetic-app-private-token';
let state = '';
let dispatched = 0;
const transport = createDiscoveredTransport(
async (input, init) => {
const request = new Request(input, init);
assert.equal(request.url, definition.endpoint);
assert.equal(
request.headers.get(authentication === 'x-api-key' ? 'x-api-key' : 'authorization'),
authentication === 'x-api-key' ? token : `Bearer ${token}`,
);
if (request.method === 'GET') return new Response(null, { status: 405 });
if (request.method === 'DELETE') return new Response(null, { status: 200 });
const message = JSON.parse(await request.text());
if (message.id === undefined) return new Response(null, { status: 202 });
if (message.method === 'tools/call') dispatched++;
return Response.json({
jsonrpc: '2.0',
id: message.id,
result:
message.method === 'initialize'
? {
protocolVersion: message.params.protocolVersion,
capabilities: { tools: {} },
serverInfo: { name: 'synthetic', version: '1' },
}
: message.method === 'tools/list'
? { tools: [definition.contract.tool] }
: {
content: [
{
type: 'text',
text: JSON.stringify({
...(definition.contract.output as Record<string, unknown>),
privateToken: token,
}),
},
],
},
});
},
async (value) => {
assert.equal(value, definition.endpoint);
return value;
},
);
const discovered = await createDiscoveredConnections(database.pool, {
apps,
ownerId: 'synthetic-owner',
baseUrl: 'http://localhost:4310',
transport,
grantVault: await createAppGrantVault(database.pool, {
ownerId: 'synthetic-owner',
keyStore: installationKeyStore,
}),
oauth: {
begin: async (endpoint, redirectUri, nextState, scope) => {
assert.equal(endpoint, definition.endpoint);
assert.equal(scope, 'read write');
state = nextState;
return { url: `https://consent.example.test/?state=${state}`, saved: { redirectUri } };
},
finish: async (_endpoint, saved) => ({
...saved,
tokens: { access_token: token, token_type: 'Bearer' },
}),
refresh: async () => assert.fail('A fresh connection must not refresh.'),
},
});
const provider = fakeProvider({
id: 'unused',
authorize: async () => assert.fail('Use app setup.'),
search: async () => ({ tools: {}, suggestions: [] }),
execute: async () => assert.fail('Use the app transport.'),
});
provider.configured = false;
const integrations = await createIntegrations(database.pool, {
ownerId: 'synthetic-owner',
provider,
discovered,
baseUrl: 'http://localhost:4310',
wake: async () => {},
});
integrations.registerRoutes(server);
const catalog = (await server.inject('/api/apps/catalog')).json<AppConnection[]>();
assert(catalog.some((app) => app.slug === definition.slug && app.name === definition.name));
const listed = await integrations.list('synthetic-owner', { refresh: false });
assert(listed.some((app) => app.slug === definition.slug && app.direct));
assert.equal(
(await server.inject(`/api/apps/catalog/${definition.slug}/icon`)).statusCode,
200,
);
const start = await server.inject({
method: 'POST',
url: `/api/apps/${definition.slug}/connect`,
});
assert.equal(start.statusCode, 200, start.body);
assert(!start.body.includes(token));
if (authentication === 'oauth2') {
const callback = await server.inject(
`/api/apps/callback?state=${state}&code=synthetic-code`,
);
assert.equal(
new URL(callback.headers.location!).searchParams.get('connection'),
'connected',
);
} else {
assert.equal(state, '');
const id = new URL(start.json().url, 'http://localhost:4310').searchParams.get('connect');
const completed = await server.inject({
method: 'POST',
url: `/api/apps/discovery/${id}/complete`,
payload: { token, accountName: 'Synthetic account' },
});
assert.equal(completed.statusCode, 200, completed.body);
}
const connected = (await discovered.list()).find((app) => app.slug === definition.slug)!;
assert(connected?.connectionId);
const known = (await discovered.servers())[0];
const args = {
connectionId: connected.connectionId,
pathId: known.pathId,
tool: definition.contract.tool.name,
input: definition.contract.input,
};
const output = await discovered.execute('CONNECTED_MCP_CALL', args, {
threadId: randomUUID(),
turnId: randomUUID(),
});
assert(!JSON.stringify(output).includes(token));
assert.equal(dispatched, 1);
await assert.rejects(
discovered.execute(
'CONNECTED_MCP_CALL',
{ ...args, pathId: randomUUID() },
{ threadId: randomUUID(), turnId: randomUUID() },
),
);
assert.equal(dispatched, 1);
await discovered.disconnect(connected.connectionId, definition.slug);
await assert.rejects(
discovered.execute('CONNECTED_MCP_CALL', args, {
threadId: randomUUID(),
turnId: randomUUID(),
}),
);
assert.equal(dispatched, 1);
},
);
const fixtureIdentityCheckpoint = {
read: async () => undefined,