Hex.pm MCP

io.github.joshrotenberg由 GitHub 账号 joshrotenberg 发布v0.3.1更新于 Oct 24, 2026

MCP server for hex.pm and hexdocs.pm: search, inspect, compare, and audit Elixir packages

已验证Streamable HTTP可网页运行知识与记忆开发者工具安全与监控

概览

AI 生成的概览

面向 hex.pm 与 hexdocs.pm 的 MCP 服务器,让助手搜索、查看、比较、审计 Elixir/Erlang 包并查阅其文档。

可以做什么
  • 搜索与查看包:搜索、元数据、版本、发布信息、依赖、维护者、下载统计和 README
  • 浏览文档:模块列表、完整模块文档以及在包文档内搜索
  • 分析包:并排比较、健康检查、含漏洞检查的依赖审计、替代包查找和依赖树
  • 检查 Mix 项目:审计依赖列表并检查哪些依赖有新版本
  • 通过 Elixir Toolbox 发现包:分类体系、分类列表、热门包和增强搜索
适用场景
适用于 Elixir 或 Erlang 项目:挑选依赖、判断某个包是否仍在维护、审计或升级现有依赖列表,或在按某个包的 API 写代码前查阅其文档。
运行要求
可使用 hexpm-mcp.fly.dev 上的公共远程端点(Streamable HTTP,未声明认证),也可本地安装:适用于 macOS、Linux 和 Windows 的自包含二进制、Elixir 依赖,或需要 mix 的源码检出。需要访问 hex.pm、hexdocs.pm、OSV.dev 和 Elixir Toolbox 的网络。
安装前请注意
服务器会查询第三方公共服务(hex.pm、hexdocs.pm、OSV.dev、Elixir Toolbox),因此包名和查询内容会离开本机。可选的 init 命令会在数据目录下写入插件市场,并通过 claude 和 codex 命令行注册。macOS 二进制未签名也未公证,浏览器下载会被 Gatekeeper 拦截,需清除隔离属性后才能运行。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Hex.pm MCP,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。

交给智能体安装

把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。

阅读 https://sourceweft.com/mcp/io.github.joshrotenberg%2Fhexpm-mcp/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。

查看智能体所依据的安装指南

其他 MCP 客户端

把它添加到你客户端的 mcpServers 配置中。

{
  "mcpServers": {
    "hex-pm": {
      "type": "http",
      "url": "https://hexpm-mcp.fly.dev/mcp"
    }
  }
}

README

hexpm-mcp

[CI] [Hex.pm] [Docs] [Elixir] [OTP] [License: MIT]

MCP server for querying hex.pm and hexdocs.pm -- the Elixir/Erlang package registry and documentation hosting.

Built with snodo. It speaks MCP 2026-07-28, 2025-11-25, and 2025-06-18 over stdio and Streamable HTTP. See Protocol compatibility for what the older revisions lack.

It provides 24 tools, six prompts, and package resources. Tool arguments are validated against their JSON Schemas, each list fits on one page with cache hints, and prompt and resource arguments complete package names. The package_review prompt asks for its focus (quality, security, or upgrade) when the argument is omitted and the client supports elicitation. Otherwise the review covers all three.

The server sends instructions that name the tools to start with for each task. hexpm_mcp init installs it as a Claude Code and Codex plugin, together with a skill for evaluating, upgrading and auditing dependencies.

Quick Start

A public instance is running at https://hexpm-mcp.fly.dev/mcp. Add it to your MCP client config (Claude Desktop, Claude Code, or any MCP client):

json
{  "mcpServers": {    "hexpm": {      "type": "http",      "url": "https://hexpm-mcp.fly.dev/mcp"    }  }}

Protocol compatibility

MCP revisionstdioStreamable HTTP
2026-07-28YesYes
2025-11-25YesYes
2025-06-18YesYes
2025-03-26, 2024-11-05NoNo

A client that proposes a revision not in this table is offered 2025-11-25.

