Skip to content
Back to search

livebook_tools

Powertools for livebook.dev — AI Code Editing, MCP Servers, and Running Livebooks from the CLI

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/thmsmlr--livebook-tools/badge.svg)](/listings/thmsmlr--livebook-tools)

HTML

<a href="/listings/thmsmlr--livebook-tools"><img src="/api/listings/thmsmlr--livebook-tools/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Livebook Tools is an Elixir escript. To install it, you can use the `mix escript.install` command.

mix escript.install github thmsmlr/livebook_tools

Once installed, ensure that the escript directory is on your path.

# for normal elixir users
export PATH="$HOME/.mix/escripts:$PATH"

# for asdf elixir users
for escripts_dir in $(find "${ASDF_DATA_DIR:-$HOME/.asdf}/installs/elixir" -type d -name "escripts" 2>/dev/null); do
  export PATH="$escripts_dir:$PATH"
done

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 90 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # LivebookTools
  2. Livebook Tools is a CLI tool to give you superpowers while working with `.livemd` files.
  3. Its primary features are:
  4. - **BYOE (Bring Your Own Editor)** - Sync your `.livemd` files to an open Livebook session so you can edit them in your AI powered code editor, like Cursor.
  5. - **MCP Server** - A simple model context protocol server for connecting AI coding agents to your Livebook sessions. More on this below.
  6. - **Run Livebooks from the CLI** - Convert your `.livemd` files to Elixir scripts and run them top to bottom as if they were a `.exs` script. Useful if you want to turn a livebook into a cron job.
  7. ## Installation
  8. Livebook Tools is an Elixir escript.
  9. To install it, you can use the `mix escript.install` command.
  10. ```bash
  11. mix escript.install github thmsmlr/livebook_tools
  12. ```
  13. Once installed, ensure that the escript directory is on your path.
  14. ```bash
  15. # for normal elixir users
  16. export PATH="$HOME/.mix/escripts:$PATH"
  17. # for asdf elixir users
  18. for escripts_dir in $(find "${ASDF_DATA_DIR:-$HOME/.asdf}/installs/elixir" -type d -name "escripts" 2>/dev/null); do
  19. export PATH="$escripts_dir:$PATH"
  20. done
  21. ```
  22. ## Running Livebook
  23. In order for Livebook tools to work properly, it needs to be able to connect to a running Livebook server using distributed Elixir.
  24. To do this will depend on how you are running Livebook.
  25. In its simplest form, all you need to do is add the two environment variables to your `~/.bashrc` or `~/.zshrc` file.
  26. ```bash
  27. export LIVEBOOK_NODE="livebook@127.0.0.1"
  28. export LIVEBOOK_COOKIE="secret"
  29. ```
  30. Then when you run the Livebook tools or Livebook, both programs will discover these values and make sure that they can connect to each other.
  31. If you're running using Livebook Desktop, then you may need to add these values to the `~/.livebookdesktop.sh` file as well.
  32. For more information on Livebook Desktop, check out the [Livebook HexDocs](https://hexdocs.pm/livebook/readme.html#livebook-desktop).
  33. ## Setting up MCP Server
  34. The MCP Server is a simple [model context protocol](https://modelcontextprotocol.io/introduction) server that allows you to connect AI coding agents to your Livebook sessions.
  35. I have personally tested the implementation with [Cursor](https://www.cursor.com/), though it should work with any AI code editor that supports the MCP protocol.
  36. The MCP server runs via STDIO, so all you have to do is tell Cursor to connect via the command and it'll auto discover the tools and connect them to it's coding agent.
  37. For more information on MCP works with Cursor, check out the [Cursor MCP docs](https://docs.cursor.com/context/model-context-protocol).
  38. ![Cursor Create MCP Server](./assets/cursor-create-mcp-server.png)
  39. ![Cursor MCP Server Connected](./assets/cursor-mcp-server.png)
  40. ## Useful Tips
  41. Sometimes you want to customize how the code runs, whether it's running in Livebook or via the command line using `livebook_tools run <file>`.
  42. There are some easy code snippets that you can use to detect whether you're running in a live book or on the command line,
  43. ```elixir
  44. # Detect if we're running in a livebook
  45. is_livebook = !String.ends_with?(__ENV__.file, ".exs")
  46. # If we're running in a livebook, argv doesn't really make sense, so we'll just return an empty list
  47. argv = if is_livebook, do: [], else: System.argv()
  48. # Parse command line arguments
  49. # We'll use OptionParser to handle both flags and positional arguments
  50. {parsed_opts, positional_args, invalid_opts} =
  51. OptionParser.parse(
  52. argv,
  53. strict: [
  54. dry_run: :boolean,
  55. limit: :integer
  56. ],
  57. aliases: [
  58. d: :dry_run,
  59. l: :limit
  60. ]
  61. )
  62. # Extract options with default values, in livebook it'll just use the default values
  63. dry_run = Keyword.get(parsed_opts, :dry_run, false)
  64. limit = Keyword.get(parsed_opts, :limit, 10)
  65. ```

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.