@theihtisham/mcp-server-firebase 1.0.0 → 1.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/.editorconfig +12 -0
- package/.github/ISSUE_TEMPLATE/bug_report.yml +43 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +33 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +18 -0
- package/.github/dependabot.yml +16 -0
- package/.github/workflows/ci.yml +36 -0
- package/.github/workflows/release.yml +23 -0
- package/CODE_OF_CONDUCT.md +27 -0
- package/Dockerfile +8 -0
- package/README.md +50 -313
- package/SECURITY.md +22 -0
- package/package.json +57 -53
package/.editorconfig
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: Bug Report
|
|
2
|
+
description: Report a bug or unexpected behavior
|
|
3
|
+
labels: [bug]
|
|
4
|
+
body:
|
|
5
|
+
- type: textarea
|
|
6
|
+
id: description
|
|
7
|
+
attributes:
|
|
8
|
+
label: Bug Description
|
|
9
|
+
description: What happened?
|
|
10
|
+
placeholder: "When I run agent-memory..."
|
|
11
|
+
validations:
|
|
12
|
+
required: true
|
|
13
|
+
|
|
14
|
+
- type: textarea
|
|
15
|
+
id: steps
|
|
16
|
+
attributes:
|
|
17
|
+
label: Steps to Reproduce
|
|
18
|
+
description: How can we reproduce this?
|
|
19
|
+
placeholder: "1. Install...\n2. Configure...\n3. Run..."
|
|
20
|
+
validations:
|
|
21
|
+
required: true
|
|
22
|
+
|
|
23
|
+
- type: textarea
|
|
24
|
+
id: expected
|
|
25
|
+
attributes:
|
|
26
|
+
label: Expected Behavior
|
|
27
|
+
description: What should have happened?
|
|
28
|
+
validations:
|
|
29
|
+
required: true
|
|
30
|
+
|
|
31
|
+
- type: textarea
|
|
32
|
+
id: environment
|
|
33
|
+
attributes:
|
|
34
|
+
label: Environment
|
|
35
|
+
description: Node version, OS, etc.
|
|
36
|
+
placeholder: "Node 20.11.0, macOS 14, agent-memory 1.0.0"
|
|
37
|
+
|
|
38
|
+
- type: textarea
|
|
39
|
+
id: logs
|
|
40
|
+
attributes:
|
|
41
|
+
label: Relevant Logs
|
|
42
|
+
description: Paste any relevant log output
|
|
43
|
+
render: shell
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Feature Request
|
|
2
|
+
description: Suggest a new feature or enhancement
|
|
3
|
+
labels: [enhancement]
|
|
4
|
+
body:
|
|
5
|
+
- type: textarea
|
|
6
|
+
id: problem
|
|
7
|
+
attributes:
|
|
8
|
+
label: Problem
|
|
9
|
+
description: What problem does this feature solve?
|
|
10
|
+
placeholder: "I'm frustrated when..."
|
|
11
|
+
validations:
|
|
12
|
+
required: true
|
|
13
|
+
|
|
14
|
+
- type: textarea
|
|
15
|
+
id: solution
|
|
16
|
+
attributes:
|
|
17
|
+
label: Proposed Solution
|
|
18
|
+
description: How should it work?
|
|
19
|
+
validations:
|
|
20
|
+
required: true
|
|
21
|
+
|
|
22
|
+
- type: dropdown
|
|
23
|
+
id: type
|
|
24
|
+
attributes:
|
|
25
|
+
label: Feature Type
|
|
26
|
+
options:
|
|
27
|
+
- New Tool/Resource
|
|
28
|
+
- Performance Improvement
|
|
29
|
+
- Developer Experience
|
|
30
|
+
- Documentation
|
|
31
|
+
- Other
|
|
32
|
+
validations:
|
|
33
|
+
required: true
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
|
|
3
|
+
<!-- Brief description of changes -->
|
|
4
|
+
|
|
5
|
+
## Type of Change
|
|
6
|
+
|
|
7
|
+
- [ ] Bug fix
|
|
8
|
+
- [ ] New feature
|
|
9
|
+
- [ ] Breaking change
|
|
10
|
+
- [ ] Documentation update
|
|
11
|
+
- [ ] Refactor / cleanup
|
|
12
|
+
|
|
13
|
+
## Checklist
|
|
14
|
+
|
|
15
|
+
- [ ] Tests pass (`npm test`)
|
|
16
|
+
- [ ] Type checks pass (`npm run lint`)
|
|
17
|
+
- [ ] No secrets or credentials introduced
|
|
18
|
+
- [ ] Commit messages follow [conventional commits](https://www.conventionalcommits.org/)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: npm
|
|
4
|
+
directory: /
|
|
5
|
+
schedule:
|
|
6
|
+
interval: weekly
|
|
7
|
+
day: monday
|
|
8
|
+
open-pull-requests-limit: 5
|
|
9
|
+
commit-message:
|
|
10
|
+
prefix: chore
|
|
11
|
+
include: scope
|
|
12
|
+
|
|
13
|
+
- package-ecosystem: github-actions
|
|
14
|
+
directory: /
|
|
15
|
+
schedule:
|
|
16
|
+
interval: monthly
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build-and-test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
node-version: [18, 20, 22]
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- uses: actions/setup-node@v4
|
|
18
|
+
with:
|
|
19
|
+
node-version: ${{ matrix.node-version }}
|
|
20
|
+
cache: npm
|
|
21
|
+
- run: npm ci
|
|
22
|
+
- run: npm run lint
|
|
23
|
+
- run: npm test
|
|
24
|
+
- run: npm run build
|
|
25
|
+
|
|
26
|
+
coverage:
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
needs: build-and-test
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/checkout@v4
|
|
31
|
+
- uses: actions/setup-node@v4
|
|
32
|
+
with:
|
|
33
|
+
node-version: 20
|
|
34
|
+
cache: npm
|
|
35
|
+
- run: npm ci
|
|
36
|
+
- run: npm run test:coverage
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
id-token: write
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-node@v4
|
|
16
|
+
with:
|
|
17
|
+
node-version: 20
|
|
18
|
+
registry-url: https://registry.npmjs.org
|
|
19
|
+
- run: npm ci
|
|
20
|
+
- run: npm run build
|
|
21
|
+
- run: npm publish --provenance --access public
|
|
22
|
+
env:
|
|
23
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone.
|
|
6
|
+
|
|
7
|
+
## Our Standards
|
|
8
|
+
|
|
9
|
+
Examples of behavior that contributes to a positive environment:
|
|
10
|
+
- Demonstrating empathy and kindness toward other people
|
|
11
|
+
- Being respectful of differing opinions, viewpoints, and experiences
|
|
12
|
+
- Giving and gracefully accepting constructive feedback
|
|
13
|
+
- Accepting responsibility and apologizing to those affected by our mistakes
|
|
14
|
+
|
|
15
|
+
Examples of unacceptable behavior:
|
|
16
|
+
- The use of sexualized language or imagery
|
|
17
|
+
- Trolling, insulting or derogatory comments
|
|
18
|
+
- Public or private harassment
|
|
19
|
+
- Publishing others' private information without explicit permission
|
|
20
|
+
|
|
21
|
+
## Enforcement
|
|
22
|
+
|
|
23
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to **Theihtisham@outlook.com**.
|
|
24
|
+
|
|
25
|
+
## Attribution
|
|
26
|
+
|
|
27
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 2.1.
|
package/Dockerfile
ADDED
package/README.md
CHANGED
|
@@ -1,362 +1,99 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://opensource.org/licenses/MIT)
|
|
5
|
-
[](https://nodejs.org/)
|
|
6
|
-
[](https://www.typescriptlang.org/)
|
|
7
|
-
[](https://vitest.dev/)
|
|
3
|
+
<img width="100%" height="180" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 960 180'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0%25' y1='0%25' x2='100%25' y2='100%25'%3E%3Cstop offset='0%25' stop-color='%23fbbf24'/%3E%3Cstop offset='100%25' stop-color='%23ff6d00'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='960' height='180' fill='%230a0a1a' rx='16'/%3E%3Crect x='2' y='2' width='956' height='176' fill='none' stroke='url(%23g)' stroke-width='2' rx='15'/%3E%3Ctext x='480' y='75' text-anchor='middle' fill='white' font-family='system-ui' font-size='38' font-weight='bold'%3E%F0%9F%94%A5 MCP Firebase%3C/text%3E%3Ctext x='480' y='115' text-anchor='middle' fill='%23a5a5c0' font-family='system-ui' font-size='18'%3EFirebase via Natural Language — MCP Server%3C/text%3E%3Ctext x='480' y='148' text-anchor='middle' fill='%236b6b88' font-family='monospace' font-size='13'%3EFirestore %C2%B7 Realtime DB %C2%B7 Auth %C2%B7 Storage %C2%B7 Admin SDK%3C/text%3E%3C/svg%3E" alt="MCP Firebase Banner"/>
|
|
8
4
|
|
|
9
|
-
|
|
5
|
+
[](https://github.com/theihtisham/mcp-server-firebase/actions/workflows/ci.yml)
|
|
6
|
+
[](https://www.npmjs.com/package/@theihtisham/mcp-server-firebase)
|
|
7
|
+
[](https://www.npmjs.com/package/@theihtisham/mcp-server-firebase)
|
|
8
|
+
[](https://github.com/theihtisham/mcp-server-firebase/stargazers)
|
|
9
|
+
[](https://opensource.org/licenses/MIT)
|
|
10
|
+
[](https://www.typescriptlang.org/)
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
**MCP server for Firebase — Firestore, Realtime Database, Auth, and Storage via natural language.**
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
## Features
|
|
14
|
+
[Quick Start](#-quick-start) · [Architecture](#-architecture) · [Configuration](#-configuration)
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
- **Firestore**: Query, CRUD, batch writes, transactions, aggregation, real-time listeners, schema inference
|
|
19
|
-
- **Auth**: Create, read, update, delete users, verify tokens, manage custom claims
|
|
20
|
-
- **Storage**: Upload, download, list, delete files, generate signed URLs
|
|
21
|
-
- **Realtime DB**: Full CRUD with advanced querying (orderBy, filters, limits)
|
|
22
|
-
- **Cloud Functions**: List, trigger, read logs
|
|
23
|
-
- **Messaging (FCM)**: Send notifications, multicast, topic subscriptions
|
|
24
|
-
- **Secure by default**: Input validation, NoSQL injection prevention, path traversal protection
|
|
25
|
-
- **Production-ready**: LRU caching, automatic pagination, connection pooling, structured errors with fix suggestions
|
|
26
|
-
- **Type-safe**: TypeScript strict mode with comprehensive Zod-style validation
|
|
16
|
+
</div>
|
|
27
17
|
|
|
28
18
|
---
|
|
29
19
|
|
|
30
|
-
##
|
|
20
|
+
## Architecture
|
|
31
21
|
|
|
22
|
+
```mermaid
|
|
23
|
+
graph TD
|
|
24
|
+
A[MCP Client] --> B[Server<br/>MCP Protocol]
|
|
25
|
+
B --> C[Core Engine]
|
|
26
|
+
C --> D[SQLite Storage]
|
|
27
|
+
C --> E[Search / Query]
|
|
28
|
+
style B fill:%23fbbf24,color:#fff
|
|
29
|
+
style C fill:%23ff6d00,color:#fff
|
|
32
30
|
```
|
|
33
|
-
User: Show me all users who signed up this week
|
|
34
|
-
|
|
35
|
-
AI: I'll query the users collection, filtering by creation date.
|
|
36
|
-
|
|
37
|
-
[calls firestore_query with:
|
|
38
|
-
collection: "users"
|
|
39
|
-
where: [{ field: "createdAt", operator: ">=", value: "2026-04-04" }]
|
|
40
|
-
orderBy: [{ field: "createdAt", direction: "desc" }]
|
|
41
|
-
]
|
|
42
|
-
|
|
43
|
-
Found 23 users who signed up since April 4th. Here are the most recent:
|
|
44
|
-
|
|
45
|
-
| Name | Email | Joined |
|
|
46
|
-
|---------------|----------------------|---------------|
|
|
47
|
-
| Jane Smith | jane@example.com | Apr 9, 18:42 |
|
|
48
|
-
| Bob Wilson | bob@example.com | Apr 9, 15:11 |
|
|
49
|
-
| Alice Chen | alice@example.com | Apr 8, 22:03 |
|
|
50
|
-
... and 20 more.
|
|
51
|
-
|
|
52
|
-
User: Send a welcome notification to Jane
|
|
53
|
-
|
|
54
|
-
AI: I'll send a push notification to Jane's devices.
|
|
55
|
-
|
|
56
|
-
[calls auth_get_user with email: "jane@example.com"]
|
|
57
|
-
[calls messaging_send with:
|
|
58
|
-
topic: "user_jane_smith"
|
|
59
|
-
notification: { title: "Welcome!", body: "Thanks for joining us, Jane!" }
|
|
60
|
-
]
|
|
61
|
-
|
|
62
|
-
Notification sent successfully! Message ID: projects/myapp/messages/123456
|
|
63
|
-
|
|
64
|
-
User: What's the schema of the orders collection?
|
|
65
|
-
|
|
66
|
-
AI: Let me infer the schema by sampling documents.
|
|
67
|
-
|
|
68
|
-
[calls firestore_infer_schema with:
|
|
69
|
-
collection: "orders"
|
|
70
|
-
sampleSize: 20
|
|
71
|
-
]
|
|
72
31
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
| Field | Type | Presence | Nullable |
|
|
76
|
-
|-------------|----------|----------|----------|
|
|
77
|
-
| customerId | string | 100% | No |
|
|
78
|
-
| items | array | 100% | No |
|
|
79
|
-
| total | number | 100% | No |
|
|
80
|
-
| status | string | 95% | No |
|
|
81
|
-
| notes | string | 40% | Yes |
|
|
82
|
-
| shippedAt | timestamp| 60% | Yes |
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
## Installation
|
|
88
|
-
|
|
89
|
-
### Quick Start (Claude Desktop)
|
|
90
|
-
|
|
91
|
-
1. Install the package globally:
|
|
32
|
+
## Quick Start
|
|
92
33
|
|
|
93
34
|
```bash
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
2. Add to your Claude Desktop config (`~/AppData/Roaming/Claude/claude_desktop_config.json` on Windows or `~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
|
|
35
|
+
# Install
|
|
36
|
+
npm install -g @theihtisham/mcp-server-firebase
|
|
98
37
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
"mcpServers": {
|
|
102
|
-
"firebase": {
|
|
103
|
-
"command": "mcp-server-firebase",
|
|
104
|
-
"env": {
|
|
105
|
-
"FIREBASE_SERVICE_ACCOUNT_PATH": "/path/to/service-account-key.json"
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### From Source
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
git clone https://github.com/your-username/mcp-server-firebase.git
|
|
38
|
+
# Or from source
|
|
39
|
+
git clone https://github.com/theihtisham/mcp-server-firebase.git
|
|
116
40
|
cd mcp-server-firebase
|
|
117
|
-
npm install
|
|
118
|
-
npm run build
|
|
41
|
+
npm install && npm run build
|
|
119
42
|
```
|
|
120
43
|
|
|
121
|
-
|
|
44
|
+
### Configure with Claude Desktop
|
|
45
|
+
|
|
46
|
+
Add to `claude_desktop_config.json`:
|
|
122
47
|
|
|
123
48
|
```json
|
|
124
49
|
{
|
|
125
50
|
"mcpServers": {
|
|
126
|
-
"firebase": {
|
|
127
|
-
"command": "
|
|
128
|
-
"args": ["/
|
|
129
|
-
"env": {
|
|
130
|
-
"FIREBASE_SERVICE_ACCOUNT_PATH": "/path/to/service-account-key.json"
|
|
131
|
-
}
|
|
51
|
+
"mcp-server-firebase": {
|
|
52
|
+
"command": "npx",
|
|
53
|
+
"args": ["-y", "@theihtisham/mcp-server-firebase"]
|
|
132
54
|
}
|
|
133
55
|
}
|
|
134
56
|
}
|
|
135
57
|
```
|
|
136
58
|
|
|
137
|
-
### Authentication Options
|
|
138
|
-
|
|
139
|
-
The server supports multiple ways to authenticate with Firebase:
|
|
140
|
-
|
|
141
|
-
| Method | Environment Variable | Description |
|
|
142
|
-
|--------|---------------------|-------------|
|
|
143
|
-
| Service Account JSON string | `FIREBASE_SERVICE_ACCOUNT_KEY` | Full JSON as a single-line string |
|
|
144
|
-
| Service Account file path | `FIREBASE_SERVICE_ACCOUNT_PATH` | Path to JSON key file |
|
|
145
|
-
| Individual fields | `FIREBASE_PROJECT_ID`, `FIREBASE_CLIENT_EMAIL`, `FIREBASE_PRIVATE_KEY` | Separate env vars |
|
|
146
|
-
| Application Default Credentials | _(none needed)_ | Works on GCP, with `gcloud auth` |
|
|
147
|
-
|
|
148
|
-
Optional configuration:
|
|
149
|
-
|
|
150
|
-
| Variable | Description | Default |
|
|
151
|
-
|----------|-------------|---------|
|
|
152
|
-
| `FIREBASE_STORAGE_BUCKET` | Cloud Storage bucket name | Auto-detected from project |
|
|
153
|
-
| `FIREBASE_DATABASE_URL` | Realtime Database URL | Auto-detected from project |
|
|
154
|
-
| `FIREBASE_FUNCTIONS_REGION` | Cloud Functions region | `us-central1` |
|
|
155
|
-
|
|
156
59
|
---
|
|
157
60
|
|
|
158
|
-
##
|
|
159
|
-
|
|
160
|
-
### Firestore (13 tools)
|
|
161
|
-
|
|
162
|
-
| Tool | Description |
|
|
163
|
-
|------|-------------|
|
|
164
|
-
| `firestore_query` | Query collections with where, orderBy, limit, and pagination |
|
|
165
|
-
| `firestore_get_document` | Get a single document by path |
|
|
166
|
-
| `firestore_add_document` | Add a document with auto-generated ID |
|
|
167
|
-
| `firestore_set_document` | Create or overwrite a document (with optional merge) |
|
|
168
|
-
| `firestore_update_document` | Update specific fields (supports dot notation) |
|
|
169
|
-
| `firestore_delete_document` | Delete a document (optionally recursive) |
|
|
170
|
-
| `firestore_batch_write` | Atomic batch of up to 500 write operations |
|
|
171
|
-
| `firestore_transaction` | Read-then-write transaction for conditional updates |
|
|
172
|
-
| `firestore_list_collections` | List root collections or subcollections of a document |
|
|
173
|
-
| `firestore_list_subcollections` | List subcollections of a specific document |
|
|
174
|
-
| `firestore_aggregate_query` | Count, sum, average with optional filters |
|
|
175
|
-
| `firestore_listen_changes` | Listen for real-time changes (time-windowed) |
|
|
176
|
-
| `firestore_infer_schema` | Infer collection schema by sampling documents |
|
|
177
|
-
|
|
178
|
-
### Auth (7 tools)
|
|
179
|
-
|
|
180
|
-
| Tool | Description |
|
|
181
|
-
|------|-------------|
|
|
182
|
-
| `auth_create_user` | Create a new user (email, phone, password, etc.) |
|
|
183
|
-
| `auth_get_user` | Get user by UID, email, or phone number |
|
|
184
|
-
| `auth_list_users` | List users with pagination |
|
|
185
|
-
| `auth_update_user` | Update user properties |
|
|
186
|
-
| `auth_delete_user` | Delete a user |
|
|
187
|
-
| `auth_verify_token` | Verify and decode a Firebase ID token |
|
|
188
|
-
| `auth_set_custom_claims` | Set RBAC claims on a user |
|
|
189
|
-
|
|
190
|
-
### Storage (6 tools)
|
|
191
|
-
|
|
192
|
-
| Tool | Description |
|
|
193
|
-
|------|-------------|
|
|
194
|
-
| `storage_upload_file` | Upload a base64-encoded file |
|
|
195
|
-
| `storage_download_file` | Download a file (returns base64) |
|
|
196
|
-
| `storage_list_files` | List files with prefix filtering and pagination |
|
|
197
|
-
| `storage_delete_file` | Delete a file |
|
|
198
|
-
| `storage_get_signed_url` | Generate a time-limited signed URL |
|
|
199
|
-
| `storage_get_metadata` | Get file metadata (size, type, hashes) |
|
|
200
|
-
|
|
201
|
-
### Realtime Database (6 tools)
|
|
202
|
-
|
|
203
|
-
| Tool | Description |
|
|
204
|
-
|------|-------------|
|
|
205
|
-
| `rtdb_get_data` | Read data at a path |
|
|
206
|
-
| `rtdb_set_data` | Overwrite data at a path |
|
|
207
|
-
| `rtdb_push_data` | Push to a list with auto-generated key |
|
|
208
|
-
| `rtdb_update_data` | Update specific fields without full overwrite |
|
|
209
|
-
| `rtdb_remove_data` | Remove data at a path |
|
|
210
|
-
| `rtdb_query_data` | Query with orderBy, filters, and limits |
|
|
211
|
-
|
|
212
|
-
### Cloud Functions (3 tools)
|
|
61
|
+
## Docker
|
|
213
62
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
| `functions_trigger` | Trigger an HTTP Cloud Function |
|
|
218
|
-
| `functions_get_logs` | Get recent logs for a function |
|
|
219
|
-
|
|
220
|
-
### Messaging (4 tools)
|
|
221
|
-
|
|
222
|
-
| Tool | Description |
|
|
223
|
-
|------|-------------|
|
|
224
|
-
| `messaging_send` | Send a notification to a device, topic, or condition |
|
|
225
|
-
| `messaging_send_multicast` | Send to up to 500 devices at once |
|
|
226
|
-
| `messaging_subscribe_topic` | Subscribe tokens to a topic |
|
|
227
|
-
| `messaging_unsubscribe_topic` | Unsubscribe tokens from a topic |
|
|
228
|
-
|
|
229
|
-
---
|
|
230
|
-
|
|
231
|
-
## Query Builder Examples
|
|
232
|
-
|
|
233
|
-
### Firestore Query with Multiple Filters
|
|
234
|
-
|
|
235
|
-
```json
|
|
236
|
-
{
|
|
237
|
-
"collection": "orders",
|
|
238
|
-
"where": [
|
|
239
|
-
{ "field": "status", "operator": "==", "value": "active" },
|
|
240
|
-
{ "field": "total", "operator": ">", "value": 100 }
|
|
241
|
-
],
|
|
242
|
-
"orderBy": [{ "field": "total", "direction": "desc" }],
|
|
243
|
-
"limit": 50
|
|
244
|
-
}
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
### Pagination
|
|
248
|
-
|
|
249
|
-
```json
|
|
250
|
-
{
|
|
251
|
-
"collection": "products",
|
|
252
|
-
"limit": 100,
|
|
253
|
-
"pageToken": "cHJvZHVjdHMvcHJvZDEyMw=="
|
|
254
|
-
}
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
### Aggregation
|
|
258
|
-
|
|
259
|
-
```json
|
|
260
|
-
{
|
|
261
|
-
"collection": "orders",
|
|
262
|
-
"aggregations": [
|
|
263
|
-
{ "type": "count", "alias": "totalOrders" },
|
|
264
|
-
{ "type": "sum", "field": "total", "alias": "revenue" },
|
|
265
|
-
{ "type": "avg", "field": "total", "alias": "averageOrder" }
|
|
266
|
-
],
|
|
267
|
-
"where": [
|
|
268
|
-
{ "field": "status", "operator": "==", "value": "completed" }
|
|
269
|
-
]
|
|
270
|
-
}
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
### Realtime DB Query
|
|
274
|
-
|
|
275
|
-
```json
|
|
276
|
-
{
|
|
277
|
-
"path": "/scores",
|
|
278
|
-
"orderBy": { "child": "score" },
|
|
279
|
-
"limitToLast": 10
|
|
280
|
-
}
|
|
63
|
+
```bash
|
|
64
|
+
docker build -t mcp-server-firebase .
|
|
65
|
+
docker run mcp-server-firebase
|
|
281
66
|
```
|
|
282
67
|
|
|
283
68
|
---
|
|
284
69
|
|
|
285
|
-
## Security
|
|
286
|
-
|
|
287
|
-
This server is designed with security as a priority:
|
|
288
|
-
|
|
289
|
-
- **Service account key via environment variable** -- never hardcoded or committed
|
|
290
|
-
- **Input validation** on every parameter (paths, emails, UIDs, limits)
|
|
291
|
-
- **NoSQL injection prevention** -- field names starting with `$` or containing `.` are rejected
|
|
292
|
-
- **Path traversal prevention** -- storage paths with `..` or leading `/` are blocked
|
|
293
|
-
- **Field name restrictions** -- where clause fields starting with `__` are rejected
|
|
294
|
-
- **Custom claims size limit** -- enforces Firebase's 1000-byte limit
|
|
295
|
-
- **Reserved claim keys** -- prevents overwriting standard JWT claims
|
|
296
|
-
- **Batch operation limits** -- caps at 500 operations per batch
|
|
297
|
-
- **Signed URL limits** -- minimum 60s, maximum 7 days validity
|
|
298
|
-
|
|
299
|
-
---
|
|
300
|
-
|
|
301
70
|
## Development
|
|
302
71
|
|
|
303
72
|
```bash
|
|
304
|
-
# Install dependencies
|
|
305
73
|
npm install
|
|
306
|
-
|
|
307
|
-
# Build
|
|
308
74
|
npm run build
|
|
309
|
-
|
|
310
|
-
# Run tests
|
|
311
75
|
npm test
|
|
76
|
+
npm run lint
|
|
77
|
+
```
|
|
312
78
|
|
|
313
|
-
|
|
314
|
-
npm run test:watch
|
|
79
|
+
---
|
|
315
80
|
|
|
316
|
-
|
|
317
|
-
npm run test:coverage
|
|
81
|
+
## Trending Tags
|
|
318
82
|
|
|
319
|
-
|
|
320
|
-
npm run lint
|
|
83
|
+
`mcp firebase firestore realtime-database authentication storage` `typescript` `sqlite` `cli` `open-source`
|
|
321
84
|
|
|
322
|
-
|
|
323
|
-
npm run dev
|
|
324
|
-
```
|
|
85
|
+
---
|
|
325
86
|
|
|
326
|
-
|
|
87
|
+
## License
|
|
327
88
|
|
|
328
|
-
|
|
329
|
-
src/
|
|
330
|
-
index.ts # MCP server entry point
|
|
331
|
-
services/
|
|
332
|
-
firebase.ts # Firebase Admin SDK initialization
|
|
333
|
-
tools/
|
|
334
|
-
types.ts # ToolDefinition interface
|
|
335
|
-
index.ts # Tool aggregation and export
|
|
336
|
-
firestore.ts # 13 Firestore tools
|
|
337
|
-
auth.ts # 7 Auth tools
|
|
338
|
-
storage.ts # 6 Storage tools
|
|
339
|
-
realtime-db.ts # 6 Realtime DB tools
|
|
340
|
-
functions.ts # 3 Cloud Functions tools
|
|
341
|
-
messaging.ts # 4 FCM Messaging tools
|
|
342
|
-
utils/
|
|
343
|
-
index.ts # Re-exports
|
|
344
|
-
validation.ts # Input validation and sanitization
|
|
345
|
-
errors.ts # Error handling with fix suggestions
|
|
346
|
-
cache.ts # LRU cache with TTL and prefix invalidation
|
|
347
|
-
pagination.ts # Cursor-based pagination utilities
|
|
348
|
-
tests/
|
|
349
|
-
validation.test.ts # Validation tests (16 tests)
|
|
350
|
-
errors.test.ts # Error handling tests (10 tests)
|
|
351
|
-
cache.test.ts # Cache tests (12 tests)
|
|
352
|
-
pagination.test.ts # Pagination tests (4 tests)
|
|
353
|
-
tools.test.ts # Tool registration and validation tests (30+ tests)
|
|
354
|
-
firebase-service.test.ts # RTDB path validation tests
|
|
355
|
-
vitest.config.ts
|
|
356
|
-
```
|
|
89
|
+
MIT License — see [LICENSE](LICENSE) for details.
|
|
357
90
|
|
|
358
91
|
---
|
|
359
92
|
|
|
360
|
-
|
|
93
|
+
<div align="center">
|
|
94
|
+
|
|
95
|
+
**Built by [theihtisham](https://github.com/theihtisham)**
|
|
96
|
+
|
|
97
|
+
[GitHub](https://github.com/theihtisham) · [npm](https://www.npmjs.com/~theihtisham) · [Email](mailto:Theihtisham@outlook.com)
|
|
361
98
|
|
|
362
|
-
|
|
99
|
+
</div>
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
| Version | Supported |
|
|
6
|
+
| ------- | --------- |
|
|
7
|
+
| 1.x | Yes |
|
|
8
|
+
|
|
9
|
+
## Reporting a Vulnerability
|
|
10
|
+
|
|
11
|
+
If you discover a security vulnerability, please report it responsibly:
|
|
12
|
+
|
|
13
|
+
- **Email**: Theihtisham@outlook.com
|
|
14
|
+
- **Subject**: [Security] Vulnerability in ai-agent-memory
|
|
15
|
+
|
|
16
|
+
Please include:
|
|
17
|
+
1. Description of the vulnerability
|
|
18
|
+
2. Steps to reproduce
|
|
19
|
+
3. Potential impact
|
|
20
|
+
4. Suggested fix (if any)
|
|
21
|
+
|
|
22
|
+
We aim to respond within 48 hours and patch critical issues within 7 days.
|
package/package.json
CHANGED
|
@@ -1,53 +1,57 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@theihtisham/mcp-server-firebase",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "MCP server giving AI assistants full Firebase/Firestore access",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"bin": {
|
|
8
|
-
"mcp-server-firebase": "dist/index.js"
|
|
9
|
-
},
|
|
10
|
-
"scripts": {
|
|
11
|
-
"build": "tsc",
|
|
12
|
-
"dev": "tsx src/index.ts",
|
|
13
|
-
"start": "node dist/index.js",
|
|
14
|
-
"test": "vitest run",
|
|
15
|
-
"test:watch": "vitest",
|
|
16
|
-
"test:coverage": "vitest run --coverage",
|
|
17
|
-
"lint": "tsc --noEmit",
|
|
18
|
-
"clean": "rimraf dist",
|
|
19
|
-
"prepublishOnly": "npm run build"
|
|
20
|
-
},
|
|
21
|
-
"keywords": [
|
|
22
|
-
"mcp",
|
|
23
|
-
"firebase",
|
|
24
|
-
"firestore",
|
|
25
|
-
"ai",
|
|
26
|
-
"claude",
|
|
27
|
-
"model-context-protocol"
|
|
28
|
-
],
|
|
29
|
-
"author": "",
|
|
30
|
-
"license": "MIT",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
},
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
},
|
|
49
|
-
"repository": {
|
|
50
|
-
"type": "git",
|
|
51
|
-
"url": "https://github.com/theihtisham/mcp-server-firebase"
|
|
52
|
-
}
|
|
53
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@theihtisham/mcp-server-firebase",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "MCP server giving AI assistants full Firebase/Firestore access",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"mcp-server-firebase": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"dev": "tsx src/index.ts",
|
|
13
|
+
"start": "node dist/index.js",
|
|
14
|
+
"test": "vitest run",
|
|
15
|
+
"test:watch": "vitest",
|
|
16
|
+
"test:coverage": "vitest run --coverage",
|
|
17
|
+
"lint": "tsc --noEmit",
|
|
18
|
+
"clean": "rimraf dist",
|
|
19
|
+
"prepublishOnly": "npm run build"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"mcp",
|
|
23
|
+
"firebase",
|
|
24
|
+
"firestore",
|
|
25
|
+
"ai",
|
|
26
|
+
"claude",
|
|
27
|
+
"model-context-protocol"
|
|
28
|
+
],
|
|
29
|
+
"author": "theihtisham",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
36
|
+
"firebase-admin": "^12.7.0",
|
|
37
|
+
"zod": "^3.24.2"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/node": "^22.10.0",
|
|
41
|
+
"rimraf": "^6.0.1",
|
|
42
|
+
"tsx": "^4.19.0",
|
|
43
|
+
"typescript": "^5.7.0",
|
|
44
|
+
"vitest": "^2.1.0"
|
|
45
|
+
},
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=18.0.0"
|
|
48
|
+
},
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "git+https://github.com/theihtisham/mcp-server-firebase.git"
|
|
52
|
+
},
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://github.com/theihtisham/mcp-server-firebase/issues"
|
|
55
|
+
},
|
|
56
|
+
"homepage": "https://github.com/theihtisham/mcp-server-firebase#readme"
|
|
57
|
+
}
|