documentation/docs/mcp/nostrbook-mcp.md
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import GooseDesktopInstaller from '@site/src/components/GooseDesktopInstaller'; import CLIExtensionInstructions from '@site/src/components/CLIExtensionInstructions';
This tutorial covers how to add the Nostrbook MCP Server as a goose extension to provide access to a comprehensive registry of Nostr documentation that helps users understand the decentralized social protocol, its implementation possibilities, and technical specifications.
:::tip Quick Install
<Tabs groupId="interface">
<TabItem value="ui" label="goose Desktop" default>
Launch the installer
</TabItem>
<TabItem value="cli" label="goose CLI">
Command
sh npx -y @nostrbook/mcp@latest
</TabItem>
</Tabs>
:::
:::info
Note that you'll need Node.js installed on your system to run this command, as it uses npx.
:::
goose, what is the NIP-61 and how can I implement it?.
Note that IDs have been changed to generic ones
:::note CLI
<details> <summary>Tool Calls</summary>─── read_nip | nostrbook ──────────────────────────
nip: 61
NIP-61 defines "Nutzaps," which are P2PK Cashu tokens where the payment itself acts as the receipt. This protocol allows for Bitcoin micropayments through the Nostr ecosystem using Cashu tokens.
Nutzaps enable users to send small Bitcoin payments to each other through Nostr events, with the tokens being locked to the recipient's specified public key.
Create and publish a kind:10019 event to inform others how to send you money:
{
"kind": 10019,
"tags": [
["relay", "wss://your-relay1.com"],
["relay", "wss://your-relay2.com"],
["mint", "https://your-trusted-mint.com", "sat"],
["pubkey", "<your-p2pk-pubkey>"]
]
}
pubkey should be a dedicated public key (NOT your Nostr identity key)To implement nutzapping:
Query recipient information:
// Fetch recipient's kind:10019 event
const recipientInfo = await relay.get({
kinds: [10019],
authors: [recipientPubkey]
});
Extract mint and P2PK information:
const recipientMints = recipientInfo.tags
.filter(tag => tag[0] === 'mint')
.map(tag => tag[1]);
const recipientLockKey = recipientInfo.tags
.find(tag => tag[0] === 'pubkey')?.[1];
Mint or swap tokens at one of the recipient's trusted mints, P2PK-locking them to their specified key
Publish the nutzap event:
{
"kind": 9321,
"content": "Thanks for your post!",
"tags": [
["proof", "{\"amount\":1,\"C\":\"02...3f\",\"id\":\"000...\",\"secret\":\"[\\\"P2PK\\\",...]\"}"],
["u", "https://recipient-specified-mint.com"],
["e", "<event-being-zapped>", "<relay-hint>"],
["p", "<recipient-pubkey>"]
]
}
To implement nutzap receiving:
Query for incoming nutzaps:
// Subscribe to nutzap events
relay.subscribe([
{
kinds: [9321],
"#p": [myPubkey],
"#u": myTrustedMints,
since: lastCheckTimestamp
}
]);
Validate incoming nutzaps:
Redeem the token:
kind:7376 event to record redemption:{
"kind": 7376,
"content": "<encrypted-content>",
"tags": [
["e", "<nutzap-event-id>", "", "redeemed"],
["p", "<sender-pubkey>"]
]
}
When testing your implementation:
By following these steps, you can implement a complete nutzap solution that allows users to send and receive Bitcoin micropayments through the Nostr protocol using Cashu tokens.
:::