Hoogle_MCP_Server

hnbc6667777/Hoogle_MCP_Server

3.1

If you are the rightful owner of Hoogle_MCP_Server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

Hoogle MCP Server is a Model Context Protocol server designed to facilitate searching Haskell documentation within AI assistants like Cursor, Claude Desktop, and Codebuddy.

Hoogle MCP Server

一个用于在AI助手(Cursor、Claude Desktop、Codebuddy等)中搜索Haskell文档的MCP(模型上下文协议)服务器。

License: MIT Node.js Version TypeScript

📑 快速导航

文档说明
新手从这里开始! 快速上手指南
5分钟快速配置
详细使用示例和技巧
项目技术细节和架构
项目完成度检查清单

功能特性

  • 🔍 通过Hoogle API搜索Haskell函数、类型、模块和包
  • 📚 支持函数名搜索、类型签名搜索和关键词搜索
  • 🌐 可通过stdio或HTTP两种方式运行
  • 🚀 完整的TypeScript类型支持

安装

npm install
npm run build

使用方法

方式1:Stdio模式(推荐用于Claude Desktop、Codebuddy)

启动stdio服务器:

npm start

方式2:HTTP模式(用于远程访问)

启动HTTP服务器:

npm run start:streamableHttp

默认监听端口:3088

配置AI工具

Claude Desktop配置

编辑Claude Desktop配置文件:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

添加以下配置:

{
  "mcpServers": {
    "hoogle": {
      "command": "node",
      "args": ["/path/to/Hoogle_MCP_Server/dist/index.js"]
    }
  }
}

Codebuddy配置

在Codebuddy设置中添加MCP服务器,配置类似:

{
  "mcpServers": {
    "hoogle": {
      "command": "node",
      "args": ["/home/unixzhang/Hoogle_MCP_Server/dist/index.js"]
    }
  }
}

Cursor配置

Cursor通常使用HTTP模式连接MCP服务器:

  1. 启动HTTP服务器:npm run start:streamableHttp
  2. 在Cursor设置中添加MCP端点:http://localhost:3088/mcp

可用工具

search_hoogle

在Hoogle中搜索Haskell相关内容。

参数:

  • query (string, 必需): 搜索查询,可以是:
    • 函数名:map
    • 类型签名:(a -> b) -> [a] -> [b]
    • 关键词:monad transformer
  • count (number, 可选): 返回结果数量(默认10,最大100)

示例:

在AI助手中,你可以这样使用:

请搜索Haskell中的map函数
帮我查找类型为 a -> [a] 的函数
在Hoogle中搜索 monad transformer,显示前5个结果

开发

监视模式

开发时可以使用watch模式自动重新编译:

npm run watch

项目结构

Hoogle_MCP_Server/
├── src/
│   ├── index.ts          # Stdio入口
│   ├── server.ts         # 核心MCP服务器逻辑(Hoogle搜索实现)
│   └── streamableHttp.ts # HTTP服务器入口
├── dist/                 # 编译输出
├── package.json
├── tsconfig.json
└── README.md

技术栈

  • MCP SDK: @modelcontextprotocol/sdk - 模型上下文协议实现
  • TypeScript: 类型安全的开发体验
  • Zod: 运行时类型验证
  • Express: HTTP服务器(可选)
  • Hoogle API: https://hoogle.haskell.org/

API接口说明

Hoogle MCP Server使用Hoogle官方JSON API:

GET https://hoogle.haskell.org/?mode=json&hoogle={query}&count={count}

返回的结果包含:

  • 函数/类型的完整签名
  • 所属模块和包信息
  • 文档链接
  • 简短说明

许可证

MIT