On 2025-11-25 and 2025-06-18:

  • The server sends no requests to the client, so package_review without a focus returns a review across all three focuses instead of asking.
  • HTTP is stateless. initialize issues no Mcp-Session-Id, every later request needs an MCP-Protocol-Version header, and GET and DELETE on /mcp return 405.

Upgrading from 0.3.7. 0.3.7 and earlier were built on anubis_mcp. They also served 2025-03-26 and 2024-11-05, and kept HTTP sessions with a GET event stream. Clients that depend on those can no longer connect.

Checked over stdio on 2026-09-26: Codex 0.157.1 negotiates 2025-06-18, and Claude Code 2.1.283 uses 2026-07-28.

Installation

Three ways to get it, depending on how you want to use it.

Standalone binary (recommended)

A self-contained binary for macOS, Linux, and Windows. It bundles the Erlang runtime, so no Elixir toolchain is required.

sh
curl -fsSL https://raw.githubusercontent.com/joshrotenberg/hexpm-mcp/main/scripts/install.sh | sh

The installer resolves the latest release, picks the asset for your OS and architecture, verifies its sha256, and installs to ~/.local/bin. It will tell you if that directory is not on your PATH.

To choose a different directory or pin a version, pass the flags through sh:

sh
curl -fsSL https://raw.githubusercontent.com/joshrotenberg/hexpm-mcp/main/scripts/install.sh | sh -s -- --install-dir /usr/local/bincurl -fsSL https://raw.githubusercontent.com/joshrotenberg/hexpm-mcp/main/scripts/install.sh | sh -s -- --version v0.3.6

Windows uses the PowerShell equivalent:

