Fitaily MCP
DeepSeek Harness: Dashboards panel
A custom “Dashboards” panel in DeepSeek Harness: charts from your Fitaily data, a range switcher and new dashboards created through the agent. Easiest path: paste a prompt or a link to this page to your agent and let it build the panel.
MCP first
This panel reads data through Fitaily MCP, so connect it first. Guide: DeepSeek Harness: connect MCP.
Start here: ask the agent#
You do not have to write the panel code. Open a DSH session, paste the prompt below, and the agent creates the dashboard, builds the bundle, installs it and checks the access gate. You approve data access and review the result.
Zbuduj panel "Dashboardy" dla Fitaily MCP w DeepSeek Harness.
Najpierw sprawdź, czy serwer fitaily jest podłączony
(Settings > MCP, status connected). Jeśli nie, zatrzymaj się
i powiedz, czego brakuje.
1. Utwórz dashboard: waga (line_chart, latest), aktualna waga
(metric) i kalorie (bar_chart, sum) w zakresie 30 dni.
2. Zanim utworzysz dashboard, pokaż mi dokładną nazwę,
konfigurację i widgety i poczekaj na moją zgodę w czacie.
Dopiero po potwierdzeniu wywołaj create_dashboard z tym samym
clientRequestId.
3. Zbuduj bundle @local/fitaily-dash: trasa /fitaily-dash/api/*
za bramką connection.admit, strona w slocie main, przycisk
w sidebar.panellist.
4. Zakres dat czytaj przez get_metric_analytics, bo get_dashboard
ignoruje from i to. Dane widgetu siedzą w widget.data.points.
5. Zainstaluj bundle i sprawdź, że /fitaily-dash/api/health
zwraca 401 bez logowania.
6. Pokaż mi panel i powiedz, co mam kliknąć, jeśli coś nie działa.Build a "Dashboards" panel for Fitaily MCP in DeepSeek Harness.
First check that the fitaily server is connected
(Settings > MCP, status connected). If not, stop and tell me
what is missing.
1. Create a dashboard: weight (line_chart, latest), current weight
(metric) and calories (bar_chart, sum) over a 30 day range.
2. Before creating the dashboard, show me the exact name,
configuration and widgets and wait for my approval in the chat.
Only after I confirm, call create_dashboard with the same
clientRequestId.
3. Build the @local/fitaily-dash bundle: a /fitaily-dash/api/*
route behind the connection.admit gate, a page in the main slot,
a button in sidebar.panellist.
4. Read the date range through get_metric_analytics, because
get_dashboard ignores from and to. Widget data lives in
widget.data.points.
5. Install the bundle and verify that /fitaily-dash/api/health
returns 401 when signed out.
6. Show me the panel and tell me what to click if something is off.Even simpler: a link to this page
Got an agent with terminal and file access? Paste https://fitaily.com/docs/guides/dsh-dashboard/en and say “do it”. The agent walks the steps itself and you only confirm sign-in and consent. You can also paste a link to an earlier conversation if the MCP setup already happened there.
Below is the full path the agent takes for you. Read it if you want to understand the mechanics or the agent gets stuck on a step.
1. Create a dashboard (in-chat confirmation)#
A write in Fitaily runs after your approval in the chat. Show the user the exact name, configuration and widgets, wait for “yes”, and only then call create_dashboard with the same clientRequestId.
Show the exact operation
The name, description, config and widget list that will be created.
Wait for approval in the chat
The user replies “yes” or asks for changes.
Call create_dashboard
Same clientRequestId; the tool creates the dashboard immediately and returns its id.
{
"name": "Waga i kalorie 30 dni",
"description": "Trend wagi, kalorie i aktualna waga.",
"clientRequestId": "dsh-fitaily-dash-0002",
"config": {
"schemaVersion": 1,
"title": "Waga i kalorie 30 dni",
"period": { "type": "rolling", "days": 30 },
"layout": { "columns": 12 },
"widgets": [
{ "id": "w-weight", "type": "line_chart", "title": "Waga (kg)", "metric": "body.weight", "aggregation": "latest", "columns": 8 },
{ "id": "w-weight-now", "type": "metric", "title": "Aktualna waga", "metric": "body.weight", "aggregation": "latest", "columns": 4 },
{ "id": "w-calories", "type": "bar_chart", "title": "Kalorie dziennie", "metric": "nutrition.calories", "aggregation": "sum", "columns": 12 }
]
}
}Show the exact configuration
Widget data lives in widget.data.points, not in widget.points. Take metric ids from get_available_metrics, never from memory.
{ "widgets": [ { "id": "w-weight", "data": { "value": 77.2, "unit": "kg",
"points": [ { "date": "2026-11-02", "value": 77.1 } ], "daysWithData": 8 } } ],
"period": { "from": "2026-11-01", "to": "2026-12-01" } }2. Build the “Dashboards” panel#
Bundle structure#
| File | Role |
|---|---|
package.json | dsh.bundle.patch (Host) plus dsh.client (browser), ./client, ./icon, ./locale/*.json exports and files |
cordis.patch.yml | inserts the Host row: - insert: [{id: fitaily-dash, name: "@local/fitaily-dash"}] |
index.js | /fitaily-dash/api/* route: auth gate, MCP calls, date-range override |
client.js | main slot page, sidebar.panellist button and preferences |
locale/pl.json, en.json | meta.title and meta.description shown in Plugins |
icon.svg | own icon (up to 256 KiB) |
Host: route and gate#
- Register the route only once
connection,toolsandwebServerexist:ctx.effect(() => ctx.inject([...], child => child.effect(() => child.webServer.register({kind:"prefix", path:"/fitaily-dash", handler}))).dispose). - Gate:
connection.requestRejection(req)returns a status, andundefinedmeans allowed. Whenpeeris available, checkpeer.principal.kind === "owner". Never degrade to anonymous. - Calls:
ctx.tools.execute({ calls: [{ type:"tool-call", id, name, arguments: JSON.stringify(args) }], signal }).agentis optional, so it also works outside a turn. - Prefer
mcp_execute_tool(broker) when present, otherwise call the direct name.
Date range: the key pitfall#
get_dashboard ignores the requested range and always uses config.period. For a custom range: (1) fetch the dashboard and take config.widgets, (2) call get_metric_analytics { metric, from, to } per unique metric, (3) rebuild: widget.data = { value, points, unit, daysWithData }, period = { from, to }, rangeOverride: true.
Aggregation per widget.aggregation: sum, average, min, max, latest. Query: GET /fitaily-dash/api/dashboard?id=…&from=YYYY-MM-DD&to=YYYY-MM-DD, validating the format and both ends (400).
Client: page and persistence#
- Button:
ctx.slots.register({ name:"sidebar.panellist", id:"fitaily-dash", order:20, label:"Dashboards" }, Icon). - Page:
ctx.slots.register({ name:"main", key:"fitaily-dash" }, Page). Themainslot is keyed by thesidebar.panellistid. - Preferences (dashboard and range) in
localStorageunderfitaily-dash:prefs, normalized on start. - Style only from theme tokens (
--dsw-alias-*). Draw charts with your own SVG, no external libraries. - Detect a “stale Host”: a range is selected but the response has no
rangeOverride, so show a restart warning.
Install and verify#
plugin_manager install_bundle target=/Users/<ty>/.../default-workspace/fitaily-dash
curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:<port>/fitaily-dash/api/health # 401 = bramka działaThe local directory is linked (link:… in the profile), so further changes need no reinstall. 401 {"error":"Login required in DeepSeek Harness."} means the route exists and rejects anonymous callers. That is expected.
What the finished panel looks like#

- Left rail: the
Dashboardsitem is highlighted because the panel registered into thesidebar.panellistslot. Thefitailyworkspace sits under Workspaces. - Header: the dashboard title from the server plus a “read-only” note that says plainly that writes go through the agent, not the UI.
- Range switcher:
Per dashboard,7 days,30 days,90 days,Custom. The active range also shows in the “Range overridden” line together with the dashboard version. - Cards: a weight line chart (
WEIGHT (KG), 22 points), a latest-value tile (CURRENT WEIGHT, 79.2 kg) and a daily-calories bar chart (DAILY CALORIES, 9 points). Every card shows the point count and the actual date span returned by the server. That is the first thing to check when the data does not match the selected range. - Sparse bars are not a bug: 9 calorie points across 30 days means only days with logged meals exist in the database. The panel does not invent zeros, missing data stays missing.
- The
Refreshbutton: re-calls the MCP tools. If it does not help after a panel code change (a stale Host keeps serving the old route), you need a restart, not a refresh. See the rule below.
Checklist#
- At least one dashboard in Fitaily.
- Sidebar: “Dashboards”. The page renders a metric, line and bars.
- Range chips change the numbers and show “Range overridden”.
- After reload, the selected dashboard and range persist.
- Unauthenticated
curlon/fitaily-dash/api/*returns 401.
Panel pitfalls (7)#
| # | Symptom | Cause | Fix |
|---|---|---|---|
1 | Dashboard shows “No data” despite data | Renderer read widget.points, but the backend returns widget.data.points | Read via candidate.data |
2 | The dashboard is not created because there was no in-chat approval | Writes need in-chat approval | Show the exact configuration and wait for “yes”, then call create_dashboard |
3 | Two identical dashboards created | A different clientRequestId on retry | Reuse the same clientRequestId for retries of the same request |
4 | Range chips exist but numbers do not change | Stale index.js in the Host memory | Full restart (Cmd+Q), and a UI warning about this state |
5 | curl on the plugin route returns 401 | Owner-only gate | This is proof of security, not a bug |
6 | get_dashboard ignores the date range | It always uses config.period | get_metric_analytics per metric and rebuild the payload |
7 | client.js change not visible | Client module is cached | Cmd+R (linked bundle, so no reinstall) |
Refresh or restart?
client.js, styles and text: Cmd+R. index.js, cordis.patch.yml and a new Host row: full restart (Cmd+Q). A new bundle or version change: restart. New MCP tools: a new session.
Rollback and cleanup#
# Usuń panel (plugin_manager remove_bundle) target: @local/fitaily-dash
# Usuń dashboard: delete_dashboard (znowu z zatwierdzeniem) albo w aplikacji- Disable without deleting: Plugins, the
@local/fitaily-dashtoggle. - Dashboard data stays in Fitaily until you delete it through
delete_dashboardor in the app.