@flowrelay/mcp-server 1.0.4 → 1.0.6

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 +77 -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,20 @@ const SOURCES = [
21
24
  'microsoft_teams',
22
25
  'sentry',
23
26
  'datadog',
27
+ 'pagerduty',
28
+ 'asana',
29
+ 'gmail',
24
30
  ];
25
31
  const SourceEnum = z.enum(SOURCES);
26
32
  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'),
33
+ 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.'),
34
+ 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).'),
35
+ 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.'),
36
+ 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
37
  });
32
38
  const FiltersSchema = z.record(z.string(), SourceFilterSchema)
33
39
  .optional()
34
- .describe('Per-source advanced filters, AND-combined across dimensions');
40
+ .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
41
  function normalizeProjectId(value) {
36
42
  if (typeof value !== 'string')
37
43
  return null;
@@ -62,6 +68,26 @@ let activeProjectId = normalizeProjectId(process.env.FLOWRELAY_PROJECT_ID);
62
68
  const server = new McpServer({
63
69
  name: 'flowrelay',
64
70
  version: PKG_VERSION,
71
+ websiteUrl: 'https://www.flowrelay.it',
72
+ icons: [
73
+ { src: 'https://www.flowrelay.it/icon.png', mimeType: 'image/png', sizes: ['1024x1024'] },
74
+ ],
75
+ }, {
76
+ instructions: [
77
+ '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:',
78
+ '- A HANDOFF: a snapshot of recent activity, decisions, open questions and next steps for a project – used to hand work off or catch up.',
79
+ '- 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).',
80
+ '',
81
+ 'Typical flow:',
82
+ '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.',
83
+ '2. Optionally set_active_project so later tools can omit project_id.',
84
+ '3. Before generating with filters, call list_filter_options to get the real selectable values for that project.',
85
+ '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.',
86
+ '',
87
+ '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.',
88
+ '',
89
+ 'Scope and access follow the API key\'s tenant role; a tool only ever sees projects the key can access.',
90
+ ].join('\n'),
65
91
  });
66
92
  async function getTenantContext() {
67
93
  const context = await api.listProjects();
@@ -99,7 +125,7 @@ async function requireProject(projectId) {
99
125
  return { projectId: resolvedProjectId, project };
100
126
  }
101
127
  // ── Tool: workspace context ─────────────────────────────────────────
102
- server.tool('get_workspace_context', 'Show Flow Relay tenant context: personal/business mode, active project scope, and current role.', {}, async () => {
128
+ 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
129
  const context = await getTenantContext();
104
130
  const activeProject = activeProjectId
105
131
  ? context.projects.find((project) => project.id === activeProjectId) ?? null
@@ -118,7 +144,7 @@ server.tool('get_workspace_context', 'Show Flow Relay tenant context: personal/b
118
144
  return { content: [{ type: 'text', text: lines.join('\n') }] };
119
145
  });
120
146
  // ── 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 () => {
147
+ 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
148
  const context = await getTenantContext();
123
149
  if (context.projects.length === 0) {
124
150
  return {
@@ -143,9 +169,9 @@ server.tool('list_projects', 'List all projects available to this API key, inclu
143
169
  };
144
170
  });
145
171
  // ── 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.'),
172
+ 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.', {
173
+ project_id: z.string().optional().describe('Project id (from list_projects) to set as active. Omit, or set clear, to unset it.'),
174
+ clear: z.boolean().default(false).describe('Clear the active project. Generation then requires an explicit project_id again.'),
149
175
  }, async ({ project_id, clear }) => {
150
176
  if (clear || !normalizeProjectId(project_id)) {
151
177
  activeProjectId = null;
@@ -170,10 +196,10 @@ server.tool('set_active_project', 'Set or clear the active project context used
170
196
  };
171
197
  });
172
198
  // ── 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.'),
199
+ 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.', {
200
+ status: z.enum(['active', 'archived', 'all']).default('active').describe('active = current handoffs, archived = superseded ones, all = both.'),
201
+ limit: z.number().int().min(1).max(50).default(10).describe('Max handoffs to return (1-50, default 10).'),
202
+ 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
203
  }, async ({ status, limit, project_id }) => {
178
204
  const explicitProjectId = normalizeProjectId(project_id);
179
205
  const resolvedProjectId = explicitProjectId ?? activeProjectId;
@@ -208,12 +234,12 @@ server.tool('list_handoffs', 'List Flow Relay handoffs in the current tenant sco
208
234
  return { content: [{ type: 'text', text }] };
209
235
  });
210
236
  // ── 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.', {
237
+ 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
238
  sources: z.array(SourceEnum)
213
239
  .optional()
214
- .describe('Specific sources to include (omit for all connected sources)'),
240
+ .describe('Restrict to these source ids (omit for all connected sources). Unknown source ids are rejected with 400.'),
215
241
  filters: FiltersSchema,
216
- project_id: z.string().optional().describe('Optional project scope override for this call.'),
242
+ 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
243
  }, async ({ sources, filters, project_id }) => {
218
244
  try {
219
245
  const resolved = await requireProject(project_id);
@@ -233,8 +259,8 @@ server.tool('generate_handoff', 'Generate a new context handoff for the active p
233
259
  }
234
260
  });
235
261
  // ── 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.'),
262
+ 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.', {
263
+ 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
264
  }, async ({ project_id }) => {
239
265
  const resolved = await resolveProject(project_id);
240
266
  const { integrations } = await api.listIntegrations(resolved.projectId);
@@ -256,7 +282,7 @@ server.tool('list_integrations', 'List integrations in the current scope. In pro
256
282
  return { content: [{ type: 'text', text: `**Connected integrations:**\n${text}` }] };
257
283
  });
258
284
  // ── 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 () => {
