@splicr/mcp-server 0.12.0 → 0.13.0

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.
package/dist/cli.js CHANGED
@@ -433,6 +433,11 @@ async function runHook() {
433
433
  }
434
434
  }
435
435
  const [{ results }, patternData] = await Promise.all([contextPromise, patternsPromise]);
436
+ // Build brief section (first message only)
437
+ let briefSection = '';
438
+ if (isFirstMessage && patternData.brief) {
439
+ briefSection = `${patternData.brief}\n\n---\n\n`;
440
+ }
436
441
  // Build patterns section (first message only, deterministic enforcement)
437
442
  let patternsSection = '';
438
443
  if (isFirstMessage && patternData.patterns && patternData.patterns.length > 0) {
@@ -441,7 +446,7 @@ async function runHook() {
441
446
  // Mark patterns as injected for this session
442
447
  saveSessionMeta(sessionId, { patterns_injected: true });
443
448
  }
444
- if ((!results || results.length === 0) && !patternsSection) {
449
+ if ((!results || results.length === 0) && !patternsSection && !briefSection) {
445
450
  process.exit(0);
446
451
  return;
447
452
  }
@@ -466,7 +471,7 @@ async function runHook() {
466
471
  }).join('\n\n');
467
472
  contextSection = `SPLICR CONTEXT — The user's saved research matched this task. Use these findings to inform your response:\n\n${contextLines}\n\nACTION: Review above before answering. Call get_full_content(id) for complete articles. Fall back to web search only if these don't cover the question.`;
468
473
  }
469
- const context = patternsSection + contextSection;
474
+ const context = briefSection + patternsSection + contextSection;
470
475
  if (!context.trim()) {
471
476
  process.exit(0);
472
477
  return;
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ import { exploreKnowledgeSchema, handleExploreKnowledge } from './tools/explore-
16
16
  import { getDecisionsSchema, handleGetDecisions } from './tools/get-decisions.js';
17
17
  import { getTeamStatusSchema, handleGetTeamStatus } from './tools/get-team-status.js';
18
18
  import { reviewCodeSchema, handleReviewCode } from './tools/review-code.js';
19
+ import { regenerateBriefSchema, handleRegenerateBrief } from './tools/regenerate-brief.js';
19
20
  import { completeSession } from './lib/api-client.js';
20
21
  // Prevent unhandled errors from crashing the MCP server
21
22
  process.on('uncaughtException', (err) => {
@@ -70,6 +71,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
70
71
  getDecisionsSchema,
71
72
  getTeamStatusSchema,
72
73
  reviewCodeSchema,
74
+ regenerateBriefSchema,
73
75
  ],
74
76
  }));
75
77
  // Handle tool calls with per-tool timeout
@@ -91,6 +93,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
91
93
  get_decisions: handleGetDecisions,
92
94
  get_team_status: handleGetTeamStatus,
93
95
  review_code: handleReviewCode,
96
+ regenerate_brief: handleRegenerateBrief,
94
97
  }[name];
95
98
  if (!handler) {
96
99
  return { content: [{ type: 'text', text: `Unknown tool: ${name}` }], isError: true };
@@ -13,6 +13,7 @@ export declare function getProjectContext(params: {
13
13
  results: any[];
14
14
  patterns?: any[];
15
15
  project_name?: string;
16
+ brief?: string;
16
17
  }>;
17
18
  export declare function getRecentInsights(params: {
18
19
  days?: number;
@@ -0,0 +1,9 @@
1
+ export declare const regenerateBriefSchema: {
2
+ name: "regenerate_brief";
3
+ description: string;
4
+ inputSchema: {
5
+ type: "object";
6
+ properties: {};
7
+ };
8
+ };
9
+ export declare function handleRegenerateBrief(args: Record<string, unknown>): Promise<string>;
@@ -0,0 +1,60 @@
1
+ import { detectProject } from '../lib/project-detector.js';
2
+ import { gatherProjectProfile } from '../lib/profile-gatherer.js';
3
+ import * as session from '../lib/session-state.js';
4
+ import { loadAuth } from '../auth.js';
5
+ import { getSessionId } from '../lib/session-state.js';
6
+ const API_URL = process.env.SPLICR_API_URL || 'https://api-production-d889.up.railway.app';
7
+ export const regenerateBriefSchema = {
8
+ name: 'regenerate_brief',
9
+ description: `Regenerate the project onboarding brief. The brief is an auto-generated summary that gives agents instant context about the codebase (architecture, conventions, how-tos, gotchas).
10
+
11
+ Use when:
12
+ - The brief feels outdated or incomplete
13
+ - After significant project changes (new framework, major refactor)
14
+ - When you want to refresh the project context with latest patterns and learnings
15
+ - On first use if no brief exists yet
16
+
17
+ The brief is generated from: project patterns, accumulated learnings, local codebase analysis (directory structure, recent commits, tech stack).`,
18
+ inputSchema: {
19
+ type: 'object',
20
+ properties: {},
21
+ },
22
+ };
23
+ export async function handleRegenerateBrief(args) {
24
+ const cwd = process.cwd();
25
+ // Detect project
26
+ const detected = await detectProject(cwd).catch(() => null);
27
+ if (!detected) {
28
+ return 'Could not detect project. Register this project with Splicr first.';
29
+ }
30
+ // Gather local profile data for richer brief
31
+ const profileData = gatherProjectProfile(cwd);
32
+ // Call API to regenerate
33
+ const auth = await loadAuth();
34
+ const res = await fetch(`${API_URL}/mcp/regenerate-brief`, {
35
+ method: 'POST',
36
+ headers: {
37
+ 'Authorization': `Bearer ${auth.accessToken}`,
38
+ 'Content-Type': 'application/json',
39
+ 'X-Splicr-Session-Id': getSessionId(),
40
+ },
41
+ body: JSON.stringify({
42
+ project_name: detected.name,
43
+ profile_data: {
44
+ recent_commits: profileData.recent_commits,
45
+ directory_structure: profileData.directory_structure,
46
+ },
47
+ }),
48
+ signal: AbortSignal.timeout(30000),
49
+ });
50
+ session.recordToolCall();
51
+ if (!res.ok) {
52
+ const err = await res.json().catch(() => ({ error: `HTTP ${res.status}` }));
53
+ return `Brief regeneration failed: ${err.error || res.status}`;
54
+ }
55
+ const data = await res.json();
56
+ if (data.data?.updated) {
57
+ return `*Brief regenerated for ${detected.name}:*\n\n${data.data.brief}`;
58
+ }
59
+ return data.data?.error || 'Brief regeneration produced no result.';
60
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splicr/mcp-server",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Splicr MCP server — route what you read to what you're building",
5
5
  "type": "module",
6
6
  "bin": "./dist/cli.js",