@frase/mcp-server 0.3.0 → 0.3.3
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/formatter.d.ts +1 -1
- package/dist/formatter.d.ts.map +1 -1
- package/dist/formatter.js +1 -1
- package/dist/formatter.js.map +1 -1
- package/dist/lib/mcp-audit.d.ts +3 -0
- package/dist/lib/mcp-audit.d.ts.map +1 -0
- package/dist/lib/mcp-audit.js +95 -0
- package/dist/lib/mcp-audit.js.map +1 -0
- package/dist/mcpb-bundle.js +30072 -0
- package/dist/prompts/content-pipeline.d.ts.map +1 -1
- package/dist/prompts/content-pipeline.js +10 -18
- package/dist/prompts/content-pipeline.js.map +1 -1
- package/dist/prompts/create-seo-article.d.ts.map +1 -1
- package/dist/prompts/create-seo-article.js +17 -42
- package/dist/prompts/create-seo-article.js.map +1 -1
- package/dist/prompts/keyword-research.d.ts.map +1 -1
- package/dist/prompts/keyword-research.js +20 -31
- package/dist/prompts/keyword-research.js.map +1 -1
- package/dist/resources/briefs.d.ts.map +1 -1
- package/dist/resources/briefs.js +12 -6
- package/dist/resources/briefs.js.map +1 -1
- package/dist/tools/ai-visibility.d.ts.map +1 -1
- package/dist/tools/ai-visibility.js +67 -12
- package/dist/tools/ai-visibility.js.map +1 -1
- package/dist/tools/analytics.d.ts.map +1 -1
- package/dist/tools/analytics.js +9 -4
- package/dist/tools/analytics.js.map +1 -1
- package/dist/tools/audits.d.ts +8 -5
- package/dist/tools/audits.d.ts.map +1 -1
- package/dist/tools/audits.js +112 -20
- package/dist/tools/audits.js.map +1 -1
- package/dist/tools/briefs.d.ts +40 -145
- package/dist/tools/briefs.d.ts.map +1 -1
- package/dist/tools/briefs.js +153 -163
- package/dist/tools/briefs.js.map +1 -1
- package/dist/tools/cms-posts.d.ts +7 -0
- package/dist/tools/cms-posts.d.ts.map +1 -0
- package/dist/tools/cms-posts.js +499 -0
- package/dist/tools/cms-posts.js.map +1 -0
- package/dist/tools/content.d.ts +37 -6
- package/dist/tools/content.d.ts.map +1 -1
- package/dist/tools/content.js +362 -32
- package/dist/tools/content.js.map +1 -1
- package/dist/tools/discover.js +3 -3
- package/dist/tools/discover.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +5 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/optimizations.d.ts +6 -0
- package/dist/tools/optimizations.d.ts.map +1 -1
- package/dist/tools/optimizations.js +440 -26
- package/dist/tools/optimizations.js.map +1 -1
- package/dist/tools/publish.d.ts +3 -3
- package/dist/tools/publish.js +6 -6
- package/dist/tools/publish.js.map +1 -1
- package/dist/tools/research.d.ts +18 -6
- package/dist/tools/research.d.ts.map +1 -1
- package/dist/tools/research.js +210 -19
- package/dist/tools/research.js.map +1 -1
- package/dist/tools/rules.d.ts +76 -0
- package/dist/tools/rules.d.ts.map +1 -1
- package/dist/tools/rules.js +355 -12
- package/dist/tools/rules.js.map +1 -1
- package/dist/tools/serp.d.ts.map +1 -1
- package/dist/tools/serp.js +30 -18
- package/dist/tools/serp.js.map +1 -1
- package/dist/tools/site-health.js +10 -10
- package/dist/tools/site-health.js.map +1 -1
- package/dist/tools/templates.js +5 -5
- package/dist/tools/templates.js.map +1 -1
- package/dist/tools/webhooks.d.ts.map +1 -1
- package/dist/tools/webhooks.js +24 -3
- package/dist/tools/webhooks.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -11
- package/server.json +4 -4
package/dist/formatter.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Formatter — re-exported from @frase/core
|
|
3
3
|
*/
|
|
4
|
-
export { formatDate, formatStatus, formatTable, formatPagination, formatSuccess, formatError, formatKeyValue, formatWordCount, truncate, } from "@frase/core";
|
|
4
|
+
export { formatDate, formatStatus, formatTable, formatPagination, formatSuccess, formatError, formatKeyValue, formatWordCount, formatContentType, truncate, } from "@frase/core";
|
|
5
5
|
//# sourceMappingURL=formatter.d.ts.map
|
package/dist/formatter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../src/formatter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,UAAU,EACV,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,cAAc,EACd,eAAe,EACf,QAAQ,GACT,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../src/formatter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,UAAU,EACV,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,QAAQ,GACT,MAAM,aAAa,CAAC"}
|
package/dist/formatter.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Formatter — re-exported from @frase/core
|
|
3
3
|
*/
|
|
4
|
-
export { formatDate, formatStatus, formatTable, formatPagination, formatSuccess, formatError, formatKeyValue, formatWordCount, truncate, } from "@frase/core";
|
|
4
|
+
export { formatDate, formatStatus, formatTable, formatPagination, formatSuccess, formatError, formatKeyValue, formatWordCount, formatContentType, truncate, } from "@frase/core";
|
|
5
5
|
//# sourceMappingURL=formatter.js.map
|
package/dist/formatter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../src/formatter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,UAAU,EACV,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,cAAc,EACd,eAAe,EACf,QAAQ,GACT,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../src/formatter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,UAAU,EACV,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,QAAQ,GACT,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-audit.d.ts","sourceRoot":"","sources":["../../src/lib/mcp-audit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,YAAY,EAAc,MAAM,aAAa,CAAC;AA0FzE,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,YAAY,CA6BhF"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
const AUDIT_POST_TIMEOUT_MS = 3_000;
|
|
3
|
+
const MAX_ERROR_CODE_LEN = 50;
|
|
4
|
+
function hashInput(input) {
|
|
5
|
+
let serialized;
|
|
6
|
+
try {
|
|
7
|
+
serialized = JSON.stringify(input ?? null);
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
serialized = String(input);
|
|
11
|
+
}
|
|
12
|
+
const size = Buffer.byteLength(serialized, "utf8");
|
|
13
|
+
const hash = createHash("sha256").update(serialized).digest("hex");
|
|
14
|
+
return { hash, size };
|
|
15
|
+
}
|
|
16
|
+
function classifyResult(result) {
|
|
17
|
+
if (result.success)
|
|
18
|
+
return { status: "success" };
|
|
19
|
+
const markdown = (result.markdown ?? "").toLowerCase();
|
|
20
|
+
if (markdown.includes("rate limit"))
|
|
21
|
+
return { status: "rate_limited" };
|
|
22
|
+
if (markdown.includes("not found"))
|
|
23
|
+
return { status: "not_found" };
|
|
24
|
+
if (markdown.includes("unauthor") || markdown.includes("forbidden")) {
|
|
25
|
+
return { status: "unauthorized" };
|
|
26
|
+
}
|
|
27
|
+
if (markdown.includes("invalid") || markdown.includes("validation")) {
|
|
28
|
+
return { status: "validation_error" };
|
|
29
|
+
}
|
|
30
|
+
if (markdown.includes("timeout") || markdown.includes("timed out")) {
|
|
31
|
+
return { status: "timeout" };
|
|
32
|
+
}
|
|
33
|
+
return { status: "error" };
|
|
34
|
+
}
|
|
35
|
+
function deriveErrorCode(err) {
|
|
36
|
+
const name = err instanceof Error ? err.name : typeof err;
|
|
37
|
+
return (name || "error").slice(0, MAX_ERROR_CODE_LEN);
|
|
38
|
+
}
|
|
39
|
+
function fireAudit(context, payload) {
|
|
40
|
+
const url = `${context.config.apiUrl.replace(/\/$/, "")}/audit/mcp-tool`;
|
|
41
|
+
const controller = new AbortController();
|
|
42
|
+
const timer = setTimeout(() => controller.abort(), AUDIT_POST_TIMEOUT_MS);
|
|
43
|
+
fetch(url, {
|
|
44
|
+
method: "POST",
|
|
45
|
+
headers: {
|
|
46
|
+
"Content-Type": "application/json",
|
|
47
|
+
"X-API-KEY": context.config.apiKey,
|
|
48
|
+
"User-Agent": "frase-mcp-server",
|
|
49
|
+
},
|
|
50
|
+
body: JSON.stringify(payload),
|
|
51
|
+
signal: controller.signal,
|
|
52
|
+
})
|
|
53
|
+
.then((res) => {
|
|
54
|
+
if (!res.ok && context.config.debug) {
|
|
55
|
+
console.warn(`[mcp-audit] ingest POST returned ${res.status} for ${payload.tool_name}`);
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
.catch((err) => {
|
|
59
|
+
if (context.config.debug) {
|
|
60
|
+
console.warn(`[mcp-audit] ingest POST failed for ${payload.tool_name}:`, err);
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
.finally(() => clearTimeout(timer));
|
|
64
|
+
}
|
|
65
|
+
export function withAudit(toolName, executor) {
|
|
66
|
+
return async (input, context) => {
|
|
67
|
+
const start = Date.now();
|
|
68
|
+
const { hash, size } = hashInput(input);
|
|
69
|
+
try {
|
|
70
|
+
const result = await executor(input, context);
|
|
71
|
+
const { status, errorCode } = classifyResult(result);
|
|
72
|
+
fireAudit(context, {
|
|
73
|
+
tool_name: toolName,
|
|
74
|
+
input_hash: hash,
|
|
75
|
+
input_size: size,
|
|
76
|
+
result_status: status,
|
|
77
|
+
duration_ms: Date.now() - start,
|
|
78
|
+
error_code: errorCode,
|
|
79
|
+
});
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
fireAudit(context, {
|
|
84
|
+
tool_name: toolName,
|
|
85
|
+
input_hash: hash,
|
|
86
|
+
input_size: size,
|
|
87
|
+
result_status: "error",
|
|
88
|
+
duration_ms: Date.now() - start,
|
|
89
|
+
error_code: deriveErrorCode(err),
|
|
90
|
+
});
|
|
91
|
+
throw err;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=mcp-audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-audit.js","sourceRoot":"","sources":["../../src/lib/mcp-audit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,MAAM,qBAAqB,GAAG,KAAK,CAAC;AACpC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAoB9B,SAAS,SAAS,CAAC,KAAc;IAC/B,IAAI,UAAkB,CAAC;IACvB,IAAI,CAAC;QACH,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC;IAC7C,CAAC;IAAC,MAAM,CAAC;QACP,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACnD,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACnE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACxB,CAAC;AAED,SAAS,cAAc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