Skip to main content
Glama
main.py6.58 kB
# generated by fastapi-codegen: # filename: openapi.yaml # timestamp: 2025-06-29T01:59:23+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 Path, Query from models import ( Alt, BatchUpdateDocumentRequest, BatchUpdateDocumentResponse, Document, FieldXgafv, SuggestionsViewMode, ) app = MCPProxy( contact={'name': 'Google', 'url': 'https://google.com', 'x-twitter': 'youtube'}, description='Reads and writes Google Docs documents.', license={ 'name': 'Creative Commons Attribution 3.0', 'url': 'http://creativecommons.org/licenses/by/3.0/', }, termsOfService='https://developers.google.com/terms/', title='Google Docs API', version='v1', servers=[{'url': 'https://docs.googleapis.com/'}], ) @app.post( '/v1/documents', description=""" Creates a blank document using the title given in the request. Other fields in the request, including any provided content, are ignored. Returns the created document. """, tags=['docs_document_management'], security=[ UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), ], ) def docs_documents_create( 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: Document = None, ): raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/v1/documents/{documentId}', description=""" Gets the latest version of the specified document. """, tags=['docs_document_management'], security=[ UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), ], ) def docs_documents_get( document_id: str = Path(..., alias='documentId'), suggestions_view_mode: Optional[SuggestionsViewMode] = Query( None, alias='suggestionsViewMode' ), 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/documents/{documentId}:batchUpdate', description=""" Applies one or more updates to the document. Each request is validated before being applied. If any request is not valid, then the entire request will fail and nothing will be applied. Some requests have replies to give you some information about how they are applied. Other requests do not need to return information; these each return an empty reply. The order of replies matches that of the requests. For example, suppose you call batchUpdate with four updates, and only the third one returns information. The response would have two empty replies, the reply to the third request, and another empty reply, in that order. Because other users may be editing the document, the document might not exactly reflect your changes: your changes may be altered with respect to collaborator changes. If there are no collaborators, the document should reflect your changes. In any case, the updates in your request are guaranteed to be applied together atomically. """, tags=['docs_document_management'], security=[ UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), UnsuportedSecurityStub(name="None"), ], ) def docs_documents_batch_update( document_id: str = Path(..., alias='documentId'), 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: BatchUpdateDocumentRequest = 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/google-docs-api'

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