Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

nparrot

MCP.Pizza Chef: Leaf-Computer

nparrot is a command-line client that enables integration of any CLI tool with Nostr direct messages (DMs) using the NIP-17 protocol. It allows sending and receiving private messages over Nostr, facilitating workflows like interacting with AI agents via DMs, sending notifications from shell environments, and testing NIP-17 messaging. Its key features include sending messages from stdin or arguments and listening for incoming messages from specific users, making it a versatile tool for developers and users leveraging Nostr for secure, decentralized messaging.

Use This MCP client To

Send notifications from shell scripts via Nostr DMs Interact with AI agents through Nostr direct messages Integrate CLI tools with Nostr messaging protocol Test and troubleshoot NIP-17 direct message functionality Receive and wait for specific Nostr DM responses

README

Logo

nparrot

nparrot ("Nostr Parrot") is a convenient CLI tool that facilitates one-on-one DM messaging over Nostr (NIP-17).

This tool has a few use cases and benefits:

  • πŸ€– Talk to your Goose AI agent via DMs from your phone by using any Nostr client compatible with NIP-17.
  • πŸ”— Easily integrate almost any other command line tool with Nostr DMs.
  • πŸ”” Send yourself notifications easily from any environment that can run shell commands.
  • πŸ§ͺ Use this as a test or troubleshooting tool for NIP-17 messages.

Here are the features it includes:

  • βœ… send command: Sends a private NIP-17 direct message using specified arguments, or from stdin.
  • βœ… wait command: Listens and waits for the next NIP-17 direct message from a specific user, and prints it to stdout once received.
  • βœ… onmessage command: Continuously listens for NIP-17 direct messages, and for each one, it runs a shell command you specify.
  • βœ… listen command: Continuously listens for NIP-17 direct messages, and for each one, it prints it to stdout.
  • βœ… mcp command: MCP server that allows an AI agent to send a direct message to a specific user, or to wait for their message.

⚠️ Note: This is relatively new, experimental software. Please proceed with caution.

Installation

We currently don't provide pre-built binaries. If you'd like a pre-built binary, please open an issue or contact us, we can help! Otherwise, please follow the build instructions below.

Make sure you have cargo 1.85 or higher installed. Then run:

cargo build --release

Then, you can find the executable binary on ./target/release/nparrot, which you can run from there, or you can move it to another more convenient directory such as ~/.local/bin.

Talking to a goose AI agent via Nostr DMs

A very cool use case for this tool is the ability to talk to a goose AI agent on your phone, via Nostr DMs.

  1. Download any Nostr client that supports NIP-17 DMs on your phone (e.g. 0xchat).
  2. Go through onboarding.
  3. Go to your profile, and find your npub (This will be in the form npub1...). Take note of that, this will be your TARGET_PUBKEY.
  4. Also find and take note of the relays you are connected to. (e.g. wss://relay.damus.io). This will be your RELAY_URL.
  5. Now, switch to your computer.
  6. Generate a nostr private key (nsec) for your AI agent. If you have nak, this can be done by simply running:
nak key generate | nak encode nsec
  1. Take note of the nsec generated in the previous step, this will be your NSEC.
  2. Now run these commands to set the variables on your environment (this helps make nparrot commands less verbose):
export TARGET_PUBKEY=<Your pubkey from step 3>
export NSEC=<Your nsec from step 6>
export RELAY_URL=<Your relay from step 4>
  1. Optional but recommended: Send yourself a message to test if the setup works.
nparrot send "test"
  1. Optional but recommended: Create a working directory where your AI agent will be working on, and cd to it.
  2. Optional but recommended: Create a .goosehints on your working directory, with context to help the AI agent understand it should send you a message via Nostr DMs and not directly to the terminal. Example:
- Talk to the user over nostr messaging using the tool provided.
- The user's name is Daniel
- Before you start doing any task, send a message to the user first saying indicating you are working on it
- You should always reply to the user over nostr, your normal output is not monitored.
  1. Finally, run this command to start:
nparrot onmessage 'sed "s/^/New message from Nostr: /" | goose run --name="test-session" --with-extension "nparrot mcp" -i -'
  1. Try sending a message from your app, and see your AI agent respond to it!

Notes:

  • During testing, gpt-4o was used with good results

Other commands

$ nparrot --help
Usage: nparrot [OPTIONS] --target-pubkey <TARGET_PUBKEY> --nsec <NSEC> <COMMAND>

Commands:
  send       Sends a private message via NIP-17. If the message is omitted, reads it from stdin
  wait       Waits for a private NIP-17 message to be received and prints the decrypted contents to stdout once received
  listen     Listens for private NIP-17 messages to be received and prints the decrypted contents to stdout after each one is received
  mcp        Starts an MCP server to allow an AI agent to manage the conversation
  onmessage  Runs a specified shell command each time it receives a NIP-17 direct message, passing the decrypted message contents to it via stdin
  help       Print this message or the help of the given subcommand(s)

Options:
      --target-pubkey <TARGET_PUBKEY>  Pubkey of the target user to talk to via DMs (in bech32 format) [env: TARGET_PUBKEY=]
      --nsec <NSEC>                    The private key (nsec) identity to use on the DMs [env: NSEC=]
      --relay <RELAY>                  Relay URL to use for sending/receiving messages [env: RELAY_URL=] [default: wss://relay.damus.io]
  -h, --help                           Print help
  -V, --version                        Print version

Contributing

Contributions are welcome! Please open an issue or a pull request if you would like to contribute.

Please use git commit --signoff when committing changes to this repository, to certify that you agree to the Developer Certificate of Origin.

nparrot FAQ

How do I send a direct message using nparrot?
Use the `send` command with message arguments or pipe input to send a NIP-17 DM.
Can nparrot listen for incoming messages?
Yes, the `wait` command listens for the next NIP-17 DM from a specified user.
What environments can nparrot be used in?
It works in any environment that can run shell commands, including servers and local machines.
Is nparrot compatible with all Nostr clients?
It supports any Nostr client compatible with the NIP-17 direct messaging protocol.
Can nparrot integrate with AI agents?
Yes, it can be used to communicate with AI agents like Goose AI via Nostr DMs.
What protocols does nparrot use?
It uses the Nostr protocol, specifically the NIP-17 direct messaging standard.
How can nparrot help with troubleshooting?
It can send and receive test messages to verify NIP-17 DM functionality and debug issues.