npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pi-elixir

v0.3.1

Published

BEAM runtime tools for pi — connects to the running Elixir app for live introspection

Readme

pi-elixir

BEAM runtime tools for pi — connects to the running Elixir application for live introspection.

LLMs already know how to run mix compile and mix test. What they don't know is that the BEAM VM is a living runtime they can interrogate — evaluating code inside the running app, reading docs from compiled bytecode, locating any module/function without grep, querying the database through Ecto, and inspecting process state. This package gives pi direct access to the BEAM and teaches the agent to use it.

Install

pi install pi-elixir

No changes to your Elixir project are required. Works with any Elixir project — Phoenix apps, libraries, whatever. The extension auto-starts an embedded MCP server when you open a project with a mix.exs.

For Phoenix apps with Tidewave, the extension connects to it instead for the best experience (code reloading, Phoenix-aware features).

How It Connects

The extension resolves the BEAM connection per project:

  1. Native Tidewave — probes localhost:4000–4009 for a running Tidewave instance and matches its project_name to the app: in your mix.exs
  2. Embedded server — if no Tidewave is found, auto-starts mix run --no-halt with a bundled MCP server script in the project directory. Uses Bandit/Plug if available, otherwise falls back to a built-in OTP gen_tcp server (no deps required)

This means multiple Elixir projects can run simultaneously — each pi session connects to the correct BEAM.

The status bar shows the connection mode:

| Status | Meaning | |---|---| | ⬡ BEAM | Connected via native Tidewave | | ⬡ BEAM (embedded) | Running embedded MCP server | | ⬡ BEAM offline | No connection (project may not compile yet) |

Optional: Add Tidewave

For the best experience (Phoenix code reloading, Ash support), add Tidewave:

# mix.exs deps
{:tidewave, "~> 0.5", only: :dev}
# lib/my_app_web/endpoint.ex — above "if code_reloading? do"
if Mix.env() == :dev do
  plug Tidewave
end

Configuration

Override the connection URL (disables auto-detection):

export TIDEWAVE_URL=http://localhost:4001/tidewave/mcp

Disable the embedded fallback:

export PI_ELIXIR_DISABLE_EMBEDDED=1

Tools

| Tool | What it does | |---|---| | elixir_eval | Evaluate code inside the running app with IEx helpers | | elixir_docs | Documentation from the runtime (exact dep versions) | | elixir_source | File:line from BEAM bytecode — no grep | | elixir_sql | SQL through the app's Ecto repo | | elixir_logs | Server logs with level/grep filtering | | elixir_hex_search | HexDocs search scoped to your mix.lock | | elixir_schemas | List all Ecto schemas with paths | | elixir_sup_tree | Supervision tree with strategies and PIDs | | elixir_top | Process manager — top processes by memory/reductions/mailbox | | elixir_process_info | Deep inspection of a single process | | elixir_deps_tree | Module dependency graph via Mix.Xref | | elixir_types | Type specs and callbacks for a module or function |

Tool results are syntax-highlighted in the TUI: Elixir output, SQL results, documentation with code blocks, and log levels are all color-coded.

Skill — BEAM Introspection

Teaches the agent to use elixir_eval for runtime introspection that no other language can match:

  • Module discovery: exports/1, :code.all_loaded/0
  • Ecto schema introspection: __schema__/1, __schema__/2
  • Process state: :sys.get_state/1, Process.info/1
  • Phoenix routes: Router.__routes__/0
  • OTP supervision trees: Supervisor.which_children/1
  • Erlang system info: :erlang.memory/0, :erlang.system_info/1
  • AST manipulation: Code.string_to_quoted/1, Macro.prewalk/3, Sourceror

Why Runtime Introspection

Tidewave MCP vs LSP — LSP is FILE+LINE+COLUMN and can't find code that isn't used yet. Runtime tools use the language's own notation (Module.function/arity) and work at runtime, catching metaprogrammed code that static analysis misses.