mesa-doc /mesa-pro/docs/datasource-plugins
docs

Multi-datasource connectors (Pro plugin)

Connector grants are per kind:

license limits.pluginsallowed connector
datasourceany datasource kind
datasource.restREST only
datasource.postgrestPostgREST only
*any

datasource_upsert checks the descriptor kind before it reaches the base CLI. Unlicensed connectors are hidden from tools/list and rejected with PLUGIN_NOT_LICENSED / datasource.<kind>.

modu connector list/show/validate is the base read-only discovery surface over .modu/connectors/. Pro adds mesa-datasource list (calls the base CLI) and mesa-datasource health and the datasource_health MCP tool (requires a datasource family grant). The base keeps the datasource contract and adapter interfaces (@modu/contracts/datasource); Pro owns the licensed connector surface.

CSV connector (first concrete plugin)

{
  "version": 1,
  "id": "csv.plant",
  "kind": "csv",
  "title": "Plant CSV",
  "plugin": "datasource.csv",
  "config": { "url": "https://example.com/plants.csv", "resource": "items", "idColumn": "id" }
}
MESA_LICENSE_FILE=./acme.license mesa-datasource serve --manifest .modu/connectors/csv-plant.json --port 7100

It exposes GET /items / GET /items/:id using the base rest pagination/filter contract (current/pageSize/_sort/_order/<field>), read-only. Point a base datasource at it:

{ "id": "plant", "kind": "rest", "baseUrl": "http://127.0.0.1:7100", "connector": "csv.plant", "resources": ["items"] }

The base validates .modu/connectors/*.json in modu check; Pro owns the connector runtime.

GraphQL connector

{
  "version": 1,
  "id": "gql.orders",
  "kind": "graphql",
  "title": "Orders GraphQL",
  "plugin": "datasource.graphql",
  "config": {
    "endpoint": "https://example.com/graphql",
    "query": "query { items { id name } }",
    "dataPath": "data.items",
    "resource": "items",
    "idColumn": "id"
  }
}

mesa-datasource serve --manifest .modu/connectors/gql-orders.json --port 7101 exposes the same read-only REST facade. The configured query is the only GraphQL operation executed; filters, sort and pagination are applied in memory. Requires datasource.graphql (or datasource / *).

SQLite connector

{
  "version": 1,
  "id": "sqlite.plant",
  "kind": "sqlite",
  "title": "Plant SQLite",
  "plugin": "datasource.sqlite",
  "config": { "path": "/abs/plant.db", "table": "items", "idColumn": "id" }
}

mesa-datasource serve --manifest .modu/connectors/sqlite-plant.json --port 7102 opens the database read-only (node:sqlite, no dependency) and exposes the REST facade. Requires datasource.sqlite (or datasource / *). The file path is resolved by the Pro process, not by the browser.

MQTT connector

{
  "version": 1,
  "id": "mqtt.plant",
  "kind": "mqtt",
  "title": "Plant MQTT",
  "plugin": "datasource.mqtt",
  "config": { "brokerUrl": "mqtt://127.0.0.1:1883", "topic": "plant/1", "resource": "items", "idColumn": "id" }
}

mesa-datasource serve --manifest .modu/connectors/mqtt-plant.json --port 7103 subscribes with a minimal MQTT 3.1.1 client and keeps the latest JSON messages (default 200). Requires datasource.mqtt (or datasource / *). No external dependency.

Redis connector

{
  "version": 1,
  "id": "redis.plant",
  "kind": "redis",
  "title": "Plant Redis",
  "plugin": "datasource.redis",
  "config": { "url": "redis://127.0.0.1:6379", "key": "plant:items", "dataPath": "", "resource": "items" }
}

mesa-datasource serve --manifest .modu/connectors/redis-plant.json --port 7104 sends only GET to Redis, parses the JSON value (array or object), and exposes the REST facade. Requires datasource.redis (or datasource / *). No write command is sent.

源文件 · mesa-pro/docs/datasource-plugins.md