@bintangtimurlangit/shopee-mcp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/.env.example +25 -0
  2. package/CHANGELOG.md +22 -0
  3. package/CODE_OF_CONDUCT.md +12 -0
  4. package/CONTRIBUTING.md +48 -0
  5. package/LICENSE +21 -0
  6. package/README.md +134 -0
  7. package/SECURITY.md +29 -0
  8. package/build/api/client.d.ts +27 -0
  9. package/build/api/client.d.ts.map +1 -0
  10. package/build/api/client.js +57 -0
  11. package/build/api/client.js.map +1 -0
  12. package/build/api/types.d.ts +92 -0
  13. package/build/api/types.d.ts.map +1 -0
  14. package/build/api/types.js +4 -0
  15. package/build/api/types.js.map +1 -0
  16. package/build/browser/session.d.ts +30 -0
  17. package/build/browser/session.d.ts.map +1 -0
  18. package/build/browser/session.js +109 -0
  19. package/build/browser/session.js.map +1 -0
  20. package/build/index.d.ts +3 -0
  21. package/build/index.d.ts.map +1 -0
  22. package/build/index.js +33 -0
  23. package/build/index.js.map +1 -0
  24. package/build/login.d.ts +12 -0
  25. package/build/login.d.ts.map +1 -0
  26. package/build/login.js +53 -0
  27. package/build/login.js.map +1 -0
  28. package/build/tools/product.d.ts +3 -0
  29. package/build/tools/product.d.ts.map +1 -0
  30. package/build/tools/product.js +129 -0
  31. package/build/tools/product.js.map +1 -0
  32. package/build/tools/search.d.ts +3 -0
  33. package/build/tools/search.d.ts.map +1 -0
  34. package/build/tools/search.js +98 -0
  35. package/build/tools/search.js.map +1 -0
  36. package/build/utils/cache.d.ts +13 -0
  37. package/build/utils/cache.d.ts.map +1 -0
  38. package/build/utils/cache.js +33 -0
  39. package/build/utils/cache.js.map +1 -0
  40. package/build/utils/errors.d.ts +18 -0
  41. package/build/utils/errors.d.ts.map +1 -0
  42. package/build/utils/errors.js +44 -0
  43. package/build/utils/errors.js.map +1 -0
  44. package/docs/CONFIGURATION.md +73 -0
  45. package/docs/DEVELOPMENT.md +52 -0
  46. package/docs/README.md +14 -0
  47. package/docs/RELEASES.md +46 -0
  48. package/package.json +86 -0
@@ -0,0 +1,52 @@
1
+ # Development
2
+
3
+ ## Scripts
4
+
5
+ | Command | Description |
6
+ | ------------------- | ----------------------------------------------------------- |
7
+ | `npm install` | Install dependencies (also fetches the CloakBrowser binary) |
8
+ | `npm run login` | One-time: open a browser window and log into Shopee |
9
+ | `npm run build` | Compile TypeScript to `build/` (`tsc`) |
10
+ | `npm run dev` | Watch mode: `tsx watch src/index.ts` |
11
+ | `npm run start` | Run compiled server: `node build/index.js` |
12
+ | `npm run lint` | ESLint over the repo |
13
+ | `npm run format` | Prettier write; `npm run format:check` to verify |
14
+ | `npm run typecheck` | `tsc --noEmit`, strict, with unused-symbol checks |
15
+ | `npm test` | **Live smoke test** — needs a login and a display |
16
+
17
+ ## Project layout
18
+
19
+ ```
20
+ src/
21
+ index.ts # MCP server entry; registers tools
22
+ login.ts # one-time interactive login (npm run login)
23
+ api/
24
+ client.ts # navigates the real page and intercepts the app's response
25
+ types.ts # shared types
26
+ browser/
27
+ session.ts # CloakBrowser persistent-profile session
28
+ tools/
29
+ search.ts # search_products
30
+ product.ts # get_product_detail
31
+ utils/
32
+ cache.ts # in-memory TTL cache
33
+ errors.ts # error wrapper / friendly messages
34
+ test/
35
+ smoke.ts # the npm test health check
36
+ ```
37
+
38
+ ## Why a browser is required
39
+
40
+ Shopee does **not** expose an open API or server-rendered product HTML. Its `/api/v4/*` endpoints are guarded by an anti-fraud gate that requires per-request signature headers minted by Shopee's own obfuscated SDK. Plain `fetch`, headless Chromium, and hand-rolled in-page fetches are all rejected.
41
+
42
+ So this server drives **[CloakBrowser](https://github.com/CloakHQ/cloakbrowser)** (a fingerprint-patched Chromium) against a persistent profile you log into once, **navigates to the real Shopee page, and intercepts the response** its own app fetches — so the request carries valid signatures. The browser runs **headed** (Shopee detects headless); on a server use `xvfb`.
43
+
44
+ ## Build output
45
+
46
+ `npm run build` emits JavaScript under **`build/`**. The repo **gitignores** `build/`; CI and `prepublishOnly` run `npm run build`.
47
+
48
+ ## Tech stack
49
+
50
+ - TypeScript, **strict** (with `noUnusedLocals` / `noUnusedParameters`)
51
+ - Zod for MCP tool input validation
52
+ - `@modelcontextprotocol/sdk` (stdio), CloakBrowser + Playwright
package/docs/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # shopee-mcp documentation
2
+
3
+ **shopee-mcp** is a [Model Context Protocol](https://modelcontextprotocol.io/) server for **public discovery** on Shopee — product search and detail through a logged-in browser session — over **stdio**, for Claude Code, Claude Desktop, Cursor, and other MCP hosts. Discovery only; no seller features.
4
+
5
+ | Document | Description |
6
+ | ----------------------------------- | -------------------------------------------------------------------------------------------------------------- |
7
+ | [Configuration](./CONFIGURATION.md) | Env vars, `mcpServers` JSON, `xvfb` for headless machines, per-client setup |
8
+ | [Development](./DEVELOPMENT.md) | Scripts, build, login, the live smoke test, why a browser is required |
9
+ | [Releases](./RELEASES.md) | SemVer, npm tags, git tags, publishing, [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) |
10
+ | [Changelog](../CHANGELOG.md) | Version history ([Keep a Changelog](https://keepachangelog.com/en/1.1.0/)) |
11
+
12
+ **Installation** is in the [root README](../README.md#installation).
13
+
14
+ **Community, security, license:** [CONTRIBUTING.md](../CONTRIBUTING.md) · [SECURITY.md](../SECURITY.md) · [Code of Conduct](../CODE_OF_CONDUCT.md) · [MIT License](../LICENSE)
@@ -0,0 +1,46 @@
1
+ # Releases and versioning
2
+
3
+ This project uses **Semantic Versioning** ([SemVer 2.0](https://semver.org/)) for the **npm package**. The canonical version string is **`package.json`** → `version`.
4
+
5
+ Commit messages follow **[Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)** (`feat:`, `fix:`, `docs:`, `chore:`, …). That pairs with SemVer: `fix` → PATCH, `feat` → MINOR, breaking changes → MAJOR.
6
+
7
+ ## Version format
8
+
9
+ `MAJOR.MINOR.PATCH` — e.g. `0.1.0`, `1.2.3`.
10
+
11
+ - **MAJOR** — Breaking changes (removed/renamed tools, incompatible env or behavior).
12
+ - **MINOR** — Backward-compatible features (new tools, new optional config).
13
+ - **PATCH** — Bug fixes and safe corrections that do not change the public contract.
14
+
15
+ ## npm dist-tags
16
+
17
+ | Tag | Typical use |
18
+ | -------- | -------------------------------------------------------------------- |
19
+ | `latest` | Default stable install: `npm install @bintangtimurlangit/shopee-mcp` |
20
+ | `beta` | Optional prereleases: `npm publish --tag beta` with `X.Y.Z-beta.N` |
21
+
22
+ Scoped packages use **`"publishConfig": { "access": "public" }`**.
23
+
24
+ ## Publishing (maintainers)
25
+
26
+ Releases are **automated** by the [`release` workflow](../.github/workflows/release.yml): pushing a `vX.Y.Z` tag runs typecheck + build and publishes to npm (with [provenance](https://docs.npmjs.com/generating-provenance-statements)), then creates a GitHub release.
27
+
28
+ **One-time setup:** add an npm **automation token** as the repo secret **`NPM_TOKEN`**. Without it, the workflow still builds but skips publish.
29
+
30
+ **To cut a release:**
31
+
32
+ 1. Bump **`version`** in **`package.json`** per SemVer.
33
+ 2. Update **`CHANGELOG.md`**: move items from **`[Unreleased]`** into **`[X.Y.Z] - YYYY-MM-DD`**.
34
+ 3. Commit with Conventional Commits, e.g. `chore(release): v0.1.1`.
35
+ 4. Tag and push:
36
+
37
+ ```bash
38
+ git tag v0.1.1
39
+ git push origin main --tags
40
+ ```
41
+
42
+ 5. The workflow publishes to npm and opens the GitHub release.
43
+
44
+ ## Git tags
45
+
46
+ Tag stable releases as **`vX.Y.Z`**; prereleases **`vX.Y.Z-beta.N`**.
package/package.json ADDED
@@ -0,0 +1,86 @@
1
+ {
2
+ "name": "@bintangtimurlangit/shopee-mcp",
3
+ "version": "0.1.0",
4
+ "description": "An MCP server for exploring Shopee — product search and prices via an authenticated browser session. Discovery only, no seller features.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/bintangtimurlangit/shopee-mcp.git"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/bintangtimurlangit/shopee-mcp/issues"
16
+ },
17
+ "homepage": "https://github.com/bintangtimurlangit/shopee-mcp#readme",
18
+ "bin": {
19
+ "shopee-mcp": "build/index.js",
20
+ "shopee-mcp-login": "build/login.js"
21
+ },
22
+ "scripts": {
23
+ "clean": "node -e \"require('fs').rmSync('build',{recursive:true,force:true})\"",
24
+ "prebuild": "npm run clean",
25
+ "build": "tsc",
26
+ "login": "tsx src/login.ts",
27
+ "dev": "tsx watch src/index.ts",
28
+ "start": "node build/index.js",
29
+ "typecheck": "tsc --noEmit",
30
+ "lint": "eslint .",
31
+ "lint:fix": "eslint . --fix",
32
+ "format": "prettier --write .",
33
+ "format:check": "prettier --check .",
34
+ "test": "tsx test/smoke.ts",
35
+ "prepare": "husky",
36
+ "prepublishOnly": "npm run build"
37
+ },
38
+ "lint-staged": {
39
+ "*.{ts,js,json,md,yml,yaml}": "prettier --write",
40
+ "*.ts": "eslint --fix"
41
+ },
42
+ "files": [
43
+ "build",
44
+ ".env.example",
45
+ "docs",
46
+ "CHANGELOG.md",
47
+ "LICENSE",
48
+ "CONTRIBUTING.md",
49
+ "SECURITY.md",
50
+ "CODE_OF_CONDUCT.md"
51
+ ],
52
+ "keywords": [
53
+ "mcp",
54
+ "model-context-protocol",
55
+ "shopee",
56
+ "indonesia",
57
+ "ecommerce",
58
+ "marketplace",
59
+ "product-search",
60
+ "discovery"
61
+ ],
62
+ "dependencies": {
63
+ "@modelcontextprotocol/sdk": "^1.29.0",
64
+ "cloakbrowser": "^0.4.10",
65
+ "dotenv": "^17.4.2",
66
+ "playwright": "^1.49.0",
67
+ "zod": "^3.25.76"
68
+ },
69
+ "devDependencies": {
70
+ "@commitlint/cli": "^19.6.1",
71
+ "@commitlint/config-conventional": "^19.6.0",
72
+ "@eslint/js": "^9.17.0",
73
+ "@types/node": "^24.0.0",
74
+ "eslint": "^9.17.0",
75
+ "eslint-config-prettier": "^9.1.0",
76
+ "husky": "^9.1.7",
77
+ "lint-staged": "^15.3.0",
78
+ "prettier": "^3.4.2",
79
+ "tsx": "^4.23.0",
80
+ "typescript": "^5.9.0",
81
+ "typescript-eslint": "^8.19.0"
82
+ },
83
+ "engines": {
84
+ "node": ">=18.0.0"
85
+ }
86
+ }