npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

polymarket-guard-mcp

v0.1.2

Published

MCP server for Polymarket prediction markets — buy/sell positions with USDC pay-per-call billing via LemonCake

Readme

polymarket-guard-mcp — Polymarket Prediction Markets MCP Server

Buy/sell positions on Polymarket prediction markets, paying in USDC with per-call billing via LemonCake. Read-only mode works with no credentials.

npm version MCP Registry License: MIT

Installation

npx polymarket-guard-mcp

Or add to your MCP client (Claude Desktop, Cursor, etc.):

{
  "mcpServers": {
    "polymarket": {
      "command": "npx",
      "args": ["-y", "polymarket-mcp"],
      "env": {
        "POLYMARKET_PRIVATE_KEY": "0x<your-polygon-private-key>",
        "LEMONCAKE_SELLER_KEY": "<your-lemoncake-seller-key>"
      }
    }
  }
}

Environment Variables

| Variable | Required | Description | |---|---|---| | POLYMARKET_PRIVATE_KEY | For trading | Polygon wallet private key (0x-prefixed 32-byte hex). Required for positions, balance, and all trading tools. | | LEMONCAKE_SELLER_KEY | Optional | LemonCake seller key. Absent = Demo Mode (charges logged, no real billing). | | LEMON_CAKE_PERMIT | Optional | Client's ERC-2612 permit blob for non-custodial billing. Passed by the MCP client automatically when using LemonCake. |

Demo Mode

  • Free/read tools work with zero env vars — no key needed.
  • Account tools (get_positions, get_balance, get_trade_history) require POLYMARKET_PRIVATE_KEY.
  • Trading tools require POLYMARKET_PRIVATE_KEY.
  • LemonCake billing is a no-op in Demo Mode if LEMONCAKE_SELLER_KEY is absent — all tools still execute, charges are logged to stderr only.

Tools

Free (no charge)

| Tool | Description | |---|---| | list_markets | List active Polymarket markets with prices and volume | | search_markets | Search markets by keyword | | get_market | Get full market details by condition ID or slug | | get_order_book | Get live bid/ask order book for a market token |

$0.05 per call

| Tool | Description | |---|---| | get_positions | Your current open positions (shares held, P&L) | | get_balance | USDC balance and contract allowances | | get_trade_history | Past trades with prices and timestamps |

$0.10 per call

| Tool | Description | |---|---| | place_market_order | Buy/sell at market price (FOK with slippage tolerance) | | place_limit_order | Place a GTC/FOK/IOC limit order at a specific price | | cancel_order | Cancel an open limit order by ID | | redeem_positions | Claim USDC winnings from resolved markets |

Example Usage

# Find markets about the 2024 US election
search_markets(query="US election 2024")

# Get the order book for a specific outcome token
get_order_book(token_id="0x...")

# Check your current positions
get_positions()

# Buy 100 YES shares on a market (limit order at 0.65 = 65 cents/share)
place_limit_order(
  token_id="0x...",
  side="BUY",
  price=0.65,
  size=100
)

# Buy using market order with 2% slippage tolerance
place_market_order(
  token_id="0x...",
  side="BUY",
  amount=50  # $50 USDC
)

# Claim winnings after market resolves
redeem_positions(condition_id="0x...")

Architecture

  • Market data: Polymarket Gamma API (gamma-api.polymarket.com)
  • Trading: Polymarket CLOB API (clob.polymarket.com) with L1 EIP-712 auth
  • Chain: Polygon (chainId 137)
  • Token: USDC on Polygon (6 decimals)
  • Billing: LemonCake USDC pay-per-call (@lemon-cake/mcp-sdk)

Authentication Note

Polymarket's CLOB API uses L1 auth: EIP-712 typed-data signatures over each request. This implementation includes the complete request structure. For full production signing (real orders), install ethers and integrate the Wallet.signTypedData() method — the current build uses a placeholder signature that will receive a 401 from the CLOB for authenticated endpoints.

Full signing integration:

npm install ethers
import { ethers } from "ethers";
const wallet = new ethers.Wallet(process.env.POLYMARKET_PRIVATE_KEY!);
const sig = await wallet.signTypedData(domain, types, value);

Pricing & Billing

| Action | Cost | |---|---| | Browsing markets | Free | | Checking positions / balance | $0.05 USDC | | Placing / cancelling orders | $0.10 USDC | | Claiming winnings | $0.10 USDC |

Billing is handled by LemonCake — USDC pay-per-call infrastructure for MCP tools. No subscription, no monthly fees. You pay only when you call a tool.

Related MCP Servers

License

MIT