# generated by fastapi-codegen:
# filename: openapi.yaml
# timestamp: 2025-06-29T11:55:06+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
from fastapi import Path, Query
from models import (
FieldVCmsApiBuilderIdContentTypeDocumentIdGetResponse,
FieldVCmsApiBuilderIdContentTypeGetResponse,
FieldVCmsApiBuilderIdGetResponse,
)
app = MCPProxy(
contact={},
description='\nThe VTEX Headless CMS is a no-code management system for storefront content. \nThat means you can store your content as structured data in a layer decoupled from the frontend and \nuse the VTEX Headless CMS to access and deliver your content to your storefront project.\n\nNotice that the VTEX Headless CMS typically works with **FastStore** projects only. In this case, you can use this API\nto fetch data using SSR (NextJS and Gatsby v4+) or SSG (NextJS).\n\n**Servers**\n- `https://{account}.myvtex.com/`\n- `https://{workspace}--{account}.myvtex.com/`\n\n**Server variables**\n- `accountName`: Name of your VTEX account.\n- `workspace`: Name of your VTEX workspace.\n',
title='VTEX Headless CMS',
version='0.31.2',
servers=[
{'url': 'https://vtex.local'},
{
'url': 'https://{account}.myvtex.com',
'variables': {
'account': {
'default': 'storeframework',
'description': 'Name of the VTEX account. Used as part of the URL.',
}
},
},
{
'url': 'https://{workspace}--{account}.myvtex.com',
'variables': {
'account': {
'default': 'storeframework',
'description': 'Name of the VTEX account. Used as part of the URL.',
},
'workspace': {
'default': 'test',
'description': 'Name of the VTEX workspace. Used as part of the URL.',
},
},
},
],
)
@app.get(
'/_v/cms/api/{builderId}/',
description=""" Gets data from all Content Types. """,
tags=['content_type_handling'],
)
def get_all_content_types(builder_id: str = Path(..., alias='builderId')):
"""
Get all Content Types
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/_v/cms/api/{builderId}/{content-type}',
description=""" Gets data from all pages of a given Content Type. """,
tags=['content_type_handling', 'cms_page_access'],
)
def get_pagesby_content_type(
builder_id: str = Path(..., alias='builderId'),
content_type: str = Path(..., alias='content-type'),
version_id: Optional[str] = Query(None, alias='versionId'),
release_id: Optional[str] = Query(None, alias='releaseId'),
filters__field__: Optional[str] = Query(None, alias='filters[{field}]'),
):
"""
Get all CMS pages by Content Type
"""
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/_v/cms/api/{builderId}/{content-type}/{document-id}/',
description=""" Gets all data from a given page. """,
tags=['cms_page_access', 'content_type_handling'],
)
def get_c_m_spage(
builder_id: str = Path(..., alias='builderId'),
content_type: str = Path(..., alias='content-type'),
document_id: str = Path(..., alias='document-id'),
version_id: Optional[str] = Query(None, alias='versionId'),
release_id: Optional[str] = Query(None, alias='releaseId'),
):
"""
Get CMS page
"""
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)