@nestr/mcp 0.1.72 → 0.1.89
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/build/api/client.d.ts +84 -5
- package/build/api/client.d.ts.map +1 -1
- package/build/api/client.js +120 -21
- package/build/api/client.js.map +1 -1
- package/build/help/articles.d.ts +146 -0
- package/build/help/articles.d.ts.map +1 -0
- package/build/help/articles.js +574 -0
- package/build/help/articles.js.map +1 -0
- package/build/help/cross-links.d.ts +21 -0
- package/build/help/cross-links.d.ts.map +1 -0
- package/build/help/cross-links.js +61 -0
- package/build/help/cross-links.js.map +1 -0
- package/build/help/topics.d.ts.map +1 -1
- package/build/help/topics.js +324 -12
- package/build/help/topics.js.map +1 -1
- package/build/http.d.ts +26 -13
- package/build/http.d.ts.map +1 -1
- package/build/http.js +572 -128
- package/build/http.js.map +1 -1
- package/build/oauth/client-info.d.ts +58 -0
- package/build/oauth/client-info.d.ts.map +1 -0
- package/build/oauth/client-info.js +68 -0
- package/build/oauth/client-info.js.map +1 -0
- package/build/oauth/config.d.ts +19 -0
- package/build/oauth/config.d.ts.map +1 -1
- package/build/oauth/config.js +12 -0
- package/build/oauth/config.js.map +1 -1
- package/build/oauth/flow.d.ts +6 -0
- package/build/oauth/flow.d.ts.map +1 -1
- package/build/oauth/flow.js +30 -4
- package/build/oauth/flow.js.map +1 -1
- package/build/oauth/store.d.ts +14 -0
- package/build/oauth/store.d.ts.map +1 -1
- package/build/oauth/store.js.map +1 -1
- package/build/server.d.ts +11 -0
- package/build/server.d.ts.map +1 -1
- package/build/server.js +38 -5
- package/build/server.js.map +1 -1
- package/build/skills/tension-processing.d.ts.map +1 -1
- package/build/skills/tension-processing.js +11 -1
- package/build/skills/tension-processing.js.map +1 -1
- package/build/tools/index.d.ts +580 -90
- package/build/tools/index.d.ts.map +1 -1
- package/build/tools/index.js +598 -82
- package/build/tools/index.js.map +1 -1
- package/build/tools/validation.d.ts +42 -0
- package/build/tools/validation.d.ts.map +1 -0
- package/build/tools/validation.js +97 -0
- package/build/tools/validation.js.map +1 -0
- package/build/util/diagnose.d.ts +40 -0
- package/build/util/diagnose.d.ts.map +1 -0
- package/build/util/diagnose.js +26 -0
- package/build/util/diagnose.js.map +1 -0
- package/build/util/request-context.d.ts +11 -0
- package/build/util/request-context.d.ts.map +1 -0
- package/build/util/request-context.js +30 -0
- package/build/util/request-context.js.map +1 -0
- package/package.json +2 -1
- package/web/index.html +25 -0
- package/web/styles.css +62 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Help-article integration. Sources `/help/articles/<slug>` URLs from the
|
|
3
|
+
* public nestr.io sitemap, exposes simple token-overlap search by slug, and
|
|
4
|
+
* fetches an article page lazily on demand (converting it to markdown so it
|
|
5
|
+
* fits in a tool response).
|
|
6
|
+
*
|
|
7
|
+
* The internal `nestr_help` topics in topics.ts are curated MCP-flavoured
|
|
8
|
+
* guidance. Articles are end-user UI docs. The tool routes between them:
|
|
9
|
+
* exact internal topic match first, then article search/fetch.
|
|
10
|
+
*/
|
|
11
|
+
export type ArticleIndexEntry = {
|
|
12
|
+
slug: string;
|
|
13
|
+
url: string;
|
|
14
|
+
};
|
|
15
|
+
export type ArticleSearchHit = ArticleIndexEntry & {
|
|
16
|
+
score: number;
|
|
17
|
+
};
|
|
18
|
+
export declare function _resetCaches(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Load (or return cached) the list of help-article slugs from the sitemap.
|
|
21
|
+
* Sitemap is plain XML with `<loc>...</loc>` entries; we only need the URLs,
|
|
22
|
+
* so a regex extract is cheaper than pulling in an XML parser.
|
|
23
|
+
*/
|
|
24
|
+
export declare function loadArticleIndex(): Promise<ArticleIndexEntry[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Token-overlap search against slug-as-words plus curated keywords. Slugs are
|
|
27
|
+
* descriptive (e.g. `building-your-org-structure-roles-circles`), so
|
|
28
|
+
* dash-to-space gives a usable signal without fetching every article's title.
|
|
29
|
+
* Exact substring matches score 1; a typo rescued by Levenshtein scores 0.5,
|
|
30
|
+
* so an exact hit always outranks a fuzzy one.
|
|
31
|
+
*/
|
|
32
|
+
export declare function searchArticleIndex(entries: ArticleIndexEntry[], query: string, limit?: number): ArticleSearchHit[];
|
|
33
|
+
/**
|
|
34
|
+
* Fetch a single article and convert to a readable markdown payload. Cached
|
|
35
|
+
* per-slug for ARTICLE_TTL_MS. The conversion is intentionally lossy —
|
|
36
|
+
* Webflow output is noisy, and the LLM only needs the textual body.
|
|
37
|
+
*/
|
|
38
|
+
export declare function fetchArticleMarkdown(slug: string): Promise<{
|
|
39
|
+
slug: string;
|
|
40
|
+
url: string;
|
|
41
|
+
title: string;
|
|
42
|
+
description: string;
|
|
43
|
+
markdown: string;
|
|
44
|
+
}>;
|
|
45
|
+
/**
|
|
46
|
+
* Fetch just an article's title + description, for search-result snippets,
|
|
47
|
+
* without converting the whole body. Reuses a full-article or prior meta cache
|
|
48
|
+
* entry when one is fresh, and caches meta separately so repeated searches are
|
|
49
|
+
* cheap. Throws on a non-OK response — callers enrich best-effort and fall back
|
|
50
|
+
* to the bare slug on failure.
|
|
51
|
+
*/
|
|
52
|
+
export declare function fetchArticleMeta(slug: string): Promise<{
|
|
53
|
+
slug: string;
|
|
54
|
+
title: string;
|
|
55
|
+
description: string;
|
|
56
|
+
}>;
|
|
57
|
+
export type ArticleImage = {
|
|
58
|
+
url: string;
|
|
59
|
+
caption: string;
|
|
60
|
+
decorative: boolean;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Pull the in-body images out of converted article markdown as structured data
|
|
64
|
+
* so callers can surface screenshots as first-class items (some MCP hosts
|
|
65
|
+
* render them inline; text-only clients still get the caption + URL). SVGs are
|
|
66
|
+
* skipped — on these pages they're UI chrome/icons, not content. Dedupes by
|
|
67
|
+
* URL, preserves document order. Run this on the article body markdown so nav
|
|
68
|
+
* and marketing imagery (already cut by extractArticleBody) stays out.
|
|
69
|
+
*
|
|
70
|
+
* Each image is flagged `decorative` when it has no caption OR appears before
|
|
71
|
+
* the first content heading (the header/category-bar thumbnail at the top of an
|
|
72
|
+
* article). Decorative images are listed and remain addressable by index, but
|
|
73
|
+
* are never part of the default selection. "First content heading" is the second
|
|
74
|
+
* heading in the body — the first is the article title — so when a body has no
|
|
75
|
+
* sub-headings the position rule is skipped and only the caption test applies.
|
|
76
|
+
*/
|
|
77
|
+
export declare function extractImages(markdown: string): ArticleImage[];
|
|
78
|
+
export type InlineArticleImage = ArticleImage & {
|
|
79
|
+
index: number;
|
|
80
|
+
data: string;
|
|
81
|
+
mimeType: string;
|
|
82
|
+
};
|
|
83
|
+
/** Clamp a caller-supplied maxImages to [1, MAX_INLINE_IMAGES_CAP], default 3. */
|
|
84
|
+
export declare function clampMaxImages(max?: number): number;
|
|
85
|
+
/**
|
|
86
|
+
* Decide which images (by index into `images`) to attach inline.
|
|
87
|
+
*
|
|
88
|
+
* - Explicit `indexes`: the caller picked specific entries from the numbered
|
|
89
|
+
* list, so honour them verbatim — valid, de-duped, in the given order, with
|
|
90
|
+
* NO cap (overrides maxImages and the default selection, so a decorative
|
|
91
|
+
* image can still be attached on explicit request).
|
|
92
|
+
* - Default: the first `max` non-decorative (content) images in document order.
|
|
93
|
+
* This skips the uncaptioned hero/avatar and any header thumbnail before the
|
|
94
|
+
* first content heading; masthead/footer imagery is already gone because we
|
|
95
|
+
* only see body markdown.
|
|
96
|
+
*/
|
|
97
|
+
export declare function selectImageIndexes(images: ArticleImage[], opts?: {
|
|
98
|
+
indexes?: number[];
|
|
99
|
+
max?: number;
|
|
100
|
+
}): number[];
|
|
101
|
+
/**
|
|
102
|
+
* Fetch a single image and return it as base64 + MIME type for an MCP `image`
|
|
103
|
+
* content block, or null if it can't be safely inlined (disallowed URL,
|
|
104
|
+
* non-image content, too large, or any network error). Wide images are
|
|
105
|
+
* downscaled to bound token cost. Best-effort by design — callers fall back to
|
|
106
|
+
* the text URL list. Bounded FIFO cache by URL (oldest entry evicted once the
|
|
107
|
+
* cap is reached).
|
|
108
|
+
*/
|
|
109
|
+
export declare function fetchImageAsBase64(url: string): Promise<{
|
|
110
|
+
data: string;
|
|
111
|
+
mimeType: string;
|
|
112
|
+
} | null>;
|
|
113
|
+
/**
|
|
114
|
+
* Fetch the selected article images (see selectImageIndexes) as inline base64
|
|
115
|
+
* blocks, carrying each image's index in the full list. Concurrent and
|
|
116
|
+
* best-effort — any that can't be inlined are dropped.
|
|
117
|
+
*/
|
|
118
|
+
export declare function collectArticleImages(images: ArticleImage[], opts?: {
|
|
119
|
+
indexes?: number[];
|
|
120
|
+
max?: number;
|
|
121
|
+
}): Promise<InlineArticleImage[]>;
|
|
122
|
+
/**
|
|
123
|
+
* Pull title + description from the article's JSON-LD `TechArticle` block
|
|
124
|
+
* when present (every article currently includes one). Falls back to
|
|
125
|
+
* `<title>` / `<meta name="description">` tags.
|
|
126
|
+
*/
|
|
127
|
+
export declare function extractArticleMeta(html: string): {
|
|
128
|
+
title: string;
|
|
129
|
+
description: string;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Best-effort extraction of the article body. We can't rely on a single
|
|
133
|
+
* named container on Webflow output, so we cut from the article's `<h1>`
|
|
134
|
+
* down to where chrome resumes (footer / nav). When the page has multiple
|
|
135
|
+
* `<h1>` elements (Webflow's hidden signup form puts one in before the
|
|
136
|
+
* article), pass `headlineHint` so we can pick the matching one.
|
|
137
|
+
*/
|
|
138
|
+
export declare function extractArticleBody(html: string, headlineHint?: string): string;
|
|
139
|
+
/**
|
|
140
|
+
* Minimal HTML → markdown converter. Handles the elements that actually show
|
|
141
|
+
* up in the article body (headings, paragraphs, lists, links, emphasis,
|
|
142
|
+
* inline code, line breaks). Anything else is reduced to its text content.
|
|
143
|
+
* Not a general-purpose converter — just enough that the LLM can read it.
|
|
144
|
+
*/
|
|
145
|
+
export declare function htmlToMarkdown(html: string): string;
|
|
146
|
+
//# sourceMappingURL=articles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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