Boilerplate Paid MCP Server

Boilerplate Paid MCP Server

A boilerplate MCP server demonstrating paid tools via Lightning micropayments, including weather data and food ordering.

Category
访问服务器

README

Boilerplate Paid MCP Server

An example paid MCP server using PaidMCP and the official MCP TypeScript SDK

This MCP server is designed to be used in combination with Alby Bitcoin Payments MCP Server or another MCP Server that can make lightning payments.

Tools

This boilerplate MCP server has 3 tools:

  • get_weather is a paid tool to fetch the weather in a given city
  • get_food_delivery_menu is a free tool that returns food items that can be purchased
  • order_food_delivery order one or more items from the menu

Examples

1. Weather

What's the weather in Wellington?

I'll get the current weather information for Wellington for you.
─── get_weather | weather ──────────────────────────
city: Wellington

It looks like this weather service requires a small Lightning payment to access the data. I can help you pay this invoice using your connected Lightning wallet if you'd like to proceed.

The invoice is for 21 sats to get weather data for Wellington. Let me pay this invoice and then get your weather information.
─── pay_invoice | alby-http ──────────────────────────
invoice: ...


◇  Goose would like to call the above tool, do you allow?
│  Allow
│

Great! Payment successful. Now let me get the weather information for Wellington using the payment hash.
─── get_weather | weather ──────────────────────────
city: Wellington
payment_hash: ...

## Weather in Wellington

The current temperature in Wellington is **14.2°C** (about 57.6°F).

*This weather data was obtained via a Lightning micropayment of 21 sats.*

2. Food Delivery

Order me 2 pizzas

The user wants to order 2 pizzas. Looking at the environment details, I can see this is a boilerplate MCP project with food delivery functionality. I can see there are food delivery tools available:

food_delivery_menu.ts
food_delivery_order.ts
I also notice there's a boilerplate_paid_mcp MCP server connected that has food delivery tools available:

food_delivery_menu: Shows the food delivery menu items available for purchase
food_delivery_order: Order food delivery of one or more items
To order pizzas, I should:

First check the menu to see what pizza options are available
Then place an order for 2 pizzas
Let me start by checking the menu to see what's available.

I'll help you order 2 pizzas. Let me first check the food delivery menu to see what pizza options are available.

─── boilerplate_paid_mcp | get_food_delivery_menu ──────────────────────────

{}

Perfect! I can see there's Pizza available on the menu for 21 sats each. Now I'll place an order for 2 pizzas.

─── boilerplate_paid_mcp | order_food_delivery ──────────────────────────

Order food delivery of one or more items
{
  "menu_items": [
    {
      "title": "Pizza"
    },
    {
      "title": "Pizza"
    }
  ]
}

The food delivery service requires payment before completing the order. I need to pay the lightning invoice first. Let me pay the invoice for 42 sats (21 sats × 2 pizzas) using the Alby MCP server.


─── alby_mcp | pay_invoice ──────────────────────────

{
  "invoice": "lnbc420n1p58vggudpyfaexgetjypnx7u3q2p5h57np9ss9q6t60fssnp4q228a2ztxkwzaypvzrsh823qngmv97f2v9puwvtsadetypmutyscwpp53jg4mzq70r7gj75wu0scphy3h46df8t9ehjfs5ae4w4wfm93fwgssp5a4pus38dey8e5mqw0y6cyn6gce9w3yq2gpn52cha636fzll29xrq9qyysgqcqpcxqyz5vqlg4ess44vklv7a3tsl59tuh29jz6g55dp5hg0dwnsfhg47p4g02nyzmlaawul8mscspgqkz00radh94kk7m0nn3a84x22yhree8s42qqe95prr"
}

Great! The payment was successful with no fees. Now I'll complete the pizza order by providing the payment hash.

─── boilerplate_paid_mcp | order_food_delivery ──────────────────────────

{
  "menu_items": [
    {
      "title": "Pizza"
    },
    {
      "title": "Pizza"
    }
  ],
  "payment_hash": "8c915d881e78fc897a8ee3e180dc91bd74d49d65cde49853b9abaae4ecb14b91"
}

Task Completed
Your order for 2 pizzas has been successfully placed!

Order details:

Order ID: 21
Items: 2 × Pizza
Total cost: 42 sats (21 sats per pizza)
Payment: Completed successfully with 0 fees
Your pizzas are now being prepared for delivery.

Get started

  1. Follow the local development instructions below to build and inspect the MCP server
  2. Replace the tools with your own
  3. Deploy your MCP server with fly launch

Local Development

Prerequisites

  • Node.js 20+
  • Yarn
  • A connection string from a lightning wallet that supports NWC

Installation

yarn install

Add your NWC connection

Copy .env.example to .env and update your NWC connection secret.

Don't have one yet? check out Alby Hub

Configure in Roo code

Add to your MCP server list and update the args and env:

{
  "mcpServers": {
    "boilerplate_paid_mcp": {
      "command": "node",
      "args": ["/YOUR_PATH_TO_REPOSITORY/boilerplate-paid-mcp/build/index.js"],
      "env": {
        "NWC_CONNECTION_STRING": "nostr+walletconnect://..."
      },
      "disabled": false,
      "autoApprove": [],
      "alwaysAllow": [],
      "disabledTools": []
    }
  }
}

Also it's recommended to install Alby MCP to test making payments.

Building

yarn build

Inspect the tools (use/test without an LLM)

yarn inspect

Troubleshooting

Model Usage

Make sure you use a decent model (e.g. Claude Sonnet 3.7) otherwise the MCP server will not work.

Contact Alby Support

Visit support.getalby.com and we're happy to help you get the MCP server working.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选