Agentic Shopping MCP

Agentic Shopping MCP

Enables AI agents to perform e-commerce operations including product search, budget-constrained shopping recommendations, and sustainability analysis. Includes a secure HTTP bridge with OAuth integration and observability features for production deployment.

Category
访问服务器

README

Agentic Shopping MCP

Production-ready MCP (Model Context Protocol) server that exposes commerce tools, plus a secure HTTP bridge that Cequence can place in front of for OAuth, scoping, and observability. Includes a simple Next.js demo UI.

Hackathon focus: “Build the Infrastructure for Autonomous Software”.
Transform apps into AI-ready, agent-accessible services using a Cequence AI Gateway with OAuth (Descope) and MCP.


🧱 What’s in here

  • MCP Server (src/server.tsdist/server.js)
    Tools:

    • commerce:ping, commerce:echo
    • commerce:search (local mock catalog)
    • commerce:details, commerce:reviews
    • commerce:budget_top (Budget Constraint AI)
    • commerce:sustainability (approx CO₂ calc)
  • HTTP Bridge (src/http_bridge.ts)
    Exposes POST /mcp/tools/call → spawns MCP server over stdio → calls tool.

    • Auth: Dev Bearer token or JWT (HS256/RS256).
    • Emits JSON logs w/ requestId → gateway-friendly.
  • Web Demo (/web, Next.js 15 + Tailwind)

    • Budget Constraint AI form
    • Sustainability badge

🗂️ Repo Structure (key paths)

. ├─ data/ │ ├─ catalog.sample.json │ └─ reviews.sample.json ├─ dist/ # built server files (gitignored) ├─ scripts/ │ └─ test_client.ts # MCP stdio test ├─ src/ │ ├─ app/api/commerce/route.ts # Web API -> MCP server │ ├─ http_bridge.ts # HTTP Bridge -> MCP server │ ├─ providers/amazon.ts # sample provider (file-based) │ └─ server.ts # MCP server (tools) └─ web/ ├─ src/app/page.tsx # UI └─ (Next.js project)


⚙️ Prerequisites

  • Node.js 20+
  • npm
  • (Optional) curl + jq for testing

🚀 Quick Start (Local)

# clone & install
git clone https://github.com/rochitl72/mcp-den.git
cd mcp-den
npm install

1) Build MCP Server

npm run build

2) Test MCP via stdio client

npm run test:client
# Expect:
# TOOLS: [ 'commerce' ]
# PING: pong
# ECHO: echo: hello mcp
# SEARCH/DETAILS/REVIEWS/BUDGET_TOP outputs...

3) Run the HTTP Bridge (Cequence-facing)

# DEV token mode
DEV_TOKEN=dev123 npm run bridge
# -> MCP HTTP bridge listening on http://localhost:8787

Call bridge with curl:

curl -s http://localhost:8787/mcp/tools/call \
  -H "authorization: Bearer dev123" \
  -H "content-type: application/json" \
  -d '{"name":"commerce","arguments":{"action":"budget_top","query":"phone","budgetMaxINR":15000,"featurePref":"camera","topK":3,"filters":{"minRating":3.5}}}' | jq .

4) Run the Web Demo

cd web
npm install
npm run dev
# http://localhost:3000


⸻

🔐 Auth Options (Bridge)

Set one of the following:
	•	Dev token (easy)

export DEV_TOKEN=dev123
npm run bridge


	•	JWT HS256

export JWT_MODE=hs256
export JWT_SECRET='<your-hs256-shared-secret>'
npm run bridge


	•	JWT RS256 (OIDC/Descope public key)

export JWT_MODE=rs256
export JWT_PUBLIC_KEY_B64="$(base64 -i public.pem)"
npm run bridge



Scopes checked (simple demo):
mcp:commerce:<action> or mcp:commerce:* when calling /mcp/tools/call.

⸻

🧪 HTTP Bridge API
	•	POST /mcp/tools/call
Headers:
	•	Authorization: Bearer <token>
	•	Content-Type: application/json
Body:

{ "name": "commerce", "arguments": { "action": "ping" } }

Response:

{ "ok": true, "requestId": "uuid", "tool": "commerce", "action": "ping", "data": "..." }


	•	GET /healthz → { "ok": true }

⸻

🌐 Hooking up Cequence AI Gateway
	•	Point Cequence upstream to the HTTP bridge (http://your-host:8787).
	•	Enforce:
	•	OAuth/JWT validation (issuer = Descope)
	•	Scopes → mcp:commerce:budget_top, etc.
	•	Rate limit / mTLS / logging
	•	Propagate headers: Authorization and x-request-id (or set at gateway)
	•	Observe logs: bridge prints JSON lines with requestId, user, action, duration.

⸻

🧩 Using from Agent Clients
	•	Claude Desktop / Crew / LangChain can use:
	•	stdio: point to dist/server.js
	•	HTTP: call the bridge endpoint from your agent runtime (Gateway in front for auth)

(You can also run the bridge in the same container as the MCP server.)

⸻

🛠️ Scripts

# package.json (root)
{
  "scripts": {
    "build": "tsc -p tsconfig.server.json",
    "dev": "tsx src/server.ts",
    "test:client": "tsx scripts/test_client.ts",
    "bridge": "tsx src/http_bridge.ts"
  }
}

Web project scripts (in /web):

{
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start"
  }
}


⸻

🔧 Environment

Create .env in repo root if needed:

# Bridge
DEV_TOKEN=dev123
# or JWT_MODE=hs256
# JWT_SECRET=your-secret
# or JWT_MODE=rs256
# JWT_PUBLIC_KEY_B64=base64-of-public-pem

# (Optional) values MCP server may read
X_USER=
X_REQUEST_ID=


⸻

🧰 Troubleshooting
	•	Timeouts from test client
Ensure only one MCP server registers tools; restart terminal if stray processes existed.
	•	ENOENT on catalog JSON
We resolve the data/ path relative to providers/amazon.ts—run npm run build again after editing.
	•	Next.js/Tailwind errors
Ensure web installed dev deps and Tailwind config is correct (postcss.config.js, tailwind.config.ts).
	•	401 from bridge
Provide Authorization: Bearer <DEV_TOKEN or JWT>.

⸻

📦 Deploy
	•	Bridge + MCP: Docker or Render/Fly. Expose port 8787.
	•	Web: Deploy /web to Vercel/Netlify.
	•	Configure Cequence to sit in front of the bridge with your OIDC (Descope).

(A Dockerfile + Fly/Render configs can be added on request.)

⸻

📜 License

MIT (or your choice)
MD

If you also want a quick **`.env.example`** for the repo:

```bash
cat > .env.example <<'ENV'
# One of the following auth modes for the HTTP bridge:

# Dev token mode (easy for local)
DEV_TOKEN=dev123

# JWT HS256 mode
# JWT_MODE=hs256
# JWT_SECRET=replace-with-shared-secret

# JWT RS256 mode
# JWT_MODE=rs256
# JWT_PUBLIC_KEY_B64=base64-of-your-public-pem
ENV

Commit & push:

git add README.md .env.example
git commit -m "Add README and env example"
git push

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选