@flowrelay/mcp-server 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +76 -51
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -5,6 +5,9 @@ import { z } from 'zod';
5
5
  import { FlowRelayAPI } from './api.js';
6
6
  import { createRequire } from 'node:module';
7
7
  const { version: PKG_VERSION } = createRequire(import.meta.url)('../package.json');
8
+ // Canonical source vocabulary. Mirrors ALL_SOURCES in the web app's @/types
9
+ // (this is a separate published package, so it can't import it). The parity
10
+ // test tests/client-source-parity.test.ts fails if the two ever diverge.
8
11
  const SOURCES = [
9
12
  'github',
10
13
  'slack',
@@ -21,17 +24,19 @@ const SOURCES = [
21
24
  'microsoft_teams',
22
25
  'sentry',
23
26
  'datadog',
27
+ 'pagerduty',
28
+ 'asana',
24
29
  ];
25
30
  const SourceEnum = z.enum(SOURCES);
26
31
  const SourceFilterSchema = z.object({
27
- projects: z.array(z.string()).optional().describe('Filter to specific repos, channels, projects, or teams'),
28
- eventTypes: z.array(z.string()).optional().describe('Filter to specific event types (e.g. "push", "issue_created")'),
29
- branches: z.array(z.string()).optional().describe('Git branch names (e.g. "main", "develop") – versioning sources only'),
30
- priorities: z.array(z.string()).optional().describe('Priority levels (e.g. "high", "urgent") – Jira, Linear, Sentry only'),
32
+ projects: z.array(z.string()).optional().describe('Resource ids from list_filter_options[source].projects (repos, channels, boards). Use the exact id, not the display label.'),
33
+ eventTypes: z.array(z.string()).optional().describe('Event-type values from list_filter_options (e.g. "push", "issue_created"). Case-sensitive; provider-driven. A value that does not exist matches no events (it is not rejected).'),
34
+ branches: z.array(z.string()).optional().describe('Git branch names (e.g. "main", "develop") – git sources only (github, gitlab, bitbucket, azure_devops). Using this on a non-git source is a 400.'),
35
+ priorities: z.array(z.string()).optional().describe('Priority values from list_filter_options (e.g. "high", "urgent") – jira, linear, sentry, pagerduty only. Using this on another source is a 400; unrecognized values simply match no events.'),
31
36
  });
32
37
  const FiltersSchema = z.record(z.string(), SourceFilterSchema)
33
38
  .optional()
34
- .describe('Per-source advanced filters, AND-combined across dimensions');
39
+ .describe('Per-source advanced filters, AND-combined across dimensions. Keys MUST be source ids (an unknown source id is rejected with 400). The dimension VALUES are matched leniently – call list_filter_options first to get the real selectable values for the project rather than guessing.');
35
40
  function normalizeProjectId(value) {
36
41
  if (typeof value !== 'string')
37
42
  return null;
@@ -62,6 +67,26 @@ let activeProjectId = normalizeProjectId(process.env.FLOWRELAY_PROJECT_ID);
62
67
  const server = new McpServer({
63
68
  name: 'flowrelay',
64
69
  version: PKG_VERSION,
70
+ websiteUrl: 'https://www.flowrelay.it',
71
+ icons: [
72
+ { src: 'https://www.flowrelay.it/icon.png', mimeType: 'image/png', sizes: ['1024x1024'] },
73
+ ],
74
+ }, {
75
+ instructions: [
76
+ 'Flow Relay captures your team\'s work context from connected integrations (GitHub, Slack, Jira, Linear, and more) and synthesizes it into two kinds of artifact:',
77
+ '- A HANDOFF: a snapshot of recent activity, decisions, open questions and next steps for a project – used to hand work off or catch up.',
78
+ '- An INSIGHT, in three flavors: CORRELATION (links related events across different sources), ONBOARDING BRIEF (a getting-started guide for someone new to the project) and ARCHITECTURE (trade-offs, risks and patterns inferred from the code).',
79
+ '',
80
+ 'Typical flow:',
81
+ '1. Call list_projects to see accessible projects and their ids. Every id you ever pass (project, handoff, insight, Discord channel) comes from a list_* tool – never invent one.',
82
+ '2. Optionally set_active_project so later tools can omit project_id.',
83
+ '3. Before generating with filters, call list_filter_options to get the real selectable values for that project.',
84
+ '4. Call a generate_* tool. These run the AI synchronously here: the tool waits for completion (tens of seconds) and returns the finished artifact as Markdown – you do not poll.',
85
+ '',
86
+ 'Cost: every generate_* call consumes credits from the user\'s plan and is charged once on success (architecture is the deepest and most expensive, handoff the cheapest). Do not regenerate an artifact you can retrieve with list_handoffs / list_insights, and confirm intent before generating repeatedly.',
87
+ '',
88
+ 'Scope and access follow the API key\'s tenant role; a tool only ever sees projects the key can access.',
89
+ ].join('\n'),
65
90
  });
66
91
  async function getTenantContext() {
67
92
  const context = await api.listProjects();
@@ -99,7 +124,7 @@ async function requireProject(projectId) {
99
124
  return { projectId: resolvedProjectId, project };
100
125
  }
101
126
  // ── Tool: workspace context ─────────────────────────────────────────
102
- server.tool('get_workspace_context', 'Show Flow Relay tenant context: personal/business mode, active project scope, and current role.', {}, async () => {
127
+ server.tool('get_workspace_context', 'Show the current Flow Relay context: personal vs business mode, number of organizations and accessible projects, the active project scope and the caller\'s role. Good first call to orient yourself before other tools.', {}, async () => {
103
128
  const context = await getTenantContext();
104
129
  const activeProject = activeProjectId
105
130
  ? context.projects.find((project) => project.id === activeProjectId) ?? null
@@ -118,7 +143,7 @@ server.tool('get_workspace_context', 'Show Flow Relay tenant context: personal/b
118
143
  return { content: [{ type: 'text', text: lines.join('\n') }] };
119
144
  });
120
145
  // ── Tool: list projects ─────────────────────────────────────────────
121
- server.tool('list_projects', 'List all projects available to this API key, including personal and organization projects with role information.', {}, async () => {
146
+ server.tool('list_projects', 'List every project the API key can access (personal and organization), each with its id, scope and the caller\'s role. The id returned here is what you pass as project_id to the generate_* and list tools – start here whenever you need one.', {}, async () => {
122
147
  const context = await getTenantContext();
123
148
  if (context.projects.length === 0) {
124
149
  return {
@@ -143,9 +168,9 @@ server.tool('list_projects', 'List all projects available to this API key, inclu
143
168
  };
144
169
  });
145
170
  // ── Tool: set active project ────────────────────────────────────────
146
- server.tool('set_active_project', 'Set or clear the active project context used by project-aware tools when project_id is omitted.', {
147
- project_id: z.string().optional().describe('Project ID to set as active. Omit to clear.'),
148
- clear: z.boolean().default(false).describe('Clear active project and use no-project personal scope.'),
171
+ server.tool('set_active_project', 'Set the active project so later tools can omit project_id (a convenience for a multi-step session on one project). Set it once from a list_projects id, then call generate_handoff / list_events / etc. without repeating project_id. Not required if you always pass project_id explicitly.', {
172
+ project_id: z.string().optional().describe('Project id (from list_projects) to set as active. Omit, or set clear, to unset it.'),
173
+ clear: z.boolean().default(false).describe('Clear the active project. Generation then requires an explicit project_id again.'),
149
174
  }, async ({ project_id, clear }) => {
150
175
  if (clear || !normalizeProjectId(project_id)) {
151
176
  activeProjectId = null;
@@ -170,10 +195,10 @@ server.tool('set_active_project', 'Set or clear the active project context used
170
195
  };
171
196
  });
172
197
  // ── Tool: list handoffs ──────────────────────────────────────────────
173
- server.tool('list_handoffs', 'List Flow Relay handoffs in the current tenant scope (all accessible projects or selected project).', {
174
- status: z.enum(['active', 'archived', 'all']).default('active').describe('Filter by status ("all" returns every status)'),
175
- limit: z.number().min(1).max(50).default(10).describe('Max number of handoffs to return'),
176
- project_id: z.string().optional().describe('Optional project scope override for this call.'),
198
+ server.tool('list_handoffs', 'List existing handoffs (newest first) with their full content, across all accessible projects or one project. Use this to read what has already been generated before spending credits on a new generate_handoff. Each row\'s id can be sent to Discord via discord_send_message.', {
199
+ status: z.enum(['active', 'archived', 'all']).default('active').describe('active = current handoffs, archived = superseded ones, all = both.'),
200
+ limit: z.number().int().min(1).max(50).default(10).describe('Max handoffs to return (1-50, default 10).'),
201
+ project_id: z.string().optional().describe('Project id (from list_projects) to scope to. Omit to span every accessible project, or rely on the active project.'),
177
202
  }, async ({ status, limit, project_id }) => {
178
203
  const explicitProjectId = normalizeProjectId(project_id);
179
204
  const resolvedProjectId = explicitProjectId ?? activeProjectId;
@@ -208,12 +233,12 @@ server.tool('list_handoffs', 'List Flow Relay handoffs in the current tenant sco
208
233
  return { content: [{ type: 'text', text }] };
209
234
  });
210
235
  // ── Tool: generate handoff ───────────────────────────────────────────
211
- server.tool('generate_handoff', 'Generate a new context handoff for the active project. Requires an active project or explicit project_id. Supports per-source filters.', {
236
+ server.tool('generate_handoff', 'Generate a project handoff: an AI summary of recent activity, key changes, decisions, open questions and next steps for a project. Runs synchronously – waits for completion (tens of seconds) and returns the finished Markdown. Requires an active project (set_active_project) or an explicit project_id from list_projects. Consumes credits from the user\'s plan, charged once on success – prefer list_handoffs to read an existing one before generating a new one. To scope it, pass sources and/or filters (call list_filter_options first for valid values); omit both to use the project\'s saved scope preferences.', {
212
237
  sources: z.array(SourceEnum)
213
238
  .optional()
214
- .describe('Specific sources to include (omit for all connected sources)'),
239
+ .describe('Restrict to these source ids (omit for all connected sources). Unknown source ids are rejected with 400.'),
215
240
  filters: FiltersSchema,
216
- project_id: z.string().optional().describe('Optional project scope override for this call.'),
241
+ project_id: z.string().optional().describe('Project id from list_projects. Overrides the active project for this call; required if no active project is set.'),
217
242
  }, async ({ sources, filters, project_id }) => {
218
243
  try {
219
244
  const resolved = await requireProject(project_id);
@@ -233,8 +258,8 @@ server.tool('generate_handoff', 'Generate a new context handoff for the active p
233
258
  }
234
259
  });
235
260
  // ── Tool: list integrations ─────────────────────────────────────────
236
- server.tool('list_integrations', 'List integrations in the current scope. In project scope this returns project resources with health metadata.', {
237
- project_id: z.string().optional().describe('Optional project scope override for this call.'),
261
+ server.tool('list_integrations', 'List connected integrations. With a project scope it returns the resources bound to that project plus their health (connection status, provider coverage); without one it returns the sources the API key owner has connected. Use it to check what data a generation can draw on.', {
262
+ project_id: z.string().optional().describe('Project id (from list_projects) for project-scoped resources. Omit (or rely on the active project) for the owner\'s connected sources.'),
238
263
  }, async ({ project_id }) => {
239
264
  const resolved = await resolveProject(project_id);
240
265
  const { integrations } = await api.listIntegrations(resolved.projectId);
@@ -256,7 +281,7 @@ server.tool('list_integrations', 'List integrations in the current scope. In pro
256
281
  return { content: [{ type: 'text', text: `**Connected integrations:**\n${text}` }] };
257
282
  });
258
283
  // ── Tool: list untracked resources ───────────────────────────────────
259
- server.tool('list_untracked_resources', 'List discovered active resources across all connected user integrations that have not yet been assigned to any project.', {}, async () => {
284
+ server.tool('list_untracked_resources', 'List active resources (repos, channels, boards) that produced events recently but are not yet assigned to any project. Use it to spot data the user connected but has not organized into a project yet – mapping them (in the web dashboard) makes their events available to generations.', {}, async () => {
260
285
  try {
261
286
  const resources = await api.listUntrackedResources();
262
287
  if (resources.length === 0) {
@@ -282,12 +307,12 @@ server.tool('list_untracked_resources', 'List discovered active resources across
282
307
  }
283
308
  });
284
309
  // ── Tool: list recent events ─────────────────────────────────────────
285
- server.tool('list_events', 'List recent context events in current scope (personal or selected project).', {
310
+ server.tool('list_events', 'List recent raw context events (individual pieces of tracked activity: a push, a message, an issue update) newest first. Use it to inspect the underlying signal a generation would draw on, or to check whether a source is producing data. With a project scope it is limited to that project\'s bound resources.', {
286
311
  source: SourceEnum
287
312
  .optional()
288
- .describe('Filter by integration source'),
289
- limit: z.number().min(1).max(100).default(20).describe('Max number of events'),
290
- project_id: z.string().optional().describe('Optional project scope override for this call.'),
313
+ .describe('Restrict to one source id (e.g. "github"). Unknown ids are rejected with 400.'),
314
+ limit: z.number().int().min(1).max(100).default(20).describe('Max events to return (1-100, default 20).'),
315
+ project_id: z.string().optional().describe('Project id (from list_projects) to scope to. Omit (or rely on the active project) for the owner\'s personal-stream events.'),
291
316
  }, async ({ source, limit, project_id }) => {
292
317
  const resolved = await resolveProject(project_id);
293
318
  const { events } = await api.listEvents(source, limit, resolved.projectId);
@@ -303,7 +328,7 @@ server.tool('list_events', 'List recent context events in current scope (persona
303
328
  return { content: [{ type: 'text', text: `**Recent events:**\n${text}` }] };
304
329
  });
305
330
  // ── Tool: discord list channels ──────────────────────────────────────
306
- server.tool('discord_list_channels', 'List text channels in your connected Discord server.', {}, async () => {
331
+ server.tool('discord_list_channels', 'List the text channels in the Discord server connected to this account, each with its id. Call this to get a channel_id before discord_send_message.', {}, async () => {
307
332
  try {
308
333
  const { channels } = await api.discordListChannels();
309
334
  if (channels.length === 0) {
@@ -321,10 +346,10 @@ server.tool('discord_list_channels', 'List text channels in your connected Disco
321
346
  });
322
347
  // ── Tool: discord send message ──────────────────────────────────────
323
348
  server.tool('discord_send_message', 'Send to a Discord channel in your connected server. Provide exactly one of: content (inline text); handoff_id or insight_id (sends that artifact, rendered to Markdown, as a .md file attachment); or artifact (last_handoff / last_correlation / last_onboarding / last_architecture, with project_id) to send the latest active artifact of that kind.', {
324
- channel_id: z.string().describe('The Discord channel ID to send to'),
349
+ channel_id: z.string().describe('Discord channel id from discord_list_channels.'),
325
350
  content: z.string().optional().describe('Inline message text. Mutually exclusive with handoff_id / insight_id / artifact'),
326
- handoff_id: z.string().optional().describe('UUID of a handoff to render and attach as a .md file'),
327
- insight_id: z.string().optional().describe('UUID of an insight to render and attach as a .md file'),
351
+ handoff_id: z.string().optional().describe('Id of a handoff (from list_handoffs) to render and attach as a .md file'),
352
+ insight_id: z.string().optional().describe('Id of an insight (from list_insights) to render and attach as a .md file'),
328
353
  artifact: z
329
354
  .enum(['last_handoff', 'last_correlation', 'last_onboarding', 'last_architecture'])
330
355
  .optional()
@@ -343,12 +368,12 @@ server.tool('discord_send_message', 'Send to a Discord channel in your connected
343
368
  }
344
369
  });
345
370
  // ── Tool: generate correlation insight ──────────────────────────────
346
- server.tool('generate_correlation_insight', 'Generate a cross-source correlation AI insight for the specified project scope.', {
347
- project_id: z.string().describe('The project ID scope to generate the correlation insight for.'),
348
- sources: z.array(SourceEnum).optional().describe('Filter events to specific sources (e.g. "github", "slack")'),
371
+ server.tool('generate_correlation_insight', 'Generate a cross-source correlation insight: finds related events across different sources (e.g. a Slack thread, a Jira ticket and the PR that resolved it) and surfaces the links, patterns and open threads. Use when the user wants to understand how activity connects across tools. Runs synchronously and returns Markdown. Consumes credits, charged once on success. Call list_filter_options before using filters.', {
372
+ project_id: z.string().describe('Project id from list_projects to generate the insight for.'),
373
+ sources: z.array(SourceEnum).optional().describe('Restrict to these source ids (e.g. "github", "slack"). Unknown ids are rejected with 400.'),
349
374
  filters: FiltersSchema,
350
- lookback_hours: z.number().optional().describe('Number of hours of activity to analyze'),
351
- max_events: z.number().optional().describe('Maximum number of events to process'),
375
+ lookback_hours: z.number().int().optional().describe('Hours of activity to analyze (1-2160, default 168 = 7 days).'),
376
+ max_events: z.number().int().optional().describe('Cap on events processed (1-1000, default 150).'),
352
377
  }, async ({ project_id, sources, filters, lookback_hours, max_events }) => {
353
378
  try {
354
379
  const res = await api.generateInsight(project_id, 'correlation', {
@@ -370,14 +395,14 @@ server.tool('generate_correlation_insight', 'Generate a cross-source correlation
370
395
  }
371
396
  });
372
397
  // ── Tool: generate onboarding brief ──────────────────────────────────
373
- server.tool('generate_onboarding_brief', 'Generate an onboarding brief AI insight for the specified project scope.', {
374
- project_id: z.string().describe('The project ID scope to generate the onboarding brief for.'),
375
- sources: z.array(SourceEnum).optional().describe('Filter events to specific sources'),
398
+ server.tool('generate_onboarding_brief', 'Generate an onboarding brief: a getting-started guide for someone new to the project – key people, key decisions, pitfalls and recommended reading drawn from recent activity. Use when a new team member needs to get up to speed. Runs synchronously and returns Markdown. Consumes credits, charged once on success. Call list_filter_options before using filters.', {
399
+ project_id: z.string().describe('Project id from list_projects to generate the brief for.'),
400
+ sources: z.array(SourceEnum).optional().describe('Restrict to these source ids. Unknown ids are rejected with 400.'),
376
401
  filters: FiltersSchema,
377
- new_member_role: z.string().optional().describe('Expected role/focus of the new team member'),
378
- focus_area: z.string().optional().describe('Specific repository or feature area they will work on'),
379
- lookback_days: z.number().optional().describe('Number of days of history to review'),
380
- max_events: z.number().optional().describe('Maximum events to process'),
402
+ new_member_role: z.string().optional().describe('Role/focus of the person being onboarded (e.g. "backend engineer"). Tailors the brief.'),
403
+ focus_area: z.string().optional().describe('Repository or feature area they will work on. Narrows the brief.'),
404
+ lookback_days: z.number().int().optional().describe('Days of history to review (1-365, default 30).'),
405
+ max_events: z.number().int().optional().describe('Cap on events processed (1-1000, default 400).'),
381
406
  }, async ({ project_id, sources, filters, new_member_role, focus_area, lookback_days, max_events }) => {
382
407
  try {
383
408
  const res = await api.generateInsight(project_id, 'onboarding', {
@@ -401,13 +426,13 @@ server.tool('generate_onboarding_brief', 'Generate an onboarding brief AI insigh
401
426
  }
402
427
  });
403
428
  // ── Tool: generate architecture insight ─────────────────────────────
404
- server.tool('generate_architecture_insight', 'Generate an architecture insight AI insight for the specified project scope.', {
405
- project_id: z.string().describe('The project ID scope to generate the architecture insight for.'),
406
- sources: z.array(SourceEnum).optional().describe('Filter events to specific sources'),
429
+ server.tool('generate_architecture_insight', 'Generate an architecture insight: trade-offs, risks, patterns and recommendations inferred from the project\'s code activity (requires a connected code source – github, gitlab, bitbucket or azure_devops). This is the deepest and most expensive insight (it runs extended reasoning). Use for technical review of architectural direction. Runs synchronously and returns Markdown. Consumes credits, charged once on success. Call list_filter_options before using filters.', {
430
+ project_id: z.string().describe('Project id from list_projects to generate the insight for.'),
431
+ sources: z.array(SourceEnum).optional().describe('Restrict to these source ids. Unknown ids are rejected with 400.'),
407
432
  filters: FiltersSchema,
408
- focus_question: z.string().optional().describe('Specific architectural question or component to focus on'),
409
- lookback_days: z.number().optional().describe('Number of days of history to review'),
410
- max_events: z.number().optional().describe('Maximum events to process'),
433
+ focus_question: z.string().optional().describe('A specific architectural question or component to investigate (e.g. "is the billing layer coupled to providers?").'),
434
+ lookback_days: z.number().int().optional().describe('Days of history to review (1-365, default 14).'),
435
+ max_events: z.number().int().optional().describe('Cap on events processed (1-1000, default 250).'),
411
436
  }, async ({ project_id, sources, filters, focus_question, lookback_days, max_events }) => {
412
437
  try {
413
438
  const res = await api.generateInsight(project_id, 'architecture', {
@@ -430,11 +455,11 @@ server.tool('generate_architecture_insight', 'Generate an architecture insight A
430
455
  }
431
456
  });
432
457
  // ── Tool: list insights ─────────────────────────────────────────────
433
- server.tool('list_insights', 'List project AI insights for a selected project scope.', {
434
- project_id: z.string().describe('The project ID context to list insights for.'),
435
- kind: z.enum(['onboarding_brief', 'cross_source_correlation', 'architecture_insight']).optional().describe('Filter by insight kind'),
436
- status: z.enum(['active', 'archived', 'all']).default('active').describe('Filter by status ("all" returns every status)'),
437
- limit: z.number().min(1).max(50).default(20).describe('Max number of insights to return'),
458
+ server.tool('list_insights', 'List existing insights for a project (newest first) with their content. Use this to read what has already been generated before spending credits on a new generate_*_insight. Each row\'s id can be sent to Discord via discord_send_message.', {
459
+ project_id: z.string().describe('Project id from list_projects to list insights for.'),
460
+ kind: z.enum(['onboarding_brief', 'cross_source_correlation', 'architecture_insight']).optional().describe('Restrict to one kind (matches the three generate_*_insight tools). Omit for all kinds.'),
461
+ status: z.enum(['active', 'archived', 'all']).default('active').describe('active = current, archived = superseded, all = both.'),
462
+ limit: z.number().int().min(1).max(50).default(20).describe('Max insights to return (1-50, default 20).'),
438
463
  }, async ({ project_id, kind, status, limit }) => {
439
464
  try {
440
465
  const { insights } = await api.listInsights(project_id, kind, status, limit);
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@flowrelay/mcp-server",
3
- "version": "1.0.4",
4
- "description": "Flow Relay MCP Server for Claude Desktop and Claude Code – handoffs, integrations, and context events via natural conversation.",
3
+ "version": "1.0.5",
4
+ "description": "Flow Relay MCP Server for Claude Desktop and Claude Code – handoffs, integrations and context events via natural conversation.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
- "author": "Adriano Sorbello",
7
+ "author": "atrisorb",
8
8
  "homepage": "https://www.flowrelay.it",
9
9
  "repository": {
10
10
  "type": "git",