powershell
iex (irm https://raw.githubusercontent.com/joshrotenberg/hexpm-mcp/main/scripts/install.ps1)

Every release also attaches the archives and a combined checksums-sha256.txt if you would rather install by hand.

Verify it works:

sh
hexpm_mcp --version

See Usage for the MCP client config, and macOS: "Apple could not verify hexpm_mcp" if Gatekeeper blocks a browser-downloaded copy. For Claude Code and Codex, hexpm_mcp init sets it up in one step.

As an Elixir library

For the public API from iex or your own code, without running an MCP server:

elixir
def deps do  [{:hexpm_mcp, "~> 0.3"}]end

From source

sh
git clone https://github.com/joshrotenberg/hexpm-mcp.gitcd hexpm-mcpmix deps.get

Features

  • 24 tools for searching, inspecting, comparing, auditing, and discovering hex.pm packages
  • 5 resources for structured package and discovery data access
  • 6 guided analysis prompts
  • Server instructions naming the entry tools for each task
  • A Claude Code and Codex plugin (MCP server, skill, and hook) installed by hexpm_mcp init
  • HexDocs browsing (module listing, doc search, full module docs)
  • Curated package discovery via Elixir Toolbox (groups, trending, enriched search)
  • OSV.dev vulnerability checking
  • Mix.exs dependency auditing and upgrade checking
  • ETS-based response caching with configurable TTL
  • Dual transport: stdio (Claude Code/Desktop) and StreamableHTTP (remote)
  • Public Elixir API usable directly from iex

Tools

Package information

ToolDescription
searchSearch packages by name/keywords with sorting and pagination
infoPackage metadata, description, links, download stats
versionsVersion history with retirement status
releaseRelease details, publisher, dependencies, build tools
featuresOptional dependencies and extra metadata
dependenciesDependency list for a version
downloadsDownload statistics (all-time, recent, weekly, daily)
ownersPackage maintainers
readmeREADME content as markdown

Documentation browsing

ToolDescription
docsModule listing (table of contents) from hexdocs.pm
doc_itemFull documentation for a specific module
search_docsSearch within a package's documentation

Analysis

ToolDescription
compareSide-by-side comparison of 2-5 packages
healthMaintenance, popularity, quality, and risk assessment
auditDependency risk audit (retired versions, staleness, bus factor, CVEs)
alternativesFind and compare similar packages
dep_treeRecursive dependency tree (BFS, max depth 5)

Mix.exs analysis

ToolDescription
audit_mix_depsAudit a deps list for staleness, retirement, CVEs, and bus factor
upgrade_checkCheck which deps have newer versions, flag breaking changes

Discovery (Elixir Toolbox)

Curated discovery via the Elixir Toolbox API. Project results carry GitHub/GitLab stats, a popularity score, and health signals not exposed by the raw hex.pm API.

ToolDescription
toolbox_groupsBrowse the curated taxonomy of groups and categories
toolbox_groupList the categories in a single group
toolbox_categoryCurated projects in a category (sortable by name or downloads)
toolbox_trendingTrending Elixir packages
toolbox_searchSearch packages with popularity and health signals

Example Output

Health check

# Health Check: req
## Maintenance- Age: 4 years ago- Total versions: 52- Status: **Active**- Days since last release: 57
## Popularity- All-time downloads: 11.5M- Recent (90 days): 1.6M- Weekly: 141.5K
## Quality- Documentation: available- Licenses: Apache-2.0- Dependencies: 3 required, 4 optional- Elixir requirement: ~> 1.14
## Risk- Maintainers: 1 (single maintainer!)- Retired versions: 0

Package comparison

# Package Comparison
| Metric          | req        | httpoison  | finch      || --------------- | ---------- | ---------- | ---------- || Downloads (all) | 11.5M      | 129.2M     | 54.1M      || Downloads (90d) | 1.6M       | 1.6M       | 2.4M       || Latest version  | 0.5.17     | 2.3.0      | 0.21.0     || Last updated    | 2026-02-07 | 2025-11-14 | 2026-01-22 || License         | Apache-2.0 | MIT        | MIT        || Dependencies    | 7          | 1          | 5          |

Dependency audit

# Dependency Audit: phoenix v1.8.5
Checked 10 dependencies. 8 warning(s) across 7 package(s).
- **bandit**: 1 retired version(s)- **jason**: single maintainer- **plug**: 2 retired version(s); 3 known vulnerability(ies)- **telemetry**: no issues

Usage

Claude Code and Codex (hexpm_mcp init)

From 0.3.9, the binary installs itself as a plugin for Claude Code and Codex. The plugin bundles the MCP server with a skill that tells the agent when to use these tools: before adding a dependency, when upgrading, when auditing a project, and when writing code against a package's API. In Claude Code it also adds a hook that suggests audit_mix_deps and upgrade_check after an edit to mix.exs or mix.lock.

sh
hexpm_mcp init --dry-runhexpm_mcp init

--dry-run shows the files and host commands without changing anything. init writes a local plugin marketplace, including a copy of the binary, to ~/.local/share/hexpm_mcp (or $XDG_DATA_HOME/hexpm_mcp). It then registers the marketplace with claude plugin and codex plugin. It configures whichever of the two is installed, and --host claude or --host codex picks one. It does not edit either host's configuration files directly. Reload plugins or start a new session afterwards.

Run hexpm_mcp init again after upgrading the binary to update the plugin.

If you already added hexpm-mcp as an MCP server by hand, init lists that entry when it finishes. The agent would otherwise see every tool twice, so remove one of them, for example with claude mcp remove hexpm.

To remove the plugin:

sh
claude plugin uninstall hexpm@hexpm-local --scope userclaude plugin marketplace remove hexpm-localcodex plugin remove hexpm@hexpm-localcodex plugin marketplace remove hexpm-local

init is not supported on Windows yet.

Standalone binary (stdio)

Once installed:

json
{  "mcpServers": {    "hexpm": {      "command": "hexpm_mcp",      "args": ["--transport", "stdio"]    }  }}

The binary defaults to stdio, so args can be omitted. Run hexpm_mcp --help for the full option list.

To serve over HTTP instead, pass --transport http. MCP is served at /mcp:

sh
hexpm_mcp --transport http --port 1234# MCP endpoint: http://localhost:1234/mcp
macOS: "Apple could not verify hexpm_mcp"

The binaries are not code-signed or notarized. macOS attaches a quarantine attribute to anything downloaded by a browser, and refuses to run an unsigned executable carrying it:

"hexpm_mcp" Not Opened. Apple could not verify "hexpm_mcp" is free of malware that may harm your Mac or compromise your privacy.

Choose Done, not Move to Trash, then clear the attribute:

sh
xattr -d com.apple.quarantine /path/to/hexpm_mcp

The System Settings route works too: Privacy & Security, then Open Anyway next to the blocked-binary notice.

The installer above is unaffected, because curl does not set the quarantine attribute. Only browser downloads do, so installing with curl or wget avoids this entirely. If you do download the tarball in a browser, extract it with tar -xzf from a terminal rather than double-clicking, since Archive Utility propagates the attribute to the extracted files.

From source (stdio)

To run from a checkout, e.g. for development:

json
{  "mcpServers": {    "hexpm": {      "command": "mix",      "args": ["run", "--no-halt", "--", "--transport", "stdio"],      "cwd": "/path/to/hexpm-mcp"    }  }}

iex

The public API is available directly from iex without the MCP server, either via the Hex dependency or straight from a checkout:

elixir
$ MIX_ENV=test iex -S mix
iex> HexpmMcp.get_info("phoenix"){:ok, %{  name: "phoenix",  description: "Peace of mind from prototype to production",  downloads: %{all: 148_100_000, recent: 2_600_000, week: 223_000, day: 13_000},  licenses: ["MIT"],  latest_stable_version: "1.8.5",  ...}}
iex> HexpmMcp.health_check("req"){:ok, %{  name: "req",  maintenance: %{status: "Active", age: "4 years ago", days_since_release: 57},  popularity: %{all: 11_500_000, recent: 1_600_000, week: 141_000},  quality: %{has_docs: true, licenses: ["Apache-2.0"], required_deps: 3, optional_deps: 4},  risk: %{owner_count: 1, retired_count: 0},  ...}}
iex> HexpmMcp.compare_packages(["plug", "bandit"]){:ok, [  %{name: "plug", downloads_all: 156_000_000, dep_count: 3, ...},  %{name: "bandit", downloads_all: 9_900_000, dep_count: 5, ...}]}
iex> HexpmMcp.audit_mix_deps(~s({:phoenix, "~> 1.7"}, {:jason, "~> 1.0"})){:ok, %{total_checked: 2, total_warnings: 1, results: [...]}}

API Reference

Every function returns {:ok, structured_map} or {:error, reason}.

elixir
# Search and lookupHexpmMcp.search(query, opts \\ [])HexpmMcp.get_info(name)HexpmMcp.get_downloads(name)HexpmMcp.get_owners(name)HexpmMcp.get_versions(name)
# Version-specific (pass nil for latest)HexpmMcp.get_release(name, version \\ nil)HexpmMcp.get_dependencies(name, version \\ nil)HexpmMcp.get_features(name, version \\ nil)
# Composite analysisHexpmMcp.compare_packages(names)HexpmMcp.health_check(name)HexpmMcp.audit_dependencies(name, version \\ nil)HexpmMcp.find_alternatives(name)HexpmMcp.dependency_tree(name, version \\ nil, opts \\ [])
# Mix.exs analysisHexpmMcp.audit_mix_deps(deps_string)HexpmMcp.upgrade_check(deps_string)
# HexDocs browsingHexpmMcp.get_readme(name, version \\ nil)HexpmMcp.get_docs(name, version \\ nil)HexpmMcp.get_doc_item(name, module, version \\ nil)HexpmMcp.search_docs(name, query, version \\ nil)
# Elixir Toolbox (curated discovery)HexpmMcp.toolbox_groups()HexpmMcp.toolbox_group(group)HexpmMcp.toolbox_category(group, category, opts \\ [])HexpmMcp.toolbox_trending(opts \\ [])HexpmMcp.toolbox_search(query)

Architecture

iex / Elixir code                 MCP clients        |                              |   HexpmMcp (public API)         MCP Tools (thin wrappers)   returns {:ok, map}                  |        |                         calls HexpmMcp API   Client / HexDocs / OSV /      then Formatter -> markdown   Toolbox (internal clients)    then Snodo.Result.text()
  • HexpmMcp -- 25 public functions returning structured maps, usable from iex
  • HexpmMcp.Formatter -- markdown formatting for MCP tool output
  • HexpmMcp.Client -- Req-based hex.pm API client with rate limiting
  • HexpmMcp.HexDocs -- hexdocs.pm browsing (sidebar data parsing, HTML-to-markdown)
  • HexpmMcp.OSV -- OSV.dev vulnerability database client
  • HexpmMcp.Toolbox -- Elixir Toolbox client for curated package discovery
  • HexpmMcp.Cache -- ETS-based response cache with TTL and periodic sweeping
  • HexpmMcp.CLI -- Cheer command tree; turns argv into the server's configuration, or into the init subcommand
  • HexpmMcp.Init -- hexpm_mcp init: writes the plugin marketplace and registers it through the claude and codex CLIs
  • HexpmMcp.MCP.StdioLifecycle -- owns the stdio serving Task, drains requests on EOF, exits 0 on orderly disconnect, and reports transport failures with exit 1
  • MCP Tools, Resources, and Prompts -- thin, JSON-shaped protocol components registered with Snodo.Server

Development

snodo and snodo_jsv come from Hex. To build against a local snodo checkout, set SNODO_PATH, for example SNODO_PATH=../snodo mix deps.get.

test/fixtures/mcp_tool_catalog.json holds the tool catalog, and the tests check the tool definitions against it. The acceptance tests seed domain data and exercise resources, tool failures, and argument validation through direct dispatch, stdio, and HTTP.

snodo's check with the official TypeScript client also runs against this server, over stdio and HTTP, with seeded domain responses. It needs a snodo checkout at ../snodo. Install its pinned Node dependencies once with npm ci --ignore-scripts in snodo/interop/official_client, then:

sh
MIX_ENV=test mix compile --warnings-as-errorscd ../snodoHEXPM_MCP_BUILD_PATH=../hexpm-mcp/_build/test node interop/official_client/check_hexpm.mjs
bash
# Install dependenciesmix deps.get
# Run testsmix test
# Full CI checkmix format --check-formattedmix compile --warnings-as-errorsmix credo --strictmix dialyzer
# Run locally (HTTP on port 8765)mix run --no-halt
# Run locally (stdio for MCP clients)mix run --no-halt -- --transport stdio

Under mix there is no standalone binary to install, so init from a checkout needs --binary pointing at a built or released hexpm_mcp:

sh
mix run -- init --dry-run --binary /path/to/hexpm_mcp

The plugin sources are in priv/plugin/hexpm. test/hexpm_mcp/plugin_test.exs checks that every tool the skill names is served.

License

MIT

来源:README.md,提交 48fe80e

工具

24

alternatives

Find alternative packages

输入参数name必填

audit

Audit package dependencies for risks

输入参数name必填version

audit_mix_deps

Audit mix.exs dependencies for risks

输入参数deps必填

compare

Compare 2-5 packages side by side

输入参数packages必填

dep_tree

Build a package dependency tree

输入参数name必填versionmax_depth

dependencies

Get dependencies for a package version

输入参数name必填version

doc_item

Get documentation for a module or function

输入参数name必填module必填version

docs

Browse a package documentation module listing

输入参数name必填version

downloads

Get package download statistics

输入参数name必填

features

Get optional features for a package release

输入参数name必填version

health

Run a comprehensive package health check

输入参数name必填

info

Get detailed package information

输入参数name必填

owners

Get package owners and maintainers

输入参数name必填

readme

Get package README content

输入参数name必填version

release

Get detailed package release information

输入参数name必填version必填

search_docs

Search within package documentation

输入参数name必填query必填version

toolbox_category

List projects in a Toolbox category

输入参数sortgroup必填category必填

toolbox_group

List categories in a Toolbox group

输入参数group必填

toolbox_groups

Browse the Elixir Toolbox taxonomy

无需输入参数。

upgrade_check

Check mix.exs dependencies for upgrades

输入参数deps必填

versions

List all package versions

输入参数name必填

版本历史

1
  1. v0.3.1最新Sep 16, 2026

评分

已满足适用检查项的 100%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通必需25 分
  • 已声明认证方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分