@abraca/mcp 2.90.0 → 2.91.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/package.json +6 -12
- package/src/active-server.ts +0 -91
- package/src/converters/markdownToYjs.ts +0 -13
- package/src/converters/yjsToMarkdown.ts +0 -12
- package/src/hook-bridge.ts +0 -355
- package/src/index.ts +0 -305
- package/src/mentions.ts +0 -42
- package/src/resources/agent-guide.ts +0 -557
- package/src/resources/server-info.ts +0 -47
- package/src/resources/tree-resource.ts +0 -57
- package/src/schema/loader.ts +0 -139
- package/src/schema/validator.ts +0 -31
- package/src/server-manager.ts +0 -182
- package/src/server.ts +0 -1393
- package/src/tool-detail.ts +0 -147
- package/src/tools/awareness.ts +0 -159
- package/src/tools/channel.ts +0 -155
- package/src/tools/content.ts +0 -518
- package/src/tools/files.ts +0 -118
- package/src/tools/hooks.ts +0 -51
- package/src/tools/meta.ts +0 -98
- package/src/tools/servers.ts +0 -211
- package/src/tools/svg.ts +0 -80
- package/src/tools/tree.ts +0 -682
- package/src/utils/sanitizeSvg.ts +0 -71
- package/src/utils.ts +0 -6
package/src/utils/sanitizeSvg.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lightweight SVG sanitizer for server-side use (no DOM dependency).
|
|
3
|
-
* Strips dangerous elements and attributes from SVG markup using allowlists.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const ALLOWED_ELEMENTS = new Set([
|
|
7
|
-
'svg', 'g', 'path', 'circle', 'ellipse', 'rect', 'line', 'polyline',
|
|
8
|
-
'polygon', 'text', 'tspan', 'textPath', 'defs', 'use', 'symbol',
|
|
9
|
-
'clipPath', 'mask', 'pattern', 'linearGradient', 'radialGradient', 'stop',
|
|
10
|
-
'marker', 'image', 'title', 'desc', 'metadata',
|
|
11
|
-
'animate', 'animateTransform', 'animateMotion', 'set',
|
|
12
|
-
'filter', 'feGaussianBlur', 'feOffset', 'feMerge', 'feMergeNode',
|
|
13
|
-
'feFlood', 'feComposite', 'feBlend', 'feColorMatrix', 'feComponentTransfer',
|
|
14
|
-
'feFuncR', 'feFuncG', 'feFuncB', 'feFuncA', 'feConvolveMatrix',
|
|
15
|
-
'feDiffuseLighting', 'feDisplacementMap', 'feDropShadow', 'feImage',
|
|
16
|
-
'feMorphology', 'fePointLight', 'feSpecularLighting', 'feSpotLight',
|
|
17
|
-
'feTile', 'feTurbulence',
|
|
18
|
-
])
|
|
19
|
-
|
|
20
|
-
const FORBIDDEN_ELEMENTS = new Set([
|
|
21
|
-
'script', 'foreignObject', 'iframe', 'object', 'embed', 'applet',
|
|
22
|
-
])
|
|
23
|
-
|
|
24
|
-
/** Matches event handler attributes: on* */
|
|
25
|
-
const EVENT_HANDLER_RE = /\bon\w+\s*=/gi
|
|
26
|
-
|
|
27
|
-
/** Matches javascript: URLs in href/xlink:href */
|
|
28
|
-
const JS_URL_RE = /(href\s*=\s*["'])\s*javascript:/gi
|
|
29
|
-
|
|
30
|
-
/** Matches a full element tag (opening or self-closing) */
|
|
31
|
-
const TAG_RE = /<\/?([a-zA-Z][a-zA-Z0-9-]*)((?:\s[^>]*)?)>/g
|
|
32
|
-
|
|
33
|
-
/** Matches complete forbidden element blocks including content */
|
|
34
|
-
function stripForbiddenBlocks(svg: string): string {
|
|
35
|
-
for (const tag of FORBIDDEN_ELEMENTS) {
|
|
36
|
-
// Strip both <tag>...</tag> and self-closing <tag ... />
|
|
37
|
-
const blockRe = new RegExp(`<${tag}[\\s>][\\s\\S]*?</${tag}>`, 'gi')
|
|
38
|
-
svg = svg.replace(blockRe, '')
|
|
39
|
-
const selfCloseRe = new RegExp(`<${tag}[\\s/][^>]*/?>`, 'gi')
|
|
40
|
-
svg = svg.replace(selfCloseRe, '')
|
|
41
|
-
}
|
|
42
|
-
return svg
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Sanitize SVG markup by removing dangerous elements and attributes.
|
|
47
|
-
* Uses an allowlist approach — only known-safe SVG elements are kept.
|
|
48
|
-
*/
|
|
49
|
-
export function sanitizeSvg(svg: string): string {
|
|
50
|
-
if (!svg) return ''
|
|
51
|
-
|
|
52
|
-
// 1. Strip forbidden element blocks (script, foreignObject, etc.)
|
|
53
|
-
let clean = stripForbiddenBlocks(svg)
|
|
54
|
-
|
|
55
|
-
// 2. Strip event handler attributes
|
|
56
|
-
clean = clean.replace(EVENT_HANDLER_RE, '')
|
|
57
|
-
|
|
58
|
-
// 3. Strip javascript: URLs
|
|
59
|
-
clean = clean.replace(JS_URL_RE, '$1')
|
|
60
|
-
|
|
61
|
-
// 4. Remove any elements not in the allowlist
|
|
62
|
-
clean = clean.replace(TAG_RE, (match, tagName: string) => {
|
|
63
|
-
const lower = tagName.toLowerCase()
|
|
64
|
-
if (ALLOWED_ELEMENTS.has(lower) || ALLOWED_ELEMENTS.has(tagName)) {
|
|
65
|
-
return match
|
|
66
|
-
}
|
|
67
|
-
return ''
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
return clean.trim()
|
|
71
|
-
}
|
package/src/utils.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Re-exports of the shared provider sync utilities. The implementations live in
|
|
3
|
-
* `@abraca/dabra` (`DocUtils`) — kept here as a stable local import path for the
|
|
4
|
-
* MCP tools that already `import { … } from "./utils.ts"`.
|
|
5
|
-
*/
|
|
6
|
-
export { waitForSync, withTimeout } from "@abraca/dabra";
|