Skip to content

Commit 2254c1b

Browse files
committed
Update MCP server configurations and tool implementations
1 parent 0c09e84 commit 2254c1b

4 files changed

Lines changed: 5 additions & 58 deletions

File tree

packages/mcp-server/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
"preflight": "bun run mcp:build && bun run check:narration-leakage && bun run test:mcp:local"
5656
},
5757
"dependencies": {
58-
"@effect-patterns/analysis-core": "file:./lib-analysis-core",
59-
"@effect-patterns/toolkit": "file:./lib-toolkit",
58+
"@effect-patterns/analysis-core": "workspace:*",
59+
"@effect-patterns/toolkit": "workspace:*",
6060
"@effect/opentelemetry": "^0.61.0",
6161
"@effect/platform": "^0.94.1",
6262
"@effect/platform-node": "^0.104.0",
@@ -101,4 +101,4 @@
101101
],
102102
"author": "Paul",
103103
"license": "MIT"
104-
}
104+
}

packages/mcp-server/src/mcp-content-builders.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,6 @@ function buildFullPatternCard(params: {
280280
const {
281281
title,
282282
summary,
283-
rationale,
284283
useWhen,
285284
apiNames,
286285
exampleCode,

packages/mcp-server/src/tools/tool-implementations.ts

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import {
55
import {
66
buildFullPatternCard,
77
buildPatternContent,
8-
buildScanFirstPatternContent,
9-
buildSearchResultsContent,
108
} from "@/mcp-content-builders.js";
119
import type {
1210
Elicitation,
@@ -34,10 +32,6 @@ import {
3432
isSearchTooBroad,
3533
} from "@/tools/elicitation-helpers.js";
3634
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
37-
import matter from "gray-matter";
38-
import { globSync } from "glob";
39-
import path from "node:path";
40-
import { readFileSync } from "node:fs";
4135

4236
/**
4337
* Telemetry counters for cache performance
@@ -82,53 +76,6 @@ function normalizeContentBlocks(
8276
}));
8377
}
8478

85-
function extractFirstCodeFence(body: string): { code: string; language?: string } | null {
86-
const fence = /```(\\w+)?\\n([\\s\\S]*?)\\n```/m.exec(body);
87-
if (!fence) return null;
88-
return { language: fence[1], code: fence[2].trim() };
89-
}
90-
91-
function extractSection(body: string, heading: string): string | null {
92-
const pattern = new RegExp(`^##\\s+${heading}\\s*$`, "m");
93-
const match = pattern.exec(body);
94-
if (!match) return null;
95-
const start = match.index + match[0].length;
96-
const rest = body.slice(start);
97-
const next = rest.search(/^##\\s+/m);
98-
return (next === -1 ? rest : rest.slice(0, next)).trim();
99-
}
100-
101-
function extractFirstParagraph(text: string | null): string | null {
102-
if (!text) return null;
103-
const cleaned = text.replace(/```[\\s\\S]*?```/g, "").trim();
104-
const para = cleaned.split(/\\n\\n+/)[0]?.trim();
105-
return para || null;
106-
}
107-
108-
function findMdxPathBySlug(id: string): string | null {
109-
const root = path.resolve(process.cwd(), "../../content/published/patterns");
110-
const matches = globSync(`${root}/**/${id}.mdx`);
111-
return matches[0] || null;
112-
}
113-
114-
function extractMdxFields(id: string): {
115-
summary?: string;
116-
guideline?: string;
117-
rationale?: string;
118-
example?: { code: string; language?: string };
119-
} {
120-
const filePath = findMdxPathBySlug(id);
121-
if (!filePath) return {};
122-
const raw = readFileSync(filePath, "utf8");
123-
const { data, content } = matter(raw);
124-
const summary = typeof data.summary === "string" ? data.summary : undefined;
125-
const guideline = extractFirstParagraph(extractSection(content, "Guideline"));
126-
const rationale = extractFirstParagraph(extractSection(content, "Rationale"));
127-
const goodExampleSection = extractSection(content, "Good Example") || extractSection(content, "Example");
128-
const example = extractFirstCodeFence(goodExampleSection || content) || undefined;
129-
return { summary, guideline, rationale, example };
130-
}
131-
13279
function extractApiNames(text: string): string[] {
13380
const matches = text.match(/\\b(Effect|Layer|Stream|Schedule|Metric|Ref|Queue|PubSub)\\.\\w+/g);
13481
return matches ? Array.from(new Set(matches)).slice(0, 6) : [];

packages/mcp-server/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
"exclude": [
6969
"node_modules",
7070
".next",
71-
"dist"
71+
"dist",
72+
"scripts"
7273
]
7374
}

0 commit comments

Comments
 (0)