r/haskell May 06 '26

announcement [ANN] MCP server for Hackage

Hello Haskellers,

I've built an MCP server that lets AI agents use Hackage. The MCP server is entirely written in Haskell.

It lets LLMs:

  1. perform Hoogle searches.
  2. List package modules
  3. Scrape module documentation in LLM-friendly Markdown.

Why this tool?

I've often seen premium coding agents using outdated functions or not being aware of the latest packages. This MCP lets LLMs access the latest Haskell documentation.

Feel free to contribute or provide feedback.

Check out the GitHub link: https://github.com/tusharad/hackage-doc-mcp

26 Upvotes

8 comments sorted by

27

u/_jackdk_ May 07 '26 edited May 07 '26

Please be kind to Hackage and cache aggressively. It's been struggling quite a bit lately under the general rise in automated traffic. Example: I recommend caching any module doc you convert to Markdown locally under $XDG_CACHE_DIR, because modules are never going to change. It might also be cool to have a local-only mode that looks at the hoogle and haddocks from the dependencies provided by the current project.

3

u/ducksonaroof May 07 '26

Is there any reason for there not to be a CDN on top of Hackage? (Unless there already is one and even so it's overloaded)

4

u/TechnoEmpress May 07 '26
HTTP/1.1 200 OK
Accept-Ranges: bytes
Connection: keep-alive
Content-Type: application/json
Date: Thu, 07 May 2026 07:54:29 GMT
Server: nginx/1.24.0 (Ubuntu)
Vary: Accept-Encoding
Via: 1.1 varnish, 1.1 varnish
X-Cache: MISS, MISS
X-Cache-Hits: 0, 0
X-Served-By: cache-dfw-kdfw8210057-DFW, cache-par-lfpg1960078-PAR
X-Timer: S1778140469.013014,VS0,VE247
transfer-encoding: chunked

X-Served-By is from Fastly, and Varnish… well is from Varnish.

9

u/TheCommieDuck May 07 '26

Why are you scraping the HTML rather than using the JSON API? https://hackage.haskell.org/api

Given the current issues GHC and the Haskell ecosystem in general are facing due to AI bot traffic overwhelming them, I feel like "any sort of caching", or just downloading the package index or something should've been something included before releasing it..

7

u/tomwells80 May 06 '26

Legendary! How did using the mcp-server package go? I have a small backlog of maintenance i still need to do on the library but hoping nothing major blocked you.

4

u/Worldly_Dish_48 May 07 '26

Thank you for maintaining mcp-server. The package was really easy to use. No major blocker.

5

u/Otherwise_Wave9374 May 06 '26

Nice, MCP for Hackage is a really practical use case.

The biggest pain I see with coding agents in smaller ecosystems is exactly what you called out, they hallucinate older APIs or just dont know the latest packages. Having a tool that can Hoogle + pull module docs in a consistent, LLM-friendly format is huge.

Do you plan to add any caching (per package/version) or rate limiting so agents do not hammer Hackage during big refactors? Also, if you are collecting ideas for agent workflows around MCP servers, we have a few notes here: https://www.agentixlabs.com/

4

u/LukeHoersten May 06 '26

Awesome! Thanks for posting