mcp-web-calc

mcp-web-calc

Provides web search, URL fetching, summarization, math evaluation, and Wikipedia tools for LM Studio without needing an API key.

Category
Visit Server

README

mcp-web-calc — MCP server cho LM Studio (không cần API key)

Phiên bản: 0.3.0

6 công cụ tích hợp

  • search_web — Tìm web hai tầng (Nhanh: DuckDuckGo HTML → Sâu: Playwright/Bing)
  • fetch_url — Tải & trích xuất nội dung từ URL/HTML/PDF (Readability + pdf-parse)
  • summarize_url — Lấy nội dung từ URL rồi tóm tắt ngắn gọn
  • math_eval — Máy tính chính xác (Number / BigNumber / Fraction)
  • wiki_get — Lấy tóm tắt 1 trang Wikipedia theo ngôn ngữ
  • wiki_multi — Lấy tóm tắt Wikipedia theo nhiều ngôn ngữ trong một lần gọi

Không dùng API key. Hoạt động hoàn toàn qua MCP/stdio.


Yêu cầu

  • Node.js 18+
  • Windows/macOS/Linux
  • (Tìm kiếm sâu) Playwright Chromium

Cài đặt

npm i
npx playwright install chromium   # cần cho 'deep' (Bing/Playwright)
# Dev:
npm run dev
# hoặc build & chạy prod:
npm run build && npm run start

Biến môi trường (khuyến nghị)

Đặt trong LM Studio hoặc .env:

USER_AGENT=mcp-web-calc/0.3 (https://local)
HTTP_TIMEOUT=15000       # ms cho mọi yêu cầu mạng
MAX_RESULTS=10           # mặc định cho search_web
LANG_DEFAULT=vi          # ngôn ngữ mặc định
MAX_BYTES=20971520       # giới hạn tải 20MB cho fetch_url

Bảo vệ SSRF: fetch_url sẽ chặn localhost/127.0.0.1/::1/.local/.localhost.


Thêm MCP server trong LM Studio

Settings → Developer → Model Context Protocol (MCP) Servers → Add

  • Name: mcp-web-calc
  • Command: npm
  • Args: run, dev (hoặc start nếu đã build)
  • Working directory: đường dẫn tới thư mục dự án
  • Environment variables: như ở phần trên

Khi chạy thành công, log sẽ hiện: mcp-web-calc ready (stdio)…


Công cụ & cú pháp (tool schema)

1) search_web

  • Input
{ 
  q: string;
  limit?: number;          // default: MAX_RESULTS (env), clamp 1..50
  lang?: string;           // "vi" | "en" | ...
  mode?: "fast"|"deep"|"auto"; // default: "auto"
}
  • Output (rút gọn)
{
  items: { title: string; url: string; snippet?: string; source: "ddg_html"|"bing_pw" }[];
  modeUsed: "fast"|"deep"|"auto";
  enginesUsed: ("ddg_html"|"bing_pw")[];
  escalated: boolean;      // auto có leo sang deep hay không
  diagnostics?: Record<string, unknown>;
}
  • Ví dụ
search_web: { "q": "Node.js LTS release schedule", "mode": "fast", "limit": 5, "lang": "vi" }

2) fetch_url

  • Input
{ url: string }  // hỗ trợ HTML & PDF
  • Output (rút gọn)
{
  text: string;
  url: string;
  title?: string;
  byline?: string;
  siteName?: string;
  lang?: string;
  length?: number; // nếu có
}
  • Ví dụ
fetch_url: { "url": "https://example.com" }

3) summarize_url

  • Input
{ url: string }
  • Hành vi
    • Lấy nội dung bằng fetch_url, sau đó thử gọi model phía server (nếu được LM Studio cấp) để tóm tắt ngắn gọn tiếng Việt.
    • Fallback: nếu không gọi được model, trả về tối đa ~2000 ký tự đầu của bài.
  • Ví dụ
summarize_url: { "url": "https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API" }

4) math_eval

  • Input
{
  expression: string;                      // cú pháp mathjs
  mode?: "number"|"BigNumber"|"Fraction";  // default: "BigNumber"
  precision?: number;                      // default: 64 (khi BigNumber)
}
  • Lưu ý
    • mathjs không có hàm integrate. Dùng derivative, simplify, ma trận, đơn vị, v.v.
    • Cần lượng giác? Dùng mode="number" để có sin/cos… chính xác kiểu số JS.
  • Ví dụ
math_eval: { "expression": "derivative(sin(x)*exp(x), x)", "mode": "number" }

5) wiki_get

  • Input
{ title: string; lang?: string /* default "vi" */ }
  • Output (rút gọn)
{ lang: string; title: string; url: string; description?: string; extract?: string; thumbnailUrl?: string }
  • Ví dụ
wiki_get: { "title": "Việt Nam", "lang": "vi" }

6) wiki_multi

  • Input
{
  term: string,                 // thuật ngữ gốc, ví dụ "Cá"
  baseLang?: string,            // mặc định "vi"
  langs?: string[]              // mặc định ["vi","en"]
}
  • Output (rút gọn)
{
  baseLang: string;
  base: { /* WikiSummary của baseLang */ };
  items: Record<string, WikiSummary | null>; // null nếu không tìm thấy
  resolved: Record<string, { title?: string; source: "base"|"langlinks"|"direct"|"none" }>
}
  • Ví dụ
wiki_multi: { "term": "Cá", "baseLang": "vi", "langs": ["vi","en","ja","fr"] }

Mẹo kiểm thử nhanh

search_web: { "q": "site:developer.apple.com App Intents", "mode": "deep", "limit": 5, "lang": "vi" }
fetch_url: { "url": "https://example.com" }
summarize_url: { "url": "https://www.python.org/dev/peps/pep-0008/" }
math_eval: { "expression": "inv([[1,2],[3,4]])", "mode": "number" }
wiki_get: { "title": "Lambda calculus", "lang": "en" }
wiki_multi: { "term": "Cá", "baseLang": "vi", "langs": ["vi","en","ja","fr"] }

Khắc phục sự cố

  • CAPTCHA / chặn tạm thời: giảm tần suất, ưu tiên mode="fast", thử lại sau vài phút.
  • Playwright chưa cài: npx playwright install chromium.
  • Timeout / treo khi tải: tăng HTTP_TIMEOUT, hoặc nội dung vượt MAX_BYTES.
  • URL nội bộ bị chặn: đây là chủ đích (SSRF guard).

Giấy phép

MIT — xem tệp LICENSE.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured