Agentstr - Nostr Agent Tools
File Descriptions
1. nwc_client.py
A Python class (NWCClient) for interacting with a Nostr Wallet Connect (NWC) service to handle Lightning Network payments.
- Functionality:
- Initialize with an NWC connection string.
- List transactions (
list_tx). - Get wallet balance (
get_balance). - Create invoices (
make_invoice). - Check invoice status (
check_invoice). - Pay invoices (
try_pay_invoice). - Monitor payment success with callbacks (
on_payment_success).
- Usage: Used by other scripts to handle payment-related operations.
- Example: Create an invoice and monitor payment:
client = NWCClient(nwc_str) invoice = client.make_invoice(amt=5, desc='test') client.on_payment_success(invoice, callback=lambda: print('Payment succeeded'))
2. nostr_client.py
A core client (NostrClient) for interacting with the Nostr protocol.
- Functionality:
- Initialize with relay URLs, private key, and optional NWC string.
- Sign events with a private key.
- Manage relay connections (
get_relay_manager). - Read posts by tag (
read_posts_by_tag). - Fetch and update user metadata (
get_metadata_for_pubkey,update_metadata). - Send and listen for encrypted direct messages (
send_direct_message_to_pubkey,direct_message_listener).
- Usage: Foundation for other scripts to interact with Nostr relays.
- Example: Read posts with a specific tag:
client = NostrClient(relays, private_key) posts = client.read_posts_by_tag('mcp_tool_discovery')
3. nostr_mcp_client.py
A client (NostrMCPClient) for interacting with MCP servers over Nostr.
- Functionality:
- Initialize with a
NostrClientand MCP server public key. - List available tools (
list_tools). - Call tools with arguments, handling payments if required (
call_tool).
- Initialize with a
- Usage: Used to invoke tools (e.g., math operations, weather queries) on remote MCP servers.
- Example: Call a multiplication tool:
mcp_client = NostrMCPClient(nostr_client, server_public_key) result = mcp_client.call_tool("multiply", {"a": 69, "b": 420})
4. nostr_mcp_server.py
A server (NostrMCPServer) that exposes tools via Nostr and handles tool execution with optional payment requirements.
- Functionality:
- Initialize with a display name and
NostrClient. - Add tools with optional pricing in satoshis (
add_tool). - List available tools (
list_tools). - Execute tools based on incoming requests (
call_tool). - Handle direct messages to process tool calls and payments (
_direct_message_callback). - Start the server to listen for requests (
start).
- Initialize with a display name and
- Usage: Hosts tools like math operations and responds to client requests.
- Example: Add and run a math server:
server = NostrMCPServer("Math MCP Server", client) server.add_tool(lambda a, b: a + b, name="add") server.start()
5. nostr_agent_server.py
A server (NostrAgentServer) that integrates an external agent API with Nostr for chat-based interactions.
- Functionality:
- Initialize with an agent URL, satoshis cost, and
NostrClient. - Fetch agent information (
agent_info). - Handle chat requests with optional thread IDs (
chat). - Process direct messages, requiring payments if specified (
_direct_message_callback). - Start the server to listen for messages (
start).
- Initialize with an agent URL, satoshis cost, and
- Usage: Bridges Nostr with an external agent service.
- Example: Start an agent server:
server = NostrAgentServer(agent_url, 5, client) server.start()
Metadata
Release files for nostr-agents 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nostr_agents-0.0.1.tar.gz | 14.0 kB | Without provenance | Details for nostr_agents-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nostr_agents-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for nostr_agents-0.0.1-py3-none-any.whl |
Total release size: 30.0 kB
Release files / nostr_agents-0.0.1.tar.gz
| Download URL | nostr_agents-0.0.1.tar.gz |
|---|---|
| Size | 14.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
65649d0a6e2c614cdd0964d8a918ea3cf88f0e29cabf27386d7d15b98e81845e
|
|
BLAKE2b-256 checksum How to use checksums |
36dec239786bb9022c343f6f468630365e8faecbf6bdecc78983fec1e23751cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.7
|
Release files / nostr_agents-0.0.1-py3-none-any.whl
| Download URL | nostr_agents-0.0.1-py3-none-any.whl |
|---|---|
| Size | 16.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2feb8f9832676a6ec1fd47237ffab711d365e96c084af8ea9574a1e32003acdd
|
|
BLAKE2b-256 checksum How to use checksums |
8487f97b1dabe9a9e40940ad500e3ad9859d8e58f9bccc59516868f498c5ecb3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.7
|
Security for nostr-agents 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.