285
+ 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
286
  try {
261
287
  const resources = await api.listUntrackedResources();
262
288
  if (resources.length === 0) {
@@ -282,12 +308,12 @@ server.tool('list_untracked_resources', 'List discovered active resources across
282
308
  }
283
309
  });
284
310
  // ── Tool: list recent events ─────────────────────────────────────────
285
- server.tool('list_events', 'List recent context events in current scope (personal or selected project).', {
311
+ 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
312
  source: SourceEnum
287
313
  .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.'),
314
+ .describe('Restrict to one source id (e.g. "github"). Unknown ids are rejected with 400.'),
315
+ limit: z.number().int().min(1).max(100).default(20).describe('Max events to return (1-100, default 20).'),
316
+ 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
317
  }, async ({ source, limit, project_id }) => {
292
318
  const resolved = await resolveProject(project_id);
293
319
  const { events } = await api.listEvents(source, limit, resolved.projectId);
@@ -303,7 +329,7 @@ server.tool('list_events', 'List recent context events in current scope (persona
303
329
  return { content: [{ type: 'text', text: `**Recent events:**\n${text}` }] };
304
330
  });
305
331
  // ── Tool: discord list channels ──────────────────────────────────────
306
- server.tool('discord_list_channels', 'List text channels in your connected Discord server.', {}, async () => {
332
+ 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
333
  try {
308
334
  const { channels } = await api.discordListChannels();
309
335
  if (channels.length === 0) {
@@ -321,10 +347,10 @@ server.tool('discord_list_channels', 'List text channels in your connected Disco
321
347
  });
322
348
  // ── Tool: discord send message ──────────────────────────────────────
323
349
  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'),
350
+ channel_id: z.string().describe('Discord channel id from discord_list_channels.'),
325
351
  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'),
352
+ handoff_id: z.string().optional().describe('Id of a handoff (from list_handoffs) to render and attach as a .md file'),
353
+ insight_id: z.string().optional().describe('Id of an insight (from list_insights) to render and attach as a .md file'),
328
354
  artifact: z
329
355
  .enum(['last_handoff', 'last_correlation', 'last_onboarding', 'last_architecture'])
330
356
  .optional()
@@ -343,12 +369,12 @@ server.tool('discord_send_message', 'Send to a Discord channel in your connected
343
369
  }
344
370
  });
345
371
  // ── 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")'),
372
+ 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.', {
373
+ project_id: z.string().describe('Project id from list_projects to generate the insight for.'),
374
+ sources: z.array(SourceEnum).optional().describe('Restrict to these source ids (e.g. "github", "slack"). Unknown ids are rejected with 400.'),
349
375
  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'),
376
+ lookback_hours: z.number().int().optional().describe('Hours of activity to analyze (1-2160, default 168 = 7 days).'),
377
+ max_events: z.number().int().optional().describe('Cap on events processed (1-1000, default 150).'),
352
378
  }, async ({ project_id, sources, filters, lookback_hours, max_events }) => {
353
379
  try {
354
380
  const res = await api.generateInsight(project_id, 'correlation', {
@@ -370,14 +396,14 @@ server.tool('generate_correlation_insight', 'Generate a cross-source correlation
370
396
  }
371
397
  });
372
398
  // ── 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'),
399
+ 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.', {
400
+ project_id: z.string().describe('Project id from list_projects to generate the brief for.'),
401
+ sources: z.array(SourceEnum).optional().describe('Restrict to these source ids. Unknown ids are rejected with 400.'),
376
402
  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'),
403
+ new_member_role: z.string().optional().describe('Role/focus of the person being onboarded (e.g. "backend engineer"). Tailors the brief.'),
404
+ focus_area: z.string().optional().describe('Repository or feature area they will work on. Narrows the brief.'),
405
+ lookback_days: z.number().int().optional().describe('Days of history to review (1-365, default 30).'),
406
+ max_events: z.number().int().optional().describe('Cap on events processed (1-1000, default 400).'),
381
407
  }, async ({ project_id, sources, filters, new_member_role, focus_area, lookback_days, max_events }) => {
382
408
  try {
383
409
  const res = await api.generateInsight(project_id, 'onboarding', {
@@ -401,13 +427,13 @@ server.tool('generate_onboarding_brief', 'Generate an onboarding brief AI insigh
401
427
  }
402
428
  });
403
429
  // ── 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'),
430
+ 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.', {
431
+ project_id: z.string().describe('Project id from list_projects to generate the insight for.'),
432
+ sources: z.array(SourceEnum).optional().describe('Restrict to these source ids. Unknown ids are rejected with 400.'),
407
433
  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'),
434
+ focus_question: z.string().optional().describe('A specific architectural question or component to investigate (e.g. "is the billing layer coupled to providers?").'),
435
+ lookback_days: z.number().int().optional().describe('Days of history to review (1-365, default 14).'),
436
+ max_events: z.number().int().optional().describe('Cap on events processed (1-1000, default 250).'),
411
437
  }, async ({ project_id, sources, filters, focus_question, lookback_days, max_events }) => {
412
438
  try {
413
439
  const res = await api.generateInsight(project_id, 'architecture', {
@@ -430,11 +456,11 @@ server.tool('generate_architecture_insight', 'Generate an architecture insight A
430
456
  }
431
457
  });
432
458
  // ── 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'),
459
+ 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.', {
460
+ project_id: z.string().describe('Project id from list_projects to list insights for.'),
461
+ 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.'),
462
+ status: z.enum(['active', 'archived', 'all']).default('active').describe('active = current, archived = superseded, all = both.'),
463
+ limit: z.number().int().min(1).max(50).default(20).describe('Max insights to return (1-50, default 20).'),
438
464
  }, async ({ project_id, kind, status, limit }) => {
439
465
  try {
440
466
  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.6",
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",