npm package: @spntn/nft-saas-mcp
Description: MCP server for NFT SaaS Platform — lets AI agents mint NFTs, upload to IPFS, and generate lazy-mint signatures.
Latest version: 0.1.1

# @spntn/nft-saas-mcp

> MCP (Model Context Protocol) server for the NFT SaaS Platform.  
> Lets AI agents (Claude, Cursor, GitHub Copilot, etc.) mint NFTs, upload files to IPFS, and generate lazy-mint signatures — all through natural language.

---

## Tools

| Tool | Description |
|---|---|
| `upload_image_to_ipfs` | Upload a base64-encoded image to IPFS via Pinata |
| `upload_nft_metadata` | Upload ERC-721 metadata JSON to IPFS, returns `tokenURI` |
| `upload_full_nft` | One-shot: image upload + metadata generation + metadata upload |
| `get_mint_signature` | Generate lazy-mint signature for native token (POL/ETH) payment |
| `get_mint_signature_token` | Generate lazy-mint signature for ERC-20 payment (USDC / USDT) |
| `test_connection` | Check backend + IPFS connectivity |

---

## Prerequisites

1. NFT SaaS backend — already live at **`https://nft-saas-production.up.railway.app`**
2. An API key from the platform dashboard (`POST /api/auth/register` → `POST /api/auth/apikey`)

---

## Quickstart

```bash
# One-time run (no install needed)
NFT_SAAS_API_URL=https://nft-saas-production.up.railway.app \
NFT_SAAS_API_KEY=your_api_key \
npx @spntn/nft-saas-mcp
```

---

## Configure in your AI tool

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "nft-saas": {
      "command": "npx",
      "args": ["-y", "@spntn/nft-saas-mcp"],
      "env": {
        "NFT_SAAS_API_URL": "https://nft-saas-production.up.railway.app",
        "NFT_SAAS_API_KEY": "your_api_key"
      }
    }
  }
}
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "nft-saas": {
      "command": "npx",
      "args": ["-y", "@spntn/nft-saas-mcp"],
      "env": {
        "NFT_SAAS_API_URL": "https://nft-saas-production.up.railway.app",
        "NFT_SAAS_API_KEY": "your_api_key"
      }
    }
  }
}
```

### VS Code (GitHub Copilot) — `.vscode/mcp.json`

```json
{
  "servers": {
    "nft-saas": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@spntn/nft-saas-mcp"],
      "env": {
        "NFT_SAAS_API_URL": "https://nft-saas-production.up.railway.app",
        "NFT_SAAS_API_KEY": "your_api_key"
      }
    }
  }
}
```

---

## Example Agent Prompts

```
"Upload this artwork.jpg to IPFS and mint it as an NFT titled 'Sunset #1'
 for 2 POL. My wallet is 0xAbc123..."

"Create an NFT with the attached image, name 'Blue Abstract', description
 'An experimental piece', priced at 5 USDC."

"Test if the NFT SaaS backend is online."
```

---

## Environment Variables

| Variable | Required | Description |
|---|---|---|
| `NFT_SAAS_API_URL` | ✅ | Deployed backend base URL (no trailing slash) |
| `NFT_SAAS_API_KEY` | ✅ | API key from your platform account |

---

## Lazy Mint Flow (for agents)

```
1. upload_full_nft(image, name, description)  →  tokenURI
2. get_mint_signature(artistAddress, tokenURI, priceWei)  →  signature
3. Agent instructs the user to call buyAndMint() on the contract
   with the signature.
```

The smart contract address is on **Polygon Mainnet**:  
`0x1AFd1b0D36Db1bb8E9Cc0f359e37A76313270837`

---

## Publish to npm / GitHub Packages

```bash
cd mcp
npm install
npm run build
npm publish --access public
```

Or push to GitHub — CI can publish automatically via:

```yaml
# .github/workflows/publish-mcp.yml
- run: cd mcp && npm ci && npm run build && npm publish
  env:
    NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
```

---

## License

MIT