Read-only mirror of https://github.com/StatistikStadtZuerich/MeLODy-claude-marketplace — Stadt Zürich. Issues & pull requests at the source.
  • HTML 70.6%
  • JavaScript 25.7%
  • Shell 3.7%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Thomas Kurz e261df428f Name the chart tool renderChart in the skill again
melody-charts is the MCP server; the tool it exposes is renderChart
(mcp-app/server.mjs), so the skill was telling the model to look for a tool
that does not exist. Reverts that line of 7a6b190.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 14:58:31 +02:00
.claude-plugin Package the chart app as an .mcpb bundle, built in CI 2026-08-07 14:47:00 +02:00
.github/workflows Package the chart app as an .mcpb bundle, built in CI 2026-08-07 14:47:00 +02:00
mcp-app Package the chart app as an .mcpb bundle, built in CI 2026-08-07 14:47:00 +02:00
skills/melody Name the chart tool renderChart in the skill again 2026-08-07 14:58:31 +02:00
.gitignore Package the chart app as an .mcpb bundle, built in CI 2026-08-07 14:47:00 +02:00
.mcp.json Switch to the integ MeLODy endpoint and prune resolved notes 2026-08-07 14:46:37 +02:00
idea.md Add MeLODy plugin for Claude Code and Cowork 2026-07-28 21:21:54 +02:00
README.md Package the chart app as an .mcpb bundle, built in CI 2026-08-07 14:47:00 +02:00

MeLODy plugin for Claude

Gives Claude access to Swiss statistical Linked Data cubes (Statistik Stadt Zürich and other open data providers) through the MeLODy MCP server, plus a skill that governs how the cube workflow is used and how answers are sourced.

NOTE: The current plugin points to the integratio instance of the MeLODy server, https://ld.integ.stadt-zuerich.ch/melody2/mcp.

The repository is both the plugin and its own single-plugin marketplace.

Contents

Path Purpose
.claude-plugin/plugin.json Plugin manifest
.claude-plugin/marketplace.json Marketplace entry pointing at this repo
.mcp.json Two MCP servers: the remote MeLODy cube server and the local chart app
skills/melody/SKILL.md The melody skill: tool workflow, answer style, citations, charts
mcp-app/start.sh Launcher for the chart server — resolves a node binary, then execs server.mjs
mcp-app/server.mjs Local stdio MCP server exposing renderChart (dependency-free, plain node)
mcp-app/ui/chart.html The MCP App view: interactive SVG line/bar chart, host-themed
mcp-app/manifest.json MCPB manifest — makes mcp-app/ packable as a one-click .mcpb bundle
.github/workflows/mcpb.yml Builds, smoke-tests and publishes melody-charts-<version>.mcpb

Install

Cowork

  1. Settings → Plugins → Add marketplace → GitHub repo → StatistikStadtZuerich/MeLODy-claude-marketplace
  2. Install the melody plugin from that marketplace
  3. Approve the MeLODy MCP server when prompted

Claude Code

/plugin marketplace add StatistikStadtZuerich/MeLODy-claude-marketplace   # or a local path during development
/plugin install melody@melody

Restart Claude Code, then check /mcp — melody should be connected and expose listCubeProviders, suggestCubes, getCubeInformation, lookupResources, queryCubeData.

Use

Just ask, in German or English:

  • "Wie viele Einwohner hat die Stadt Zürich?"
  • "Vergleiche die Bevölkerungsentwicklung der Kreise 4 und 5."
  • "Zeig mir die Entwicklung als Diagramm."

The skill loads automatically for statistical/cube questions; /melody:melody invokes it explicitly. Answers cite their source as **Provider**: [cube name](cube iri), and the skill will say when data is not available rather than filling the gap.

Interactive charts (MCP App) - experimental!

The plugin bundles a second, local MCP server (melody-charts) with one UI-enabled tool, renderChart. It implements the MCP Apps extension (io.modelcontextprotocol/ui, spec 2026-01-26): the tool points at a ui://melody/chart resource, the host renders that HTML in a sandboxed iframe, and the chart draws itself from the tool result. In hosts without MCP Apps support the same tool returns a plain-text table of the numbers.

  • No dependencies and no network: a single node script plus one self-contained HTML file. Requirement is only node on PATH where the MCP client runs.
  • The server never fetches data. The agent queries the cubes with the MeLODy tools and passes the values in, so the chart cannot drift from the cited source.
  • Palette: the brand colours, but only three series per chart — the two brand hue families do not yield more distinguishable steps. Light uses #0F05A0 / #A31413 / #6496FF; dark uses selected lighter steps #9A96FF / #FF6B63 / #C5DBFF so marks stay above 3:1 contrast on a dark surface. Series 4+ fall back to neutrals with direct labels. Gaps stay gaps: null is never interpolated.
  • Charts render inline in Cowork and Claude Desktop. In the Claude Code terminal nothing renders inline — there the skill falls back to a self-contained HTML file or an Artifact.

