mmnt_search
Perform a search on the Mamont search engine by providing a query and page number to retrieve results.
Instructions
Search in Mamont search engine
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | query string | |
| page | Yes | page number |
Implementation Reference
- src/mmnt/search.ts:11-40 (handler)The core search function `searchMamont` that fetches results from Mamont search engine, parses HTML with cheerio, and returns structured search results. This is the handler for the 'mmnt_search' tool.
export async function searchMamont(request: string, page: number = 0): Promise<SearchResult> { const ot = page * 10 + 1; const response = await fetch(`https://www.mmnt.ru/get?st=${encodeURIComponent(request)}&in=w&ot=${ot}`); const buffer = await response.arrayBuffer(); const text = iconv.decode(Buffer.from(buffer), "windows-1251"); // convert win1251 -> utf8 const $ = cheerio.load(text); const result: SearchResult = []; $(".link_block").each((i, elem) => { if (i == 0) return; const linkElement = $(elem).find("p.link_p a").first(); const title = linkElement.text().trim(); const description = $(elem).find("p.desc_p").text().trim(); const url = $(elem).find("p.link_p a").first().attr("href")!; const cache = $(elem).find("p.cache_p a").first().attr("href")?.match(/\/cache\/([a-f0-9]+)\.html/)?.[1]; const web_archive = $(elem).find("p.arch_p a").first()?.attr("href"); result.push({ title, description, url, ...(cache ? {cache} : {}), ...(web_archive ? {web_archive} : {}), }); }); return result; } - src/types.ts:13-16 (schema)Zod schema for the 'mmnt_search' tool parameters: `query` (string) and `page` (number).
export const SearchParams = { query: z.string({description: "query string"}), page: z.number({description: "page number"}) }; - src/index.ts:15-25 (registration)Registration of the 'mmnt_search' tool on the McpServer. It defines the tool name, description, input schema (SearchParams), and the handler lambda that calls searchMamont.
server.tool( "mmnt_search", "Search in Mamont search engine", SearchParams, async ({query, page}) => ({ content: [{ type: "text", text: JSON.stringify(await searchMamont(query, page)) }] }) ); - src/types.ts:3-11 (schema)Type definitions for the search result (SearchResultElement and SearchResult) returned by the handler.
export type SearchResultElement = { title: string description: string url: string, cache?: string, web_archive?: string } export type SearchResult = SearchResultElement[]