Skip to content
Agentmart
Submit a tool

mdk-gateway-plugin

Build the HTTP routes of an MDK app (route table + controllers, served through the Gateway) over one or more MDK Workers.

Skill by tetherto

IndexedApache-2.0★ 11
Write a review

Chalk Labs

Need help deploying mdk-gateway-plugin?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/tetherto-mdk-gateway-plugin

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Build the HTTP routes of an MDK app (route table + controllers, served through the Gateway) over one or more MDK Workers. Use when the task mentions "aggregate", "combine Workers", "site summary / rollup", "plugin", "mdk-plugin.json", "Gateway endpoint", "cross-worker endpoint", or when a UI needs live Worker data and no matching `/api/...` route exists yet.

Use cases: design, backend, data, productivity

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/mdk-gateway-plugin

What's inside

Skill name
mdk-gateway-plugin
Description
Build the HTTP routes of an MDK app (route table + controllers, served through the Gateway) over one or more MDK Workers. Use when the task mentions "aggregate", "combine Workers", "site summary / rollup", "plugin", "mdk-plugin.json", "Gateway endpoint", "cross-worker endpoint", or when a UI needs live Worker data and no matching `/api/...` route exists yet.
License
Apache-2.0
Metadata
suite: mdk-developer-skill · mdk_version: 0.5.0
Instructions
179 lines in SKILL.md · view on GitHub

Before installing

  • Instructions call the network

Files (3)

  • SKILL.md
  • controller-patterns.md · references/
  • plugin-authoring.md · references/

SKILL.md (first lines)

# Build the routes of an MDK app

The Gateway serves HTTP routes from **apps**. An app is a small Node package with an `mdk-app.yaml` manifest
and a route table (`mdk-plugin.json`, in `plugin/` or the package root); `mdk run` runs each app in its own
process and the Gateway forwards each request to it. Each route is a controller that queries Workers through
the app's own `@tetherto/mdk-client`, built once from `require('@tetherto/mdk-gateway/plugin')`.

Apps are the **server half** of any "show me X from my devices" request.
If the UI needs data that no existing route returns, build the app's route
first, then hand off to `mdk-ui-component`. Creating the package itself (manifest,
permissions, layout) is the [`mdk-create-app`](../mdk-create-app/SKILL.md) skill; this
skill owns the route table and controllers.

## When to use this skill

| Situation                                             | Action                     |
| ----------------------------------------------------- | -------------------------- |
| UI / chart needs a metric and no Gateway route exists | Add a route here first     |
| Aggregate / rollup / site summary" across devices     | Add a route                |
| Endpoint already exists (check `mdk.yaml` → `spec.apps`, or `mdk status`) | Skip — go straight to `mdk-ui-component` |
| Need a new device protocol                            | Wrong skill — use `mdk-worker-plugin` |

## Workflow

### 1. site capability discovery (mandatory)

Do **not** invent channel names, units, or device brands. Ground every field
in an installed Worker contract.

**Resolve each Worker's contract from `mdk.yaml` → `spec.workers[].package`:**

| `package` value                               | Contract path                                                                       |
| --------------------------------------------- | ----------------------------------------------------------------------------------- |
| Local path (`./workers/<name>`, `../…`)       | `<package>/mdk-contract.json` (or legacy `<package>/plugin/mdk-contract.json`)      |
| npm name (`@tetherto/mdk-worker-avalon`, …)   | `node_modules/<package>/mdk-contract.json` (or legacy `…/plugin/mdk-contract.json`) |

Also scan `workers/*/mdk-contract.json` and `workers/*/plugin/mdk-contract.json` for any local scaffolds not yet
listed in `mdk.yaml`. If an npm package is listed but missing under
`node_modules/`, run `npm install` first — do not invent the contract.

Then:

1. Open each resolved `mdk-contract.json`.
2. Read `capabilities.telemetry[]` / `commands[]` — note `name`, `type`, `unit`.
3. Read `metadata.brand` / `deviceFamily` / `provider` for how to recognize
   the device family at runtime.
4. Confirm the Kernel actually has the Worker online (`mdk run worker <name>`
   or `mdk status`) before assuming data flows.

`getCapabilities` returns the capability list only — not full contract
metadata (no `brand`/`provider`) — so the fingerprint you match against at
runtime is the telemetry/command **name set**, derived from the contract you
just read, not a hard-coded device list.

### 2. Scaffold the app

```bash
mdk create app <app-name>
```

Scaffolds and registers in one step (manifest rules: [`mdk-create-app`](../mdk-create-app/SKILL.md)):

```
apps/<app-name>/
├── package.json          # name: <app-name> (or @org/<app-name> with --org)
├── mdk-app.yaml          # id, version (= package.json), displayName, permissions, config defaults
└── plugin/
    ├── mdk-plugin.json   # routes + OpenAPI-ish response schema
    ├── lib/client.js     # the app's MDK client
    └── controllers/
        └── summary.js    # async (req) => payload
```

It also links the package into the project's root `package.json` (root `npm install`,
skip with `--no-install`) and appends it under `mdk.yaml` →
`spec.apps` (skip with `--no-stack-entry`) — no manual
`package.json` linking step. Check it with `mdk validate app <app-name>`.

### 3. Author `mdk-plugin.json`

Every route needs:

- `id` — stable dotted id (`<domain>.<metric>`, e.g. `fleet.summary`)
- `handler` — relative path to the controller
- `http.method` + `http.path` — the UI will `fetch` this path
- `http.responses.200.content.application/json.schema` — real response shape
- `description`, `constraints`, `examples`, `errors`, `safety`

Path convention: `/api/<domain>/<resource>` (e.g. `/api/fleet/summary`). The Gateway serves it under
`/apps/<app-name>` (so `/apps/<app-name>/api/fleet/summary`) unless the app's `spec.apps` entry sets
`mount`; never write the `/apps/<app-name>` prefix into the route table yourself.

Full field notes: [`references/plugin-authoring.md`](./references/plugin-authoring.md).

### 4. Implement the controller

Take the client once per app, in a `lib/client.js` every controller requires. The
scaffold's `plugin/lib/client.js` is this exact pattern: `config.mdkClient` from
`require('@tetherto/mdk-gateway/plugin')`, the app runtime's Kernel client, signed in as the app's
service account. Never build a Kernel client from keys: the config carries none, and the Kernel
refuses calls without the app's token.

```js
'use strict'

const mdkClient = require('../lib/client')

module.exports = async function myRoute (req) {
  // mdkClient methods return the bare payload — never read `.payload`
  const workersResp = await mdkClient.listWorkers()
  const workers = (workersResp && workersResp.workers) || []
  // … filter devices, pullTelemetry, shape response …
  return { /* matches mdk-plugin.json schema */ }
}
```

Typical [fan-out pattern](./references/controller-patterns.md):

1. `listWorkers()` → collect `deviceIds`.

From tetherto/mdk, Apache-2.0.

More from tetherto/mdk

Signals

Stars
11
Forks
13
Open issues
0
Last commit (this folder)
Oct 22, 2026 (9 days ago)
Last release
Oct 19, 2026 (12 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
Apache-2.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from tetherto

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get mdk-gateway-plugin running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying mdk-gateway-plugin?

CallGet help
Cite this page

mdk-gateway-plugin skill. Agent Mart. https://agentmart.dev/skills/tetherto-mdk-gateway-plugin (last updated 2026-10-24)