Install the chart app

Pick one route — they all install the same server:

Host Route Needs node installed?
Claude Desktop 1 — the .mcpb bundle no
Cowork 2 — with the plugin yes
Claude Code 2 — with the plugin, or 4 — claude mcp add yes

Routes 2–4 run the server with the machine's own node (18 or newer). There is nothing to build and no npm install in any case — the server is one file with no dependencies.

1. .mcpb bundle (Claude Desktop, one click). Download melody-charts-<version>.mcpb from the latest release, then drag it onto Claude Desktop's Settings → Extensions, or double-click it in Finder/Explorer. MCPB is a zip of the server plus a manifest.json that tells the host how to launch it — the same idea as .vsix for VS Code. Claude Desktop ships its own Node runtime and uses it for type: node bundles, so this route needs no node on the machine and no launcher script, which is exactly the failure mode routes 2–4 have to work around (see below).

The bundles are unsigned, so Claude Desktop labels the extension as coming from an unverified publisher on install. Only the chart server is bundled this way; the MeLODy cube server is remote and the skill is plugin-only, so the .mcpb is a companion to the plugin, not a replacement for it.

To build it yourself instead of downloading — output lands in dist/:

npx @anthropic-ai/mcpb@2 validate mcp-app/manifest.json
npx @anthropic-ai/mcpb@2 pack mcp-app dist/melody-charts.mcpb

.github/workflows/mcpb.yml does the same on every push to main, on pull requests touching mcp-app/**, and on demand, keeping the result as a workflow artifact named melody-charts-mcpb. It does not just pack: it unpacks the packed bundle again and drives a real initialize, tools/list and resources/read through the entry point the manifest names, so a bundle that would fail to start cannot be published. Pushing a v* tag sets the manifest version from the tag and attaches the bundle to that GitHub release.

2. With the plugin (nothing to configure). Currently not yet enabled in Claude Cowork.

3. Standalone config entry in Claude Desktop / Cowork. Settings → Developer → Edit Config, or edit the file directly:

Platform Config file
macOS ~/Library/Application Support/Claude/claude_desktop_config.json
Windows %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "melody-charts": {
      "command": "/absolute/path/to/claude-melody/mcp-app/start.sh"
    }
  }
}

Restart the app afterwards. On Windows there is no sh, so point at node instead:

{
  "mcpServers": {
    "melody-charts": {
      "command": "node",
      "args": ["C:\\absolute\\path\\to\\claude-melody\\mcp-app\\server.mjs"]
    }
  }
}

4. Standalone in Claude Code (Claude Code has no .mcpb install path — use this or the plugin):

claude mcp add --scope user --transport stdio melody-charts -- /absolute/path/to/claude-melody/mcp-app/start.sh

Why the launcher instead of command: "node" — routes 2–4 only; the .mcpb never uses it, which is why start.sh is excluded from the bundle via mcp-app/.mcpbignore. GUI-launched hosts start MCP servers with a minimal PATH that typically excludes nvm and Homebrew, so a bare node fails with ENOENT/Connection closed. start.sh resolves node from PATH, then /opt/homebrew/bin, /usr/local/bin, /usr/bin, then the highest ~/.nvm/versions/node/*, and exits with a readable message (no node runtime found, status 127) if none exists. If you need a specific runtime, set command to that node binary's absolute path and pass mcp-app/server.mjs as the argument.

Develop and debug

Open mcp-app/ui/chart.html inside a page that answers ui/initialize and sends ui/notifications/tool-input to exercise the view without a host; drive the server directly with newline-delimited JSON-RPC on stdin:

printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"x","version":"1"}}}' \
  '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' | node mcp-app/server.mjs

Note when you open this repo in Claude Code

The plugin's .mcp.json has to sit at the plugin root, so opening this repository as a project makes Claude Code read it a second time as a project-scoped config, where ${CLAUDE_PLUGIN_ROOT} is not defined. You will see melody-charts … Missing environment variables: CLAUDE_PLUGIN_ROOT next to the working plugin:melody:melody-charts entry. Ignore the project-scoped one; it only appears while developing the plugin in place.