MCP Server

SeaPortal runs as a Model Context Protocol server over JSON-RPC 2.0, line-delimited, on stdio:

terminal
seaportal mcp

No flags are accepted — configuration flows through tool arguments. The server implements initialize, tools/list, and tools/call.

Client config

{
  "mcpServers": {
    "seaportal": {
      "command": "seaportal",
      "args": ["mcp"]
    }
  }
}

Tools

Each tool wraps an existing library entry point and returns its JSON-marshalled result as a single text content block.

fetch_url

Fetch a URL and return the extracted Markdown + metadata as JSON (the Result struct). Wraps FromURLWithOptions.

ArgumentTypeDescription
urlstringrequired — URL to fetch
dedupebooleanEnable block dedup (default true)
fastbooleanBail early if a browser is needed
with_linksbooleanEmit discovered links
with_imagesbooleanEmit discovered images
with_tablesbooleanEmit structured tables
with_commentsbooleanEmit user comments
max_tokensintegerApproximate output token cap

fetch_snapshot

Build the accessibility-tree snapshot for a URL (HTTP fetch, then snapshot extraction). Wraps BuildSnapshotWithOptions.

ArgumentTypeDescription
urlstringrequired
filterstringinteractive to keep only links/buttons/inputs; empty for full tree
max_tokensintegerApproximate token cap
allow_internalbooleanAllow private/internal IP targets

parse_sitemap

Fetch and flatten a sitemap.xml (nested <sitemapindex> supported, .gz auto-decompressed). Returns a JSON array of {loc, lastmod, changefreq, priority}. Wraps FlattenSitemap.

ArgumentTypeDescription
urlstringrequired
max_depthintegerMax sitemap-index recursion depth (default 5)
max_urlsintegerStop after this many URLs (default 50000)
allow_internalbooleanAllow private/internal IP targets

parse_feed

Fetch and parse an RSS 2.0 / Atom 1.0 / JSON Feed 1.x URL into a unified {title, link, published, summary, author, guid} JSON array. Wraps ParseFeed.

ArgumentTypeDescription
urlstringrequired
max_itemsintegerStop after this many items (default 200)
allow_internalbooleanAllow private/internal IP targets

scrape_site

Scrape a whole site from a base URL and return a structured ScrapeResult JSON (site, pageGroups, pages, summary) designed to be handed to PinchTab for enrichment. Wraps ScrapeSite. Server-side guardrails cap max_pages (≤200), max_per_pattern (≤50), and timeout_seconds (≤180).

ArgumentTypeDescription
base_urlstringrequired
max_pagesintegerMax total pages (default 50, capped at 200)
max_per_patternintegerMax samples per URL pattern (default 8, capped at 50)
fullbooleanDisable sampling (fetch all discovered pages, still capped)
include_patternsstringComma-separated globs to include
exclude_patternsstringComma-separated globs to exclude
sample_strategystringrandom | priority | balanced (default balanced)
with_performancebooleanInclude per-page performance data
respect_robotsbooleanRespect robots.txt + crawl-delay (default true)
timeout_secondsintegerOverall timeout (default 60, capped at 180)
user_agentstringOverride the User-Agent header
allow_internalbooleanAllow private/internal IP targets

Like fetch_url, every scrape fetch (discovery, robots.txt, sitemaps, pages) runs under the secure-by-default policy; allow_internal lifts only the private-IP block.

Errors

Tool-level failures return a successful JSON-RPC result with isError: true and the error message as text; handler panics are caught and returned the same way.