Skip to main content
Glama

Firebase Rules API MCP Server

main.py14.9 kB
# generated by fastapi-codegen: # filename: openapi.yaml # timestamp: 2025-06-29T02:08:45+00:00 import argparse import json import os from typing import * from typing import Optional from autogen.mcp.mcp_proxy import MCPProxy from autogen.mcp.mcp_proxy.security import BaseSecurity, UnsuportedSecurityStub from fastapi import Query from models import ( Alt, Empty, ExecutableVersion, FieldXgafv, GetReleaseExecutableResponse, ListReleasesResponse, ListRulesetsResponse, Release, Ruleset, TestRulesetRequest, TestRulesetResponse, UpdateReleaseRequest, ) app = MCPProxy( contact={'name': 'Google', 'url': 'https://google.com', 'x-twitter': 'youtube'}, description='Creates and manages rules that determine when a Firebase Rules-enabled service should permit a request. ', license={ 'name': 'Creative Commons Attribution 3.0', 'url': 'http://creativecommons.org/licenses/by/3.0/', }, termsOfService='https://developers.google.com/terms/', title='Firebase Rules API', version='v1', servers=[{'url': 'https://firebaserules.googleapis.com/'}], ) @app.delete( '/v1/{name}', description=""" Delete a `Ruleset` by resource name. If the `Ruleset` is referenced by a `Release` the operation will fail. """, tags=['firebaserules_management', 'firebaserules_release_operations'], security=[ UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), ], ) def firebaserules_projects_rulesets_delete( name: str, field__xgafv: Optional[FieldXgafv] = Query(None, alias='$.xgafv'), access_token: Optional[str] = None, alt: Optional[Alt] = None, callback: Optional[str] = None, fields: Optional[str] = None, key: Optional[str] = None, oauth_token: Optional[str] = None, pretty_print: Optional[bool] = Query(None, alias='prettyPrint'), quota_user: Optional[str] = Query(None, alias='quotaUser'), upload_protocol: Optional[str] = None, upload_type: Optional[str] = Query(None, alias='uploadType'), ): raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/{name}', description=""" Get a `Ruleset` by name including the full `Source` contents. """, tags=[ 'firebaserules_management', 'firebaserules_release_operations', 'firebaserules_validation', ], security=[ UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), ], ) def firebaserules_projects_rulesets_get( name: str, field__xgafv: Optional[FieldXgafv] = Query(None, alias='$.xgafv'), access_token: Optional[str] = None, alt: Optional[Alt] = None, callback: Optional[str] = None, fields: Optional[str] = None, key: Optional[str] = None, oauth_token: Optional[str] = None, pretty_print: Optional[bool] = Query(None, alias='prettyPrint'), quota_user: Optional[str] = Query(None, alias='quotaUser'), upload_protocol: Optional[str] = None, upload_type: Optional[str] = Query(None, alias='uploadType'), ): raise RuntimeError("Should be patched by MCPProxy and never executed") @app.patch( '/v1/{name}', description=""" Update a `Release` via PATCH. Only updates to `ruleset_name` will be honored. `Release` rename is not supported. To create a `Release` use the CreateRelease method. """, tags=['firebaserules_release_operations'], security=[ UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), ], ) def firebaserules_projects_releases_patch( name: str, field__xgafv: Optional[FieldXgafv] = Query(None, alias='$.xgafv'), access_token: Optional[str] = None, alt: Optional[Alt] = None, callback: Optional[str] = None, fields: Optional[str] = None, key: Optional[str] = None, oauth_token: Optional[str] = None, pretty_print: Optional[bool] = Query(None, alias='prettyPrint'), quota_user: Optional[str] = Query(None, alias='quotaUser'), upload_protocol: Optional[str] = None, upload_type: Optional[str] = Query(None, alias='uploadType'), body: UpdateReleaseRequest = None, ): raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/{name}/releases', description=""" List the `Release` values for a project. This list may optionally be filtered by `Release` name, `Ruleset` name, `TestSuite` name, or any combination thereof. """, tags=[ 'firebaserules_management', 'firebaserules_release_operations', 'firebaserules_validation', ], security=[ UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), ], ) def firebaserules_projects_releases_list( name: str, filter: Optional[str] = None, page_size: Optional[int] = Query(None, alias='pageSize'), page_token: Optional[str] = Query(None, alias='pageToken'), field__xgafv: Optional[FieldXgafv] = Query(None, alias='$.xgafv'), access_token: Optional[str] = None, alt: Optional[Alt] = None, callback: Optional[str] = None, fields: Optional[str] = None, key: Optional[str] = None, oauth_token: Optional[str] = None, pretty_print: Optional[bool] = Query(None, alias='prettyPrint'), quota_user: Optional[str] = Query(None, alias='quotaUser'), upload_protocol: Optional[str] = None, upload_type: Optional[str] = Query(None, alias='uploadType'), ): raise RuntimeError("Should be patched by MCPProxy and never executed") @app.post( '/v1/{name}/releases', description=""" Create a `Release`. Release names should reflect the developer's deployment practices. For example, the release name may include the environment name, application name, application version, or any other name meaningful to the developer. Once a `Release` refers to a `Ruleset`, the rules can be enforced by Firebase Rules-enabled services. More than one `Release` may be 'live' concurrently. Consider the following three `Release` names for `projects/foo` and the `Ruleset` to which they refer. Release Name -> Ruleset Name * projects/foo/releases/prod -> projects/foo/rulesets/uuid123 * projects/foo/releases/prod/beta -> projects/foo/rulesets/uuid123 * projects/foo/releases/prod/v23 -> projects/foo/rulesets/uuid456 The relationships reflect a `Ruleset` rollout in progress. The `prod` and `prod/beta` releases refer to the same `Ruleset`. However, `prod/v23` refers to a new `Ruleset`. The `Ruleset` reference for a `Release` may be updated using the UpdateRelease method. """, tags=['firebaserules_management', 'firebaserules_release_operations'], security=[ UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), ], ) def firebaserules_projects_releases_create( name: str, field__xgafv: Optional[FieldXgafv] = Query(None, alias='$.xgafv'), access_token: Optional[str] = None, alt: Optional[Alt] = None, callback: Optional[str] = None, fields: Optional[str] = None, key: Optional[str] = None, oauth_token: Optional[str] = None, pretty_print: Optional[bool] = Query(None, alias='prettyPrint'), quota_user: Optional[str] = Query(None, alias='quotaUser'), upload_protocol: Optional[str] = None, upload_type: Optional[str] = Query(None, alias='uploadType'), body: Release = None, ): raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/{name}/rulesets', description=""" List `Ruleset` metadata only and optionally filter the results by `Ruleset` name. The full `Source` contents of a `Ruleset` may be retrieved with GetRuleset. """, tags=[ 'firebaserules_management', 'firebaserules_release_operations', 'firebaserules_validation', ], security=[ UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), ], ) def firebaserules_projects_rulesets_list( name: str, filter: Optional[str] = None, page_size: Optional[int] = Query(None, alias='pageSize'), page_token: Optional[str] = Query(None, alias='pageToken'), field__xgafv: Optional[FieldXgafv] = Query(None, alias='$.xgafv'), access_token: Optional[str] = None, alt: Optional[Alt] = None, callback: Optional[str] = None, fields: Optional[str] = None, key: Optional[str] = None, oauth_token: Optional[str] = None, pretty_print: Optional[bool] = Query(None, alias='prettyPrint'), quota_user: Optional[str] = Query(None, alias='quotaUser'), upload_protocol: Optional[str] = None, upload_type: Optional[str] = Query(None, alias='uploadType'), ): raise RuntimeError("Should be patched by MCPProxy and never executed") @app.post( '/v1/{name}/rulesets', description=""" Create a `Ruleset` from `Source`. The `Ruleset` is given a unique generated name which is returned to the caller. `Source` containing syntactic or semantics errors will result in an error response indicating the first error encountered. For a detailed view of `Source` issues, use TestRuleset. """, tags=['firebaserules_management', 'firebaserules_release_operations'], security=[ UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), ], ) def firebaserules_projects_rulesets_create( name: str, field__xgafv: Optional[FieldXgafv] = Query(None, alias='$.xgafv'), access_token: Optional[str] = None, alt: Optional[Alt] = None, callback: Optional[str] = None, fields: Optional[str] = None, key: Optional[str] = None, oauth_token: Optional[str] = None, pretty_print: Optional[bool] = Query(None, alias='prettyPrint'), quota_user: Optional[str] = Query(None, alias='quotaUser'), upload_protocol: Optional[str] = None, upload_type: Optional[str] = Query(None, alias='uploadType'), body: Ruleset = None, ): raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/{name}:getExecutable', description=""" Get the `Release` executable to use when enforcing rules. """, tags=['firebaserules_management', 'firebaserules_release_operations'], security=[ UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), ], ) def firebaserules_projects_releases_get_executable( name: str, executable_version: Optional[ExecutableVersion] = Query( None, alias='executableVersion' ), field__xgafv: Optional[FieldXgafv] = Query(None, alias='$.xgafv'), access_token: Optional[str] = None, alt: Optional[Alt] = None, callback: Optional[str] = None, fields: Optional[str] = None, key: Optional[str] = None, oauth_token: Optional[str] = None, pretty_print: Optional[bool] = Query(None, alias='prettyPrint'), quota_user: Optional[str] = Query(None, alias='quotaUser'), upload_protocol: Optional[str] = None, upload_type: Optional[str] = Query(None, alias='uploadType'), ): raise RuntimeError("Should be patched by MCPProxy and never executed") @app.post( '/v1/{name}:test', description=""" Test `Source` for syntactic and semantic correctness. Issues present, if any, will be returned to the caller with a description, severity, and source location. The test method may be executed with `Source` or a `Ruleset` name. Passing `Source` is useful for unit testing new rules. Passing a `Ruleset` name is useful for regression testing an existing rule. The following is an example of `Source` that permits users to upload images to a bucket bearing their user id and matching the correct metadata: _*Example*_ // Users are allowed to subscribe and unsubscribe to the blog. service firebase.storage { match /users/{userId}/images/{imageName} { allow write: if userId == request.auth.uid && (imageName.matches('*.png$') || imageName.matches('*.jpg$')) && resource.mimeType.matches('^image/') } } """, tags=['firebaserules_management', 'firebaserules_validation'], security=[ UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), ], ) def firebaserules_projects_test( name: str, field__xgafv: Optional[FieldXgafv] = Query(None, alias='$.xgafv'), access_token: Optional[str] = None, alt: Optional[Alt] = None, callback: Optional[str] = None, fields: Optional[str] = None, key: Optional[str] = None, oauth_token: Optional[str] = None, pretty_print: Optional[bool] = Query(None, alias='prettyPrint'), quota_user: Optional[str] = Query(None, alias='quotaUser'), upload_protocol: Optional[str] = None, upload_type: Optional[str] = Query(None, alias='uploadType'), body: TestRulesetRequest = None, ): raise RuntimeError("Should be patched by MCPProxy and never executed") if __name__ == "__main__": parser = argparse.ArgumentParser(description="MCP Server") parser.add_argument( "transport", choices=["stdio", "sse", "streamable-http"], help="Transport mode (stdio, sse or streamable-http)", ) args = parser.parse_args() if "CONFIG_PATH" in os.environ: config_path = os.environ["CONFIG_PATH"] app.load_configuration(config_path) if "CONFIG" in os.environ: config = os.environ["CONFIG"] app.load_configuration_from_string(config) if "SECURITY" in os.environ: security_params = BaseSecurity.parse_security_parameters_from_env( os.environ, ) app.set_security_params(security_params) mcp_settings = json.loads(os.environ.get("MCP_SETTINGS", "{}")) app.get_mcp(**mcp_settings).run(transport=args.transport)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ag2-mcp-servers/firebase-rules-api'

If you have feedback or need assistance with the MCP directory API, please join our Discord server