StevenGeller
MCP Server
StevenGeller
public

mcp l402 prototype

展示商户分类协议(MCP)与L402支付流程集成的基础原型。

Repository Info

0
Stars
0
Forks
0
Watchers
0
Issues
Python
Language
-
License

About This Server

展示商户分类协议(MCP)与L402支付流程集成的基础原型。

Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.

Documentation

# MCP + L402 Prototype

This project demonstrates a basic prototype of integrating Merchant Category Protocol (MCP) context with the L402 (Lightning Service Authentication Token) payment flow.

It simulates a client-server interaction where the client must "pay" a simulated Lightning invoice (by providing a correct preimage) to access a protected resource, which then returns data potentially enriched with MCP information.

## Setup

1.  **Create a virtual environment (optional but recommended):**
    ```bash
    python3 -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
    ```

2.  **Install dependencies:**
    ```bash
    pip install -r requirements.txt
    ```

## Running the Prototype

1.  **Start the server:**
    Open a terminal, navigate to the project directory (`mcp-l402-prototype`), and run:
    ```bash
    python server.py
    ```
    The server will start listening on `http://127.0.0.1:5001`.

2.  **Run the client:**
    Open a *second* terminal, navigate to the same project directory, and ensure your virtual environment is activated if you created one. Then run:
    ```bash
    python client.py
    ```

The client will:
*   Attempt to access the protected endpoint and receive a `402 Payment Required`.
*   Extract the simulated macaroon and invoice.
*   "Pay" the invoice using the hardcoded preimage.
*   Send a second request with the `Authorization: L402 <macaroon>:<preimage>` header.
*   Print the final successful response from the server, which includes the simulated MCP context.

## Notes

*   This is a simulation. No actual Lightning payments or macaroon cryptography are involved.
*   The preimage is hardcoded in both `server.py` and `client.py`.
*   The MCP code (`5812`) is hardcoded in the server for demonstration.
*   The server uses the Flask development server, not suitable for production.

Quick Start

1

Clone the repository

git clone https://github.com/StevenGeller/mcp-l402-prototype
2

Install dependencies

cd mcp-l402-prototype
npm install
3

Follow the documentation

Check the repository's README.md file for specific installation and usage instructions.

Repository Details

OwnerStevenGeller
Repomcp-l402-prototype
Language
Python
License-
Last fetched8/8/2025

Recommended MCP Servers

💬

Discord MCP

Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.

integrationsdiscordchat
🔗

Knit MCP

Connect AI agents to 200+ SaaS applications and automate workflows.

integrationsautomationsaas
🕷️

Apify MCP Server

Deploy and interact with Apify actors for web scraping and data extraction.

apifycrawlerdata
🌐

BrowserStack MCP

BrowserStack MCP Server for automated testing across multiple browsers.

testingqabrowsers

Zapier MCP

A Zapier server that provides automation capabilities for various apps.

zapierautomation