Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions src/servers/firestore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ This MCP server provides comprehensive integration with Google Cloud Firestore,
- **Update Documents**: Modify existing documents with partial updates
- **List Collections**: Discover available collections in your Firestore database
- **Complex Field Types**: Support for timestamps and document references
- **Emulator Support**: Work with Firestore emulator for development and testing

## Authentication

Expand Down Expand Up @@ -39,7 +38,6 @@ Query a Firestore collection with filters, ordering, and limits.
- `limit` (optional): Maximum number of documents to return (default: 10)
- `select_fields` (optional): Comma-separated document field paths to return (e.g. `code,name,accountName,sourceData.code`). When set, only these fields are fetched from Firestore; each document still includes `_id` with the document id. Omit to return full documents.
- `database` (optional): Database ID (defaults to "(default)")
- `use_emulator` (optional): Use Firestore emulator (default: false)

**Example:**
```json
Expand Down Expand Up @@ -83,7 +81,6 @@ Retrieve a single document by its path.
**Parameters:**
- `document_path` (required): Full path to the document (e.g., "users/user123")
- `database` (optional): Database ID (defaults to "(default)")
- `use_emulator` (optional): Use Firestore emulator (default: false)

**Example:**
```json
Expand All @@ -101,7 +98,6 @@ Create a new document in a Firestore collection with support for complex field t
- `document_data` (required): Document data with field names and values (cannot be empty)
- `document_id` (optional): Custom document ID (auto-generated if not provided)
- `database` (optional): Database ID (defaults to "(default)")
- `use_emulator` (optional): Use Firestore emulator (default: false)

**Example:**
```json
Expand Down Expand Up @@ -131,7 +127,6 @@ Update an existing document in Firestore with partial updates.
- `document_path` (required): Full path to the document (e.g., "users/user123")
- `document_data` (required): Document data to update (cannot be empty)
- `database` (optional): Database ID (defaults to "(default)")
- `use_emulator` (optional): Use Firestore emulator (default: false)

**Example:**
```json
Expand All @@ -158,7 +153,6 @@ List all collections in the database.

**Parameters:**
- `database` (optional): Database ID (defaults to "(default)")
- `use_emulator` (optional): Use Firestore emulator (default: false)

## Filter Operators

Expand Down Expand Up @@ -225,10 +219,6 @@ When creating or updating documents, use special syntax for complex field types:
}
```

## Emulator Support

To use the Firestore emulator, set `use_emulator: true` in your tool calls. Make sure the Firestore emulator is running on `localhost:8080`.

## Error Handling

The server includes comprehensive error handling and will return detailed error messages for:
Expand Down
41 changes: 5 additions & 36 deletions src/servers/firestore/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,7 @@ def process_document_data(data, client):
return data


async def create_firestore_client(
user_id, api_key=None, project_id=None, use_emulator=False
):
async def create_firestore_client(user_id, api_key=None, project_id=None):
"""Create a Firestore client"""
try:
# Get Google OAuth2 credentials
Expand Down Expand Up @@ -289,9 +287,6 @@ async def create_firestore_client(
"No project_id found in metadata or Application Default Credentials"
)

if use_emulator:
os.environ["FIRESTORE_EMULATOR_HOST"] = "localhost:8080"

# Create Firestore client with OAuth2 credentials
client = firestore.Client(project=final_project_id, credentials=credentials)

Expand Down Expand Up @@ -490,11 +485,6 @@ async def handle_list_tools() -> list[Tool]:
"type": "string",
"description": "Optional comma-separated list of document field paths to return (e.g. 'code,name,accountName,sourceData.code'). When set, Firestore returns only these fields plus the document id as `_id`. Omit to return full documents.",
},
"use_emulator": {
"type": "boolean",
"default": False,
"description": "Target the Firestore emulator if true.",
},
"required": ["collection_path"],
},
# outputSchema={
Expand All @@ -517,11 +507,6 @@ async def handle_list_tools() -> list[Tool]:
"type": "string",
"description": "Database id to use. Defaults to `(default)` if unspecified.",
},
"use_emulator": {
"type": "boolean",
"default": False,
"description": "Target the Firestore emulator if true.",
},
},
"required": ["document_path"],
},
Expand All @@ -540,11 +525,6 @@ async def handle_list_tools() -> list[Tool]:
"type": "string",
"description": "Database id to use. Defaults to `(default)` if unspecified.",
},
"use_emulator": {
"type": "boolean",
"default": False,
"description": "Target the Firestore emulator if true.",
},
},
},
# outputSchema={
Expand Down Expand Up @@ -576,11 +556,6 @@ async def handle_list_tools() -> list[Tool]:
"type": "string",
"description": "Database id to use. Defaults to `(default)` if unspecified.",
},
"use_emulator": {
"type": "boolean",
"default": False,
"description": "Target the Firestore emulator if true.",
},
},
"required": ["collection_path", "document_data"],
},
Expand All @@ -604,11 +579,6 @@ async def handle_list_tools() -> list[Tool]:
"type": "string",
"description": "Database id to use. Defaults to `(default)` if unspecified.",
},
"use_emulator": {
"type": "boolean",
"default": False,
"description": "Target the Firestore emulator if true.",
},
},
"required": ["document_path", "document_data"],
},
Expand All @@ -624,13 +594,12 @@ async def handle_call_tool(
)

arguments = arguments or {}
if "use_emulator" in arguments:
logger.warning("Ignoring unsupported Firestore argument: use_emulator")
arguments.pop("use_emulator", None)

try:
client = await create_firestore_client(
server.user_id,
server.api_key,
use_emulator=arguments.get("use_emulator", False),
)
client = await create_firestore_client(server.user_id, server.api_key)

if name == "query_collection":
collection_path = arguments.get("collection_path")
Expand Down
Loading