The Model Context Protocol (MCP) is a standard way for an AI agent, such as Claude Code, Codex or Cursor, to discover and call tools that run outside it. This module offers fossick’s functions as MCP tools. The agent sees each tool’s name, arguments and docstring. The docstrings here are written for the agent and say when to use each option. They are the tools’ interface, and they are longer than the docstrings elsewhere in fossick.
Most tools take the arguments of the Python function they wrap, plus a limit on how much text they return, such as max_chars. A tool cuts a long result at that limit and ends it with a note that gives the number of characters cut. The note tells an agent to ask for more. Tools convert results to plain JSON types before they return them. The server uses standard input and output by default.
Question -> cited answer: search, read the top n readable* results in parallel (auto-escalating past bot walls, skipping bot-wall/empty pages and backfilling), return {query, sources, digest, dropped, region}. digest is cited markdown, one ## section per source, trimmed to the passages that answer the query and headed with the date the source says it was published. region is a ddgs ‘country-lang’ code, or ‘auto’ to read the country off the query — set it whenever the answer depends on jurisdiction or market. timelimit d|w|m|y keeps only recent sources.*
Search the web via ddgs metasearch (no API key). category: text|images|news|videos|books. region is a ddgs ‘country-lang’ code, or ‘auto’ to read the country off the query — pass it whenever the answer depends on where you are (law, price, availability). timelimit d|w|m|y keeps only recent results. google=True gives real Google ranking via a stealth browser (slow — only when you need Google).
Fetch a URL as markdown. Always pass sel (CSS selector) to skip nav/ads. heavy=JS rendering; stealthy=anti-bot fetcher; session=reuse the logged-in debug Chrome’s cookies; auto=escalate plain->heavy->stealthy->session (winning tier in result).
Readers
One tool per source: arXiv papers, YouTube videos and searches, GitHub files and repositories, and conversion of pages and PDFs to notebooks.
Read files from a GitHub repo (URL, SSH address, or local path) filtered by glob patterns (default: README, pyproject.toml, .py). Returns {path: content}.
arXiv paper (ID or any arXiv URL) -> {title, authors, published, summary, pdf_path}. include_source adds the full text (30-100k chars total — raise chars only when needed).
Hidden APIs
find_hidden_apis and capture_network record the background requests a page makes and number them. The server keeps the list from the most recent of those calls, and replay_capture sends request number capture_id from it again as a plain HTTP call with the browser’s cookies. paginate_api reads every page of a JSON API, and returns at most max_items items.
Paginate a JSON API, collecting all items across pages. payload is the base body (POST) or params (GET); page_field is the key incremented per page; results_field is auto-detected if None.
Re-issue a captured request (by capture_id from find_hidden_apis/capture_network) as a fast plain-HTTP call, reusing the browser’s cookies. data overrides the request body.
Visit a page with a browser and capture the JSON/XHR API calls it makes (glob/regex pattern filters URLs). session=True captures through the logged-in debug Chrome. Each hit has a capture_id for replay_capture.
Browser and shop
browse opens a page in the debug Chrome and returns its snapshot. The server remembers that page, and the page_* tools act on it until the next browse. The shop_* tools work the same way on one shopping session, opened by shop_open; they wrap fossick.shop.
Navigate the debug Chrome to a URL and capture outgoing network requests matching pattern (listens tail seconds after load). Each request gets a capture_id for replay_capture.
Run a declarative flow on the current page. Steps (JSON arrays): [‘goto’,url] [‘fill’,label,value] [‘click’,label] [‘select’,label,option] [‘wait’,text] [‘wait_sel’,css] [‘read’,css] or [‘read’,css,label]. Returns {label: markdown} for every read step.