weneed-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.
- package/README.md +111 -0
- package/dist/firebase.d.ts +13 -0
- package/dist/firebase.js +97 -0
- package/dist/firebase.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +116 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas.d.ts +71 -0
- package/dist/schemas.js +30 -0
- package/dist/schemas.js.map +1 -0
- package/dist/tools.d.ts +8 -0
- package/dist/tools.js +152 -0
- package/dist/tools.js.map +1 -0
- package/dist/types.d.ts +61 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +42 -0
package/README.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# weneed-mcp
|
|
2
|
+
|
|
3
|
+
MCP server for [WeNeed](https://app.weneed.ch) - the Coop Switzerland shopping list app.
|
|
4
|
+
|
|
5
|
+
Manage your shopping lists, add/remove items, and search the Coop product catalog through any MCP-compatible client (Claude Code, Claude Desktop, Cursor, etc.).
|
|
6
|
+
|
|
7
|
+
> **Disclaimer**: This is an unofficial MCP server. WeNeed/Coop does not provide a public API. This project reverse-engineers the app's Firebase backend and may stop working at any time if they change their infrastructure.
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
- Node.js 18+
|
|
12
|
+
- A [WeNeed](https://app.weneed.ch) account (email/password login)
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install -g weneed-mcp
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Or run directly with `npx`:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx weneed-mcp
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Configuration
|
|
27
|
+
|
|
28
|
+
### Claude Code
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
claude mcp add weneed -- npx -y weneed-mcp
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Then set your credentials as environment variables, or add them to the MCP config:
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"mcpServers": {
|
|
39
|
+
"weneed": {
|
|
40
|
+
"command": "npx",
|
|
41
|
+
"args": ["-y", "weneed-mcp"],
|
|
42
|
+
"env": {
|
|
43
|
+
"WENEED_EMAIL": "your-email@example.com",
|
|
44
|
+
"WENEED_PASSWORD": "your-password"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Claude Desktop
|
|
52
|
+
|
|
53
|
+
Add to your `claude_desktop_config.json`:
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"mcpServers": {
|
|
58
|
+
"weneed": {
|
|
59
|
+
"command": "npx",
|
|
60
|
+
"args": ["-y", "weneed-mcp"],
|
|
61
|
+
"env": {
|
|
62
|
+
"WENEED_EMAIL": "your-email@example.com",
|
|
63
|
+
"WENEED_PASSWORD": "your-password"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### From source
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
git clone https://github.com/lewpgs/weneed-mcp.git
|
|
74
|
+
cd weneed-mcp
|
|
75
|
+
npm install
|
|
76
|
+
npm run build
|
|
77
|
+
node dist/index.js
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Available Tools
|
|
81
|
+
|
|
82
|
+
| Tool | Description |
|
|
83
|
+
|---|---|
|
|
84
|
+
| `get_shopping_lists` | Get all shopping lists you have access to, including shared lists |
|
|
85
|
+
| `get_list_items` | Get all active items in a specific shopping list |
|
|
86
|
+
| `add_item` | Add a product to a shopping list by name |
|
|
87
|
+
| `check_item` | Mark an item as checked/bought |
|
|
88
|
+
| `uncheck_item` | Uncheck a previously checked item |
|
|
89
|
+
| `remove_item` | Remove (deactivate) an item from a list |
|
|
90
|
+
| `search_catalog` | Search the Coop product catalog |
|
|
91
|
+
| `get_categories` | Get product categories from the Coop catalog |
|
|
92
|
+
|
|
93
|
+
## Example Usage
|
|
94
|
+
|
|
95
|
+
Once configured, you can interact naturally:
|
|
96
|
+
|
|
97
|
+
- "What's on my shopping list?"
|
|
98
|
+
- "Add milk and eggs to my list"
|
|
99
|
+
- "Check off the bananas"
|
|
100
|
+
- "Search the catalog for gluten-free pasta"
|
|
101
|
+
- "Remove the yogurt from my list"
|
|
102
|
+
|
|
103
|
+
## How It Works
|
|
104
|
+
|
|
105
|
+
WeNeed is a Progressive Web App backed by Firebase (Firestore + Cloud Functions). This MCP server authenticates with your credentials using the Firebase JS SDK, then reads/writes directly to the same Firestore collections and calls the same Cloud Functions that the official app uses.
|
|
106
|
+
|
|
107
|
+
Your credentials are only sent to Firebase/Google's authentication servers. They are never stored or transmitted anywhere else.
|
|
108
|
+
|
|
109
|
+
## License
|
|
110
|
+
|
|
111
|
+
MIT
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { collection, doc, getDoc, getDocs, setDoc, updateDoc, deleteDoc, query, where, type Firestore, type DocumentData, type QueryDocumentSnapshot, serverTimestamp } from "firebase/firestore";
|
|
2
|
+
import { type Functions } from "firebase/functions";
|
|
3
|
+
import type { FirestoreWrapper } from "./types.js";
|
|
4
|
+
export declare function getDb(): Firestore;
|
|
5
|
+
export declare function getFunctionsInstance(): Functions;
|
|
6
|
+
export declare function ensureAuth(): Promise<string>;
|
|
7
|
+
export declare function unwrapDoc<T>(doc: QueryDocumentSnapshot<DocumentData>): T & {
|
|
8
|
+
id: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function wrapForCreate<T extends Record<string, unknown>>(data: T, userId: string): FirestoreWrapper<T>;
|
|
11
|
+
export declare function wrapFieldsForUpdate(fields: Record<string, unknown>, userId: string): Record<string, unknown>;
|
|
12
|
+
export declare function callFunction<TReq, TRes>(name: string, data?: TReq): Promise<TRes>;
|
|
13
|
+
export { collection, doc, getDoc, getDocs, setDoc, updateDoc, deleteDoc, query, where, serverTimestamp, };
|
package/dist/firebase.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { initializeApp } from "firebase/app";
|
|
2
|
+
import { getAuth, signInWithEmailAndPassword, } from "firebase/auth";
|
|
3
|
+
import { getFirestore, collection, doc, getDoc, getDocs, setDoc, updateDoc, deleteDoc, query, where, serverTimestamp, } from "firebase/firestore";
|
|
4
|
+
import { getFunctions, httpsCallable, } from "firebase/functions";
|
|
5
|
+
const FIREBASE_CONFIG = {
|
|
6
|
+
apiKey: "AIzaSyC-xCc41xfBqInud6rCYC27OGQqcANk5jg",
|
|
7
|
+
authDomain: "coop-shoppinglist-prod1.firebaseapp.com",
|
|
8
|
+
projectId: "coop-shoppinglist-prod1",
|
|
9
|
+
storageBucket: "coop-shoppinglist-prod1.appspot.com",
|
|
10
|
+
messagingSenderId: "162667317917",
|
|
11
|
+
appId: "1:162667317917:web:6882cb0aebbb7a52e1a274",
|
|
12
|
+
};
|
|
13
|
+
let app = null;
|
|
14
|
+
let auth = null;
|
|
15
|
+
let db = null;
|
|
16
|
+
let functions = null;
|
|
17
|
+
let userCredential = null;
|
|
18
|
+
function getApp() {
|
|
19
|
+
if (!app) {
|
|
20
|
+
app = initializeApp(FIREBASE_CONFIG);
|
|
21
|
+
}
|
|
22
|
+
return app;
|
|
23
|
+
}
|
|
24
|
+
function getAuthInstance() {
|
|
25
|
+
if (!auth) {
|
|
26
|
+
auth = getAuth(getApp());
|
|
27
|
+
}
|
|
28
|
+
return auth;
|
|
29
|
+
}
|
|
30
|
+
export function getDb() {
|
|
31
|
+
if (!db) {
|
|
32
|
+
db = getFirestore(getApp());
|
|
33
|
+
}
|
|
34
|
+
return db;
|
|
35
|
+
}
|
|
36
|
+
export function getFunctionsInstance() {
|
|
37
|
+
if (!functions) {
|
|
38
|
+
functions = getFunctions(getApp(), "production");
|
|
39
|
+
}
|
|
40
|
+
return functions;
|
|
41
|
+
}
|
|
42
|
+
export async function ensureAuth() {
|
|
43
|
+
if (userCredential?.user) {
|
|
44
|
+
return userCredential.user.uid;
|
|
45
|
+
}
|
|
46
|
+
const email = process.env.WENEED_EMAIL;
|
|
47
|
+
const password = process.env.WENEED_PASSWORD;
|
|
48
|
+
if (!email || !password) {
|
|
49
|
+
throw new Error("Missing WENEED_EMAIL or WENEED_PASSWORD environment variables. " +
|
|
50
|
+
"Set them to your WeNeed account credentials.");
|
|
51
|
+
}
|
|
52
|
+
userCredential = await signInWithEmailAndPassword(getAuthInstance(), email, password);
|
|
53
|
+
return userCredential.user.uid;
|
|
54
|
+
}
|
|
55
|
+
export function unwrapDoc(doc) {
|
|
56
|
+
const raw = doc.data();
|
|
57
|
+
return {
|
|
58
|
+
...raw.data,
|
|
59
|
+
id: doc.id,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function getSource() {
|
|
63
|
+
return "weneed-mcp";
|
|
64
|
+
}
|
|
65
|
+
export function wrapForCreate(data, userId) {
|
|
66
|
+
const now = serverTimestamp();
|
|
67
|
+
return {
|
|
68
|
+
data,
|
|
69
|
+
origin: {
|
|
70
|
+
createdAt: now,
|
|
71
|
+
createdBy: userId,
|
|
72
|
+
source: getSource(),
|
|
73
|
+
},
|
|
74
|
+
activity: {
|
|
75
|
+
lastModifiedAt: now,
|
|
76
|
+
lastModifiedBy: userId,
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export function wrapFieldsForUpdate(fields, userId) {
|
|
81
|
+
const prefixed = {};
|
|
82
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
83
|
+
prefixed[`data.${key}`] = value;
|
|
84
|
+
}
|
|
85
|
+
prefixed["activity.lastModifiedAt"] = serverTimestamp();
|
|
86
|
+
prefixed["activity.lastModifiedBy"] = userId;
|
|
87
|
+
return prefixed;
|
|
88
|
+
}
|
|
89
|
+
export async function callFunction(name, data) {
|
|
90
|
+
await ensureAuth();
|
|
91
|
+
const fn = httpsCallable(getFunctionsInstance(), name);
|
|
92
|
+
const result = await fn(data);
|
|
93
|
+
return result.data;
|
|
94
|
+
}
|
|
95
|
+
// Re-export Firestore utilities for use in tools
|
|
96
|
+
export { collection, doc, getDoc, getDocs, setDoc, updateDoc, deleteDoc, query, where, serverTimestamp, };
|
|
97
|
+
//# sourceMappingURL=firebase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firebase.js","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAoB,MAAM,cAAc,CAAC;AAC/D,OAAO,EACL,OAAO,EACP,0BAA0B,GAG3B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,YAAY,EACZ,UAAU,EACV,GAAG,EACH,MAAM,EACN,OAAO,EACP,MAAM,EACN,SAAS,EACT,SAAS,EACT,KAAK,EACL,KAAK,EAIL,eAAe,GAEhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,YAAY,EACZ,aAAa,GAEd,MAAM,oBAAoB,CAAC;AAG5B,MAAM,eAAe,GAAG;IACtB,MAAM,EAAE,yCAAyC;IACjD,UAAU,EAAE,yCAAyC;IACrD,SAAS,EAAE,yBAAyB;IACpC,aAAa,EAAE,qCAAqC;IACpD,iBAAiB,EAAE,cAAc;IACjC,KAAK,EAAE,2CAA2C;CACnD,CAAC;AAEF,IAAI,GAAG,GAAuB,IAAI,CAAC;AACnC,IAAI,IAAI,GAAgB,IAAI,CAAC;AAC7B,IAAI,EAAE,GAAqB,IAAI,CAAC;AAChC,IAAI,SAAS,GAAqB,IAAI,CAAC;AACvC,IAAI,cAAc,GAA0B,IAAI,CAAC;AAEjD,SAAS,MAAM;IACb,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,GAAG,GAAG,aAAa,CAAC,eAAe,CAAC,CAAC;IACvC,CAAC;IACD,OAAO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
package/dist/index.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { GetListItemsSchema, AddItemSchema, CheckItemSchema, UncheckItemSchema, RemoveItemSchema, SearchCatalogSchema, GetCategoriesSchema, } from "./schemas.js";
|
|
5
|
+
import { getShoppingLists, getListItems, addItem, checkItem, uncheckItem, removeItem, searchCatalog, getCategories, } from "./tools.js";
|
|
6
|
+
const server = new McpServer({
|
|
7
|
+
name: "weneed-mcp",
|
|
8
|
+
version: "0.1.0",
|
|
9
|
+
});
|
|
10
|
+
// --- Tools ---
|
|
11
|
+
server.tool("get_shopping_lists", "Get all shopping lists the user has access to, including shared lists", {}, async () => {
|
|
12
|
+
try {
|
|
13
|
+
const result = await getShoppingLists();
|
|
14
|
+
return { content: [{ type: "text", text: result }] };
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
return {
|
|
18
|
+
content: [{ type: "text", text: `Error: ${error.message}` }],
|
|
19
|
+
isError: true,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
server.tool("get_list_items", "Get all active products/items in a specific shopping list", GetListItemsSchema.shape, async ({ listId }) => {
|
|
24
|
+
try {
|
|
25
|
+
const result = await getListItems(listId);
|
|
26
|
+
return { content: [{ type: "text", text: result }] };
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
return {
|
|
30
|
+
content: [{ type: "text", text: `Error: ${error.message}` }],
|
|
31
|
+
isError: true,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
server.tool("add_item", "Add a product to a shopping list by name. Use search_catalog first to find exact product matches from the Coop catalog.", AddItemSchema.shape, async ({ listId, name, description, locale }) => {
|
|
36
|
+
try {
|
|
37
|
+
const result = await addItem(listId, name, description ?? "", locale ?? "de");
|
|
38
|
+
return { content: [{ type: "text", text: result }] };
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
return {
|
|
42
|
+
content: [{ type: "text", text: `Error: ${error.message}` }],
|
|
43
|
+
isError: true,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
server.tool("check_item", "Mark an item as checked/bought in a shopping list", CheckItemSchema.shape, async ({ listId, itemId }) => {
|
|
48
|
+
try {
|
|
49
|
+
const result = await checkItem(listId, itemId);
|
|
50
|
+
return { content: [{ type: "text", text: result }] };
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
return {
|
|
54
|
+
content: [{ type: "text", text: `Error: ${error.message}` }],
|
|
55
|
+
isError: true,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
server.tool("uncheck_item", "Uncheck a previously checked item in a shopping list", UncheckItemSchema.shape, async ({ listId, itemId }) => {
|
|
60
|
+
try {
|
|
61
|
+
const result = await uncheckItem(listId, itemId);
|
|
62
|
+
return { content: [{ type: "text", text: result }] };
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
return {
|
|
66
|
+
content: [{ type: "text", text: `Error: ${error.message}` }],
|
|
67
|
+
isError: true,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
server.tool("remove_item", "Remove (deactivate) an item from a shopping list", RemoveItemSchema.shape, async ({ listId, itemId }) => {
|
|
72
|
+
try {
|
|
73
|
+
const result = await removeItem(listId, itemId);
|
|
74
|
+
return { content: [{ type: "text", text: result }] };
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
return {
|
|
78
|
+
content: [{ type: "text", text: `Error: ${error.message}` }],
|
|
79
|
+
isError: true,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
server.tool("search_catalog", "Search the Coop product catalog by name. Returns matching products with IDs that can be used with add_item.", SearchCatalogSchema.shape, async ({ query, locale }) => {
|
|
84
|
+
try {
|
|
85
|
+
const result = await searchCatalog(query, locale ?? "de");
|
|
86
|
+
return { content: [{ type: "text", text: result }] };
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
return {
|
|
90
|
+
content: [{ type: "text", text: `Error: ${error.message}` }],
|
|
91
|
+
isError: true,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
server.tool("get_categories", "Get product categories from the Coop catalog", GetCategoriesSchema.shape, async ({ locale }) => {
|
|
96
|
+
try {
|
|
97
|
+
const result = await getCategories(locale ?? "de");
|
|
98
|
+
return { content: [{ type: "text", text: result }] };
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
return {
|
|
102
|
+
content: [{ type: "text", text: `Error: ${error.message}` }],
|
|
103
|
+
isError: true,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
// --- Start ---
|
|
108
|
+
async function main() {
|
|
109
|
+
const transport = new StdioServerTransport();
|
|
110
|
+
await server.connect(transport);
|
|
111
|
+
}
|
|
112
|
+
main().catch((error) => {
|
|
113
|
+
console.error("Fatal error:", error);
|
|
114
|
+
process.exit(1);
|
|
115
|
+
});
|
|
116
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,OAAO,EACP,SAAS,EACT,WAAW,EACX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AAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const GetListItemsSchema: z.ZodObject<{
|
|
3
|
+
listId: z.ZodString;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
listId: string;
|
|
6
|
+
}, {
|
|
7
|
+
listId: string;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const AddItemSchema: z.ZodObject<{
|
|
10
|
+
listId: z.ZodString;
|
|
11
|
+
name: z.ZodString;
|
|
12
|
+
description: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
13
|
+
locale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
listId: string;
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
locale: string;
|
|
19
|
+
}, {
|
|
20
|
+
listId: string;
|
|
21
|
+
name: string;
|
|
22
|
+
description?: string | undefined;
|
|
23
|
+
locale?: string | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const CheckItemSchema: z.ZodObject<{
|
|
26
|
+
listId: z.ZodString;
|
|
27
|
+
itemId: z.ZodString;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
listId: string;
|
|
30
|
+
itemId: string;
|
|
31
|
+
}, {
|
|
32
|
+
listId: string;
|
|
33
|
+
itemId: string;
|
|
34
|
+
}>;
|
|
35
|
+
export declare const UncheckItemSchema: z.ZodObject<{
|
|
36
|
+
listId: z.ZodString;
|
|
37
|
+
itemId: z.ZodString;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
listId: string;
|
|
40
|
+
itemId: string;
|
|
41
|
+
}, {
|
|
42
|
+
listId: string;
|
|
43
|
+
itemId: string;
|
|
44
|
+
}>;
|
|
45
|
+
export declare const RemoveItemSchema: z.ZodObject<{
|
|
46
|
+
listId: z.ZodString;
|
|
47
|
+
itemId: z.ZodString;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
listId: string;
|
|
50
|
+
itemId: string;
|
|
51
|
+
}, {
|
|
52
|
+
listId: string;
|
|
53
|
+
itemId: string;
|
|
54
|
+
}>;
|
|
55
|
+
export declare const SearchCatalogSchema: z.ZodObject<{
|
|
56
|
+
query: z.ZodString;
|
|
57
|
+
locale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
locale: string;
|
|
60
|
+
query: string;
|
|
61
|
+
}, {
|
|
62
|
+
query: string;
|
|
63
|
+
locale?: string | undefined;
|
|
64
|
+
}>;
|
|
65
|
+
export declare const GetCategoriesSchema: z.ZodObject<{
|
|
66
|
+
locale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
67
|
+
}, "strip", z.ZodTypeAny, {
|
|
68
|
+
locale: string;
|
|
69
|
+
}, {
|
|
70
|
+
locale?: string | undefined;
|
|
71
|
+
}>;
|
package/dist/schemas.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const GetListItemsSchema = z.object({
|
|
3
|
+
listId: z.string().describe("The shopping list document ID"),
|
|
4
|
+
});
|
|
5
|
+
export const AddItemSchema = z.object({
|
|
6
|
+
listId: z.string().describe("The shopping list document ID to add the item to"),
|
|
7
|
+
name: z.string().describe("Name of the product to add"),
|
|
8
|
+
description: z.string().optional().default("").describe("Optional description or note for the item"),
|
|
9
|
+
locale: z.string().optional().default("de").describe("Locale for the product name (de, en, fr, it)"),
|
|
10
|
+
});
|
|
11
|
+
export const CheckItemSchema = z.object({
|
|
12
|
+
listId: z.string().describe("The shopping list document ID"),
|
|
13
|
+
itemId: z.string().describe("The product document ID within the list"),
|
|
14
|
+
});
|
|
15
|
+
export const UncheckItemSchema = z.object({
|
|
16
|
+
listId: z.string().describe("The shopping list document ID"),
|
|
17
|
+
itemId: z.string().describe("The product document ID within the list"),
|
|
18
|
+
});
|
|
19
|
+
export const RemoveItemSchema = z.object({
|
|
20
|
+
listId: z.string().describe("The shopping list document ID"),
|
|
21
|
+
itemId: z.string().describe("The product document ID within the list"),
|
|
22
|
+
});
|
|
23
|
+
export const SearchCatalogSchema = z.object({
|
|
24
|
+
query: z.string().describe("Search query for the Coop product catalog"),
|
|
25
|
+
locale: z.string().optional().default("de").describe("Locale for results (de, en, fr, it)"),
|
|
26
|
+
});
|
|
27
|
+
export const GetCategoriesSchema = z.object({
|
|
28
|
+
locale: z.string().optional().default("de").describe("Locale for category names (de, en, fr, it)"),
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;CAC7D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kDAAkD,CAAC;IAC/E,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;IACvD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,2CAA2C,CAAC;IACpG,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,8CA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d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function getShoppingLists(): Promise<string>;
|
|
2
|
+
export declare function getListItems(listId: string): Promise<string>;
|
|
3
|
+
export declare function addItem(listId: string, name: string, description: string, locale: string): Promise<string>;
|
|
4
|
+
export declare function checkItem(listId: string, itemId: string): Promise<string>;
|
|
5
|
+
export declare function uncheckItem(listId: string, itemId: string): Promise<string>;
|
|
6
|
+
export declare function removeItem(listId: string, itemId: string): Promise<string>;
|
|
7
|
+
export declare function searchCatalog(searchQuery: string, locale: string): Promise<string>;
|
|
8
|
+
export declare function getCategories(locale: string): Promise<string>;
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { ensureAuth, getDb, unwrapDoc, wrapForCreate, wrapFieldsForUpdate, callFunction, collection, doc, getDocs, setDoc, updateDoc, query, where, serverTimestamp, } from "./firebase.js";
|
|
2
|
+
// Collections
|
|
3
|
+
const LISTS = "v2_shoppingLists";
|
|
4
|
+
const PRODUCTS = "v2_shoppingListProducts";
|
|
5
|
+
function generateId() {
|
|
6
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
7
|
+
let result = "";
|
|
8
|
+
for (let i = 0; i < 20; i++) {
|
|
9
|
+
result += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
10
|
+
}
|
|
11
|
+
return result;
|
|
12
|
+
}
|
|
13
|
+
export async function getShoppingLists() {
|
|
14
|
+
const uid = await ensureAuth();
|
|
15
|
+
const db = getDb();
|
|
16
|
+
// Get lists where user is owner
|
|
17
|
+
const ownedQuery = query(collection(db, LISTS), where("data.owner", "==", uid));
|
|
18
|
+
const ownedSnap = await getDocs(ownedQuery);
|
|
19
|
+
// Get lists where user is participant
|
|
20
|
+
const participantQuery = query(collection(db, LISTS), where("data.participants", "array-contains", uid));
|
|
21
|
+
const participantSnap = await getDocs(participantQuery);
|
|
22
|
+
// Merge and deduplicate
|
|
23
|
+
const seen = new Set();
|
|
24
|
+
const lists = [];
|
|
25
|
+
for (const snap of [ownedSnap, participantSnap]) {
|
|
26
|
+
for (const docSnap of snap.docs) {
|
|
27
|
+
if (!seen.has(docSnap.id)) {
|
|
28
|
+
seen.add(docSnap.id);
|
|
29
|
+
lists.push(unwrapDoc(docSnap));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const result = lists.map((list) => ({
|
|
34
|
+
id: list.id,
|
|
35
|
+
name: list.name,
|
|
36
|
+
owner: list.owner,
|
|
37
|
+
isOwner: list.owner === uid,
|
|
38
|
+
participants: list.participants?.length ?? 0,
|
|
39
|
+
uncheckedItems: list.numberOfUncheckedProducts,
|
|
40
|
+
}));
|
|
41
|
+
return JSON.stringify(result, null, 2);
|
|
42
|
+
}
|
|
43
|
+
export async function getListItems(listId) {
|
|
44
|
+
await ensureAuth();
|
|
45
|
+
const db = getDb();
|
|
46
|
+
const productsQuery = query(collection(db, LISTS, listId, PRODUCTS), where("data.status", "==", "active"));
|
|
47
|
+
const snap = await getDocs(productsQuery);
|
|
48
|
+
const items = snap.docs.map((docSnap) => {
|
|
49
|
+
const item = unwrapDoc(docSnap);
|
|
50
|
+
return {
|
|
51
|
+
id: item.id,
|
|
52
|
+
productId: item.productId,
|
|
53
|
+
name: item.name,
|
|
54
|
+
description: item.description,
|
|
55
|
+
categoryId: item.categoryId,
|
|
56
|
+
checked: item.checked,
|
|
57
|
+
imageName: item.imageName,
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
// Sort: unchecked first, then checked
|
|
61
|
+
items.sort((a, b) => {
|
|
62
|
+
if (a.checked === b.checked)
|
|
63
|
+
return 0;
|
|
64
|
+
return a.checked ? 1 : -1;
|
|
65
|
+
});
|
|
66
|
+
return JSON.stringify(items, null, 2);
|
|
67
|
+
}
|
|
68
|
+
export async function addItem(listId, name, description, locale) {
|
|
69
|
+
const uid = await ensureAuth();
|
|
70
|
+
const db = getDb();
|
|
71
|
+
const nameObj = { de: "", en: "", fr: "", it: "" };
|
|
72
|
+
nameObj[locale] = name;
|
|
73
|
+
const productData = {
|
|
74
|
+
productId: generateId(),
|
|
75
|
+
name: nameObj,
|
|
76
|
+
description: description || "",
|
|
77
|
+
categoryId: null,
|
|
78
|
+
checked: false,
|
|
79
|
+
status: "active",
|
|
80
|
+
shoppingListId: listId,
|
|
81
|
+
attachmentImage: null,
|
|
82
|
+
source: "weneed-mcp",
|
|
83
|
+
synonyms: null,
|
|
84
|
+
keywords: null,
|
|
85
|
+
brands: null,
|
|
86
|
+
popularityIndex: null,
|
|
87
|
+
imageName: null,
|
|
88
|
+
type: "OTHER",
|
|
89
|
+
};
|
|
90
|
+
const docId = generateId();
|
|
91
|
+
const wrapped = wrapForCreate(productData, uid);
|
|
92
|
+
await setDoc(doc(db, LISTS, listId, PRODUCTS, docId), wrapped);
|
|
93
|
+
// Update the list's productLastModified fields
|
|
94
|
+
await updateDoc(doc(db, LISTS, listId), {
|
|
95
|
+
"data.productLastModifiedAt": serverTimestamp(),
|
|
96
|
+
"data.productLastModifiedBy": uid,
|
|
97
|
+
});
|
|
98
|
+
return JSON.stringify({
|
|
99
|
+
id: docId,
|
|
100
|
+
productId: productData.productId,
|
|
101
|
+
name: productData.name,
|
|
102
|
+
description: productData.description,
|
|
103
|
+
checked: false,
|
|
104
|
+
}, null, 2);
|
|
105
|
+
}
|
|
106
|
+
export async function checkItem(listId, itemId) {
|
|
107
|
+
const uid = await ensureAuth();
|
|
108
|
+
const db = getDb();
|
|
109
|
+
const updates = wrapFieldsForUpdate({ checked: true, lastCheckedAt: serverTimestamp() }, uid);
|
|
110
|
+
await updateDoc(doc(db, LISTS, listId, PRODUCTS, itemId), updates);
|
|
111
|
+
return JSON.stringify({ success: true, itemId, checked: true });
|
|
112
|
+
}
|
|
113
|
+
export async function uncheckItem(listId, itemId) {
|
|
114
|
+
const uid = await ensureAuth();
|
|
115
|
+
const db = getDb();
|
|
116
|
+
const updates = wrapFieldsForUpdate({ checked: false }, uid);
|
|
117
|
+
await updateDoc(doc(db, LISTS, listId, PRODUCTS, itemId), updates);
|
|
118
|
+
return JSON.stringify({ success: true, itemId, checked: false });
|
|
119
|
+
}
|
|
120
|
+
export async function removeItem(listId, itemId) {
|
|
121
|
+
const uid = await ensureAuth();
|
|
122
|
+
const db = getDb();
|
|
123
|
+
const updates = wrapFieldsForUpdate({ status: "inactive", checked: false }, uid);
|
|
124
|
+
await updateDoc(doc(db, LISTS, listId, PRODUCTS, itemId), updates);
|
|
125
|
+
// Update the list's productLastModified fields
|
|
126
|
+
await updateDoc(doc(db, LISTS, listId), {
|
|
127
|
+
"data.productLastModifiedAt": serverTimestamp(),
|
|
128
|
+
"data.productLastModifiedBy": uid,
|
|
129
|
+
});
|
|
130
|
+
return JSON.stringify({ success: true, itemId, removed: true });
|
|
131
|
+
}
|
|
132
|
+
export async function searchCatalog(searchQuery, locale) {
|
|
133
|
+
const result = await callFunction("catalogProducts_v2", { query: searchQuery, locale });
|
|
134
|
+
const products = (result.products ?? []).map((p) => ({
|
|
135
|
+
productId: p.productId,
|
|
136
|
+
name: p.name,
|
|
137
|
+
categoryId: p.categoryId,
|
|
138
|
+
imageName: p.imageName,
|
|
139
|
+
brands: p.brands,
|
|
140
|
+
}));
|
|
141
|
+
return JSON.stringify(products, null, 2);
|
|
142
|
+
}
|
|
143
|
+
export async function getCategories(locale) {
|
|
144
|
+
const result = await callFunction("catalogCategories_v2", { locale });
|
|
145
|
+
const categories = (result.categoryList ?? []).map((c) => ({
|
|
146
|
+
id: c.id,
|
|
147
|
+
name: c.name,
|
|
148
|
+
parentId: c.parentId,
|
|
149
|
+
}));
|
|
150
|
+
return JSON.stringify(categories, null, 2);
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,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OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC7C,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { FieldValue, Timestamp } from "firebase/firestore";
|
|
2
|
+
export interface FirestoreWrapper<T> {
|
|
3
|
+
data: T;
|
|
4
|
+
origin: {
|
|
5
|
+
createdAt: Timestamp | FieldValue;
|
|
6
|
+
createdBy: string;
|
|
7
|
+
source: string;
|
|
8
|
+
};
|
|
9
|
+
activity: {
|
|
10
|
+
lastModifiedAt: Timestamp | FieldValue;
|
|
11
|
+
lastModifiedBy: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface ShoppingListData {
|
|
15
|
+
name: string;
|
|
16
|
+
owner: string;
|
|
17
|
+
participants: string[] | null;
|
|
18
|
+
productLastModifiedAt: Timestamp | null;
|
|
19
|
+
productLastModifiedBy: string | null;
|
|
20
|
+
numberOfUncheckedProducts: number;
|
|
21
|
+
}
|
|
22
|
+
export interface ShoppingListProductData {
|
|
23
|
+
productId: string;
|
|
24
|
+
name: Record<string, string>;
|
|
25
|
+
description: string;
|
|
26
|
+
categoryId: string | null;
|
|
27
|
+
checked: boolean;
|
|
28
|
+
status: "active" | "inactive";
|
|
29
|
+
shoppingListId: string;
|
|
30
|
+
attachmentImage: string | null;
|
|
31
|
+
lastCheckedAt: Timestamp | null;
|
|
32
|
+
source: string | null;
|
|
33
|
+
synonyms: Record<string, string> | null;
|
|
34
|
+
keywords: Record<string, string> | null;
|
|
35
|
+
brands: string | null;
|
|
36
|
+
popularityIndex: number | null;
|
|
37
|
+
imageName: string | null;
|
|
38
|
+
type: string | null;
|
|
39
|
+
}
|
|
40
|
+
export interface CatalogProduct {
|
|
41
|
+
productId: string;
|
|
42
|
+
name: Record<string, string>;
|
|
43
|
+
categoryId: string;
|
|
44
|
+
imageName: string | null;
|
|
45
|
+
synonyms: Record<string, string> | null;
|
|
46
|
+
keywords: Record<string, string> | null;
|
|
47
|
+
brands: string | null;
|
|
48
|
+
popularityIndex: number | null;
|
|
49
|
+
type: string | null;
|
|
50
|
+
}
|
|
51
|
+
export interface Category {
|
|
52
|
+
id: string;
|
|
53
|
+
name: Record<string, string>;
|
|
54
|
+
parentId: string | null;
|
|
55
|
+
}
|
|
56
|
+
export interface CatalogSearchResponse {
|
|
57
|
+
products: CatalogProduct[];
|
|
58
|
+
}
|
|
59
|
+
export interface CatalogCategoriesResponse {
|
|
60
|
+
categoryList: Category[];
|
|
61
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "weneed-mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for WeNeed (Coop Switzerland) shopping lists",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"weneed-mcp": "dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"dev": "tsc --watch",
|
|
16
|
+
"start": "node dist/index.js",
|
|
17
|
+
"prepublishOnly": "npm run build"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/lewpgs/weneed-mcp.git"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/lewpgs/weneed-mcp",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/lewpgs/weneed-mcp/issues"
|
|
26
|
+
},
|
|
27
|
+
"author": "lewpgs",
|
|
28
|
+
"keywords": ["mcp", "weneed", "coop", "shopping-list", "firebase", "model-context-protocol"],
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
32
|
+
"firebase": "^11.7.1",
|
|
33
|
+
"zod": "^3.24.4"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/node": "^22.15.21",
|
|
37
|
+
"typescript": "^5.8.3"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=18.0.0"
|
|
41
|
+
}
|
|
42
|
+
}
|