Standalone read-only MCP server package for Shopstr marketplace data.
This package currently contains the standalone MCP shell, shared read-only infrastructure, relay-backed product/review tools, and relay-backed seller/storefront/reputation tools for public Shopstr marketplace data. Prompt and resource features will be added in follow-up PRs.
- Provides the
@shopstr/mcppackage metadata andshopstr-mcpbinary entry. - Reads relay, timeout, cache, and log-level settings from environment variables.
- Starts an MCP server over stdio for local MCP-compatible clients.
- Registers relay-backed read tools:
search_products,get_product_details,get_reviews,list_companies,get_company_details,get_storefront, andget_seller_reputation. - Registers disabled resource and prompt placeholders so
resources/listandprompts/listreturn valid empty lists until those features are added. - Provides reusable infrastructure modules for upcoming tools:
nostr-manager,relay-fetch,parse-tags,dedup,validation,errors,timeout,audit-log, andcache.
search_products: search public product listings by keyword, category, location, currency, and price range. Price filters requirecurrency. Category searches are pushed down to relays with#twhen possible, then checked again client-side with a broad fallback if no category-tagged results match. Hidden Gamma listings are excluded from search results. Responses are capped at 37 products for MCP token budgeting, even when a higherlimitis requested.get_product_details: fetch one product listing byproductAddress(30402:<seller-pubkey>:<product-d-tag>) or by 64-characterproductId. When givenproductId, the tool first resolves the product coordinate and then fetches the latest replaceable listing for that coordinate so agents do not accidentally use stale event IDs.get_reviews: fetch public reviews for a product address, product ID, or seller pubkey. Product reviews use the Shopstr/Gamma#daddress model and also query the standard#aaddress model.productIdis resolved to a product address when possible and keeps a legacy#efallback. Seller review lookups first derive the seller's product addresses, query Gamma/standard product review targets, and keep legacy#pas a fallback.list_companies: list public seller shop profiles from kind30019shop metadata. Responses are capped at 50 sellers and cache returned shop profiles for follow-up seller detail calls.get_company_details: fetch a seller's kind0profile, kind30019shop metadata, public products, reviews, and payment summary by pubkey or npub.get_storefront: fetch pubkey-based storefront configuration, seller profiles, products, and payment summary. Slug lookup is not supported since this is relay based MCP.get_seller_reputation: summarize public kind31555seller/product reviews into review counts, rating breakdowns, recent reviews, and a transparent trust-level snapshot.
Product responses expose Gamma-compatible fields where available, including
structured image objects, productType, productFormat, visibility
(hidden, on-sale, or pre-order), stock, and structured
shippingOptions. The parser keeps legacy Shopstr fields such as quantity,
embedded shipping, and subscription tags as fallback data when present.
Tool responses include relay degradation metadata in _meta, including queried
relays, successful relays, failed relays, coverage, response time, hints, and
truncation flags when response budgeting applies.
Seller/profile tools receive a process-local in-memory profile cache through
the shared tool context. The cache stores parsed public profile/shop responses
by pubkey and event kind, expires entries by TTL, and surfaces per-kind cache
hits in _meta.cached.
npm install
npm --prefix packages/shopstr-mcp run build
npm --prefix packages/shopstr-mcp startFor local configuration, copy .env.example and set the values your MCP client
or process manager should provide.
SHOPSTR_MCP_RELAYS: comma-separatedws://orwss://relay URLs.SHOPSTR_MCP_LOG_LEVEL:error,warn,info, ordebug.SHOPSTR_MCP_TOOL_TIMEOUT_MS: default future per-tool timeout in milliseconds.SHOPSTR_MCP_RELAY_CONNECT_TIMEOUT_MS: future relay connection timeout in milliseconds.SHOPSTR_MCP_RESOURCE_CACHE_TTL_MS: future resource cache TTL in milliseconds.SHOPSTR_MCP_PROFILE_CACHE_TTL_MS: in-memory parsed profile/shop cache TTL in milliseconds. Defaults toSHOPSTR_MCP_RESOURCE_CACHE_TTL_MSwhen unset or invalid.
Invalid or missing values fall back to safe defaults.
This package is intended to expose public Shopstr/Nostr read paths only. It must not accept private keys, sign events, create orders, access wallets, or perform checkout actions. Future tools should use allowlisted relay URLs, validated schemas, bounded timeouts, per-relay graceful degradation metadata, and audit logging.
npm --prefix packages/shopstr-mcp run build
npm --prefix packages/shopstr-mcp testnpx @modelcontextprotocol/inspector node shopstr/packages/shopstr-mcp/dist/index.js