main.py•10.6 kB
# generated by fastapi-codegen:
# filename: openapi.yaml
# timestamp: 2025-06-29T07:46:09+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 APIKeyHeader, BaseSecurity, HTTPBasic
from fastapi import Path
from models import (
Abschlussbelegdaten,
AuthResult,
Beleg,
Belegdaten,
Belege,
Dialect,
Encoding,
Format,
Order,
Registrierkasse,
RegistrierkassenRegistrierkasseUuidMonatsbelegeGetResponse,
)
app = MCPProxy(
contact={
'email': 'info@obono.at',
'name': 'CodeWerkstatt OG',
'url': 'https://obono.at',
'x-twitter': 'obono_at',
},
description='Provides a RESTful API for interacting with virtual cash registers and creating receipts that are conform with the Registrierkassensicherheitsverordnung (RKSV).\n\nYou may find our [automatically generated clients](./clients) for various programming languages and environments helpful...\n',
license={
'name': 'Creative Commons Attribution NonCommercial 4.0 (CC-BY-NC)',
'url': 'https://creativecommons.org/licenses/by-nc/4.0/legalcode',
},
title='obono RKSV API',
version='1.4.0.0',
servers=[{'url': '/api/v1'}],
)
@app.get(
'/auth',
description=""" Request a JWT access token using your obono username and password. """,
tags=[
'document_management',
'cash_register_operations',
'data_export_functions',
'closure_data_management',
'monthly_reports_handling',
],
security=[
HTTPBasic(name="None"),
],
)
def get_auth():
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/belege/{belegUuid}',
description=""" Retrieves a particular `Beleg` from the "Datenerfassungsprotokoll". """,
tags=['document_management'],
)
def get_belege__beleg_uuid(beleg_uuid: str = Path(..., alias='belegUuid')):
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/export/csv/registrierkassen/{registrierkasseUuid}/belege',
tags=[
'cash_register_operations',
'closure_data_management',
'monthly_reports_handling',
],
security=[
APIKeyHeader(name="Authorization"),
],
)
def get_export_csv_registrierkassen__registrierkasse_uuid_belege(
registrierkasse_uuid: str = Path(..., alias='registrierkasseUuid'),
before: Optional[str] = None,
after: Optional[str] = None,
posten: Optional[bool] = None,
):
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/export/dep131/registrierkassen/{registrierkasseUuid}/belege',
tags=[
'cash_register_operations',
'closure_data_management',
'monthly_reports_handling',
],
security=[
APIKeyHeader(name="Authorization"),
],
)
def get_export_dep131_registrierkassen__registrierkasse_uuid_belege(
registrierkasse_uuid: str = Path(..., alias='registrierkasseUuid'),
before: Optional[str] = None,
after: Optional[str] = None,
):
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/export/dep7/registrierkassen/{registrierkasseUuid}/belege',
tags=[
'cash_register_operations',
'closure_data_management',
'monthly_reports_handling',
],
security=[
APIKeyHeader(name="Authorization"),
],
)
def get_export_dep7_registrierkassen__registrierkasse_uuid_belege(
registrierkasse_uuid: str = Path(..., alias='registrierkasseUuid'),
before: Optional[str] = None,
after: Optional[str] = None,
):
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/export/gobd/registrierkassen/{registrierkasseUuid}',
tags=[
'cash_register_operations',
'closure_data_management',
'monthly_reports_handling',
],
security=[
APIKeyHeader(name="Authorization"),
],
)
def get_export_gobd_registrierkassen__registrierkasse_uuid(
registrierkasse_uuid: str = Path(..., alias='registrierkasseUuid'),
before: Optional[str] = None,
after: Optional[str] = None,
):
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get('/export/html/belege/{belegUuid}', tags=['document_management'])
def get_export_html_belege__beleg_uuid(beleg_uuid: str = Path(..., alias='belegUuid')):
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/export/pdf/belege/{belegUuid}',
tags=['document_management', 'cash_register_operations'],
)
def get_export_pdf_belege__beleg_uuid(beleg_uuid: str = Path(..., alias='belegUuid')):
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/export/qr/belege/{belegUuid}',
tags=['document_management', 'cash_register_operations'],
)
def get_export_qr_belege__beleg_uuid(beleg_uuid: str = Path(..., alias='belegUuid')):
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/export/thermal-print/belege/{belegUuid}',
tags=['document_management', 'cash_register_operations', 'data_export_functions'],
)
def get_export_thermal_print_belege__beleg_uuid(
beleg_uuid: str = Path(..., alias='belegUuid'),
qr: Optional[bool] = True,
width: Optional[int] = 42,
dialect: Optional[Dialect] = 'escpos',
encoding: Optional[Encoding] = 'raw',
):
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/export/xls/registrierkassen/{registrierkasseUuid}/belege',
tags=[
'cash_register_operations',
'closure_data_management',
'monthly_reports_handling',
],
security=[
APIKeyHeader(name="Authorization"),
],
)
def get_export_xls_registrierkassen__registrierkasse_uuid_belege(
registrierkasse_uuid: str = Path(..., alias='registrierkasseUuid'),
before: Optional[str] = None,
after: Optional[str] = None,
):
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/registrierkassen/{registrierkasseUuid}',
description=""" Returns information about a particular `Registrierkasse`. """,
tags=['cash_register_operations'],
security=[
APIKeyHeader(name="Authorization"),
],
)
def get_registrierkasse(
registrierkasse_uuid: str = Path(..., alias='registrierkasseUuid')
):
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.post(
'/registrierkassen/{registrierkasseUuid}/abschluss',
description=""" Generates an `Abschlussbeleg`. """,
tags=['cash_register_operations', 'closure_data_management'],
security=[
APIKeyHeader(name="Authorization"),
],
)
def create_abschluss(
registrierkasse_uuid: str = Path(..., alias='registrierkasseUuid'),
body: Abschlussbelegdaten = ...,
):
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/registrierkassen/{registrierkasseUuid}/belege',
description=""" Retrieves the `Beleg` collection from the "Datenerfassungsprotokoll". """,
tags=['cash_register_operations', 'data_export_functions', 'document_management'],
security=[
APIKeyHeader(name="Authorization"),
],
)
def get_belege(
registrierkasse_uuid: str = Path(..., alias='registrierkasseUuid'),
format: Format = 'export',
order: Optional[Order] = 'asc',
limit: Optional[int] = None,
offset: Optional[int] = 0,
before: Optional[str] = None,
after: Optional[str] = None,
gte: Optional[int] = None,
lte: Optional[int] = None,
):
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/registrierkassen/{registrierkasseUuid}/belege/{belegUuid}',
description=""" Retrieves a particular `Beleg` from the "Datenerfassungsprotokoll". """,
tags=['document_management', 'cash_register_operations'],
security=[
APIKeyHeader(name="Authorization"),
],
)
def get_beleg(
registrierkasse_uuid: str = Path(..., alias='registrierkasseUuid'),
beleg_uuid: str = Path(..., alias='belegUuid'),
):
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.put(
'/registrierkassen/{registrierkasseUuid}/belege/{belegUuid}',
description=""" Signs a receipt and stores it in the "Datenerfassungsprotokoll". """,
tags=['document_management', 'cash_register_operations', 'closure_data_management'],
security=[
APIKeyHeader(name="Authorization"),
],
)
def add_beleg(
registrierkasse_uuid: str = Path(..., alias='registrierkasseUuid'),
beleg_uuid: str = Path(..., alias='belegUuid'),
body: Belegdaten = ...,
):
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/registrierkassen/{registrierkasseUuid}/dep',
description=""" Generates a DEP file. """,
tags=['cash_register_operations'],
security=[
APIKeyHeader(name="Authorization"),
],
)
def get_d_e_p(registrierkasse_uuid: str = Path(..., alias='registrierkasseUuid')):
raise RuntimeError("Should be patched by MCPProxy and never executed")
@app.get(
'/registrierkassen/{registrierkasseUuid}/monatsbelege',
description=""" Returns a list of `Monatsbelege`. """,
tags=['cash_register_operations', 'monthly_reports_handling'],
security=[
APIKeyHeader(name="Authorization"),
],
)
def get_monatsbelege(
registrierkasse_uuid: str = Path(..., alias='registrierkasseUuid'),
year: Optional[int] = None,
month: Optional[int] = 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)