# generated by fastapi-codegen: # filename: openapi.yaml # timestamp: 2025-06-29T08:35:45+00:00 import argparse import json import os from typing import * from typing import Optional, Union from autogen.mcp.mcp_proxy import MCPProxy from autogen.mcp.mcp_proxy.security import ( APIKeyHeader, BaseSecurity, UnsuportedSecurityStub, ) from models import ( Account, AccountsIdPutRequest, AccountsIdTransactionsGetResponse, Attachment, AttachmentsIdPutRequest, Behaviour, CategoriesIdCategoryRulesPostRequest, CategoriesIdPutRequest, CategoriesIdTransactionsGetResponse, Category, CategoryRule, CurrenciesGetResponse, Currency, Error, Event, EventsIdPutRequest, Institution, InstitutionsIdAccountsGetResponse, InstitutionsIdPutRequest, Period1, ScenariosIdEventsGetResponse, ScenariosIdEventsPostRequest, TimeZonesGetResponse, Transaction, TransactionAccount, TransactionAccountsIdPutRequest, TransactionAccountsIdTransactionsGetResponse, TransactionAccountsIdTransactionsPostRequest, TransactionsIdAttachmentsGetResponse, TransactionsIdAttachmentsPostRequest, TransactionsIdPutRequest, Type5, Type12, User, UsersIdAccountsGetResponse, UsersIdAccountsPostRequest, UsersIdAccountsPutRequest, UsersIdAccountsPutResponse, UsersIdAttachmentsGetResponse, UsersIdAttachmentsPostRequest, UsersIdBudgetGetResponse, UsersIdBudgetSummaryGetResponse, UsersIdCategoriesGetResponse, UsersIdCategoriesPostRequest, UsersIdCategoryRulesGetResponse, UsersIdEventsGetResponse, UsersIdInstitutionsGetResponse, UsersIdInstitutionsPostRequest, UsersIdLabelsGetResponse, UsersIdPutRequest, UsersIdSavedSearchesGetResponse, UsersIdTransactionAccountsGetResponse, UsersIdTransactionsGetResponse, UsersIdTrendAnalysisGetResponse, ) app = MCPProxy( contact={'email': 'api@pocketsmith.com', 'name': 'API Support'}, description='The PocketSmith API', title='PocketSmith', version='2.0', servers=[{'description': 'Production', 'url': 'https://api.pocketsmith.com/v2'}], ) @app.delete( '/accounts/{id}', description=""" Deletes an account and all its data by ID, optionally merge scenarios into another account. """, tags=['account_operations', 'user_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def delete_accounts__id(id: int): """ Delete account """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/accounts/{id}', description=""" Gets an account by its ID. """, tags=['account_operations', 'institution_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_accounts__id(id: int): """ Get account """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.put( '/accounts/{id}', description=""" Updates and returns an account by its ID. """, tags=['account_operations', 'institution_operations', 'user_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def put_accounts__id(id: int, body: AccountsIdPutRequest = None): """ Update account """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/accounts/{id}/transactions', description=""" Lists transactions belonging to an account by its ID. """, tags=[ 'transaction_operations', 'transaction_account_operations', 'account_operations', ], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_accounts__id_transactions( id: int, start_date: Optional[str] = None, end_date: Optional[str] = None, updated_since: Optional[str] = None, uncategorised: Optional[int] = None, type: Optional[Type5] = None, needs_review: Optional[int] = None, search: Optional[str] = None, page: Optional[int] = None, ): """ List transactions in account """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.delete( '/attachments/{id}', description=""" Deletes a particular attachment by its ID. """, tags=['attachment_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def delete_attachments__id(id: int): """ Delete attachment """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/attachments/{id}', description=""" Gets a particular attachment by its ID. """, tags=['attachment_operations', 'transaction_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_attachments__id(id: int): """ Get attachment """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.put( '/attachments/{id}', description=""" Updates the title of the attachment. """, tags=['attachment_operations', 'transaction_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def put_attachments__id(id: int, body: AttachmentsIdPutRequest = None): """ Update attachment """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.delete( '/categories/{id}', description=""" Deletes a particular category by its ID. This will delete all budgets within the category, and uncategorize all transactions assigned to the category. """, tags=['category_operations', 'user_category_management'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def delete_categories__id(id: int): """ Delete category """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/categories/{id}', description=""" Gets a particular category by its ID. """, tags=['category_operations', 'user_category_management'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_categories__id(id: int): """ Get category """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.put( '/categories/{id}', description=""" Updates a category by its ID. """, tags=['category_operations', 'user_category_management'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def put_categories__id(id: int, body: CategoriesIdPutRequest = None): """ Update category """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.post( '/categories/{id}/category_rules', description=""" Creates a rule to allocate a category to transactions. """, tags=['category_operations', 'user_category_management'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def post_categories__id_category_rules( id: int, body: CategoriesIdCategoryRulesPostRequest = None ): """ Create category rule in category """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/categories/{id}/transactions', description=""" Lists transactions belonging to one or more categories by their IDs. """, tags=['transaction_operations', 'user_category_management'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_categories__id_transactions( id: str, start_date: Optional[str] = None, end_date: Optional[str] = None, updated_since: Optional[str] = None, uncategorised: Optional[int] = None, type: Optional[Type5] = None, needs_review: Optional[int] = None, search: Optional[str] = None, page: Optional[int] = None, ): """ List transactions in categories """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/currencies', description=""" Lists currencies supported by PocketSmith. """, tags=['currency_info_management'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_currencies(): """ List currencies """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/currencies/{id}', description=""" Gets a particular currency by its ID. """, tags=['currency_info_management'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_currencies__id(id: str): """ Get currency """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.delete( '/events/{id}', description=""" Deletes an event by its ID. """, tags=['event_handling'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def delete_events__id(id: str, behaviour: Behaviour = ...): """ Delete event """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/events/{id}', description=""" Gets a particular event by its ID. """, tags=['event_handling'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_events__id(id: str): """ Get event """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.put( '/events/{id}', description=""" Updates an event by its ID. """, tags=['event_handling'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def put_events__id(id: str, body: EventsIdPutRequest = None): """ Update event """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.delete( '/institutions/{id}', description=""" Deletes an institution and all data within. Alternatively, another institution can be provided to merge the data into to avoid losing it. """, tags=['institution_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def delete_institutions__id(id: int, merge_into_institution_id: Optional[int] = None): """ Delete institution """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/institutions/{id}', description=""" Gets an institution by its ID. """, tags=['institution_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_institutions__id(id: int): """ Get institution """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.put( '/institutions/{id}', description=""" Updates the title and currency code for an institution. """, tags=['institution_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def put_institutions__id(id: int, body: InstitutionsIdPutRequest = None): """ Update institution """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/institutions/{id}/accounts', description=""" Lists accounts belonging to an institution by its ID. """, tags=['institution_operations', 'account_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_institutions__id_accounts(id: int): """ List accounts in institution """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/me', description=""" Gets the user that corresponds to the access token used in the request. """, tags=['user_profile_management', 'user_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_me(): """ Get the authorised user """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/scenarios/{id}/events', description=""" Lists events belonging to a scenario by their ID. """, tags=['event_handling', 'scenario_event_handling'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_scenarios__id_events(id: int, start_date: str = ..., end_date: str = ...): """ List events in scenario. """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.post( '/scenarios/{id}/events', description=""" Creates an event in a scenario by its ID. """, tags=['scenario_event_handling', 'event_handling'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def post_scenarios__id_events(id: int, body: ScenariosIdEventsPostRequest = None): """ Create event in scenario """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/time_zones', description=""" Lists time zones. """, tags=['time_zone_info_retrieval'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_time_zones(): """ List time zones """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/transaction_accounts/{id}', description=""" Gets a transaction account by its ID. """, tags=['account_operations', 'transaction_account_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_transaction_accounts__id(id: int): """ Get transaction account """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.put( '/transaction_accounts/{id}', description=""" Updates the transaction account by its ID. """, tags=['transaction_account_operations', 'account_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def put_transaction_accounts__id(id: int, body: TransactionAccountsIdPutRequest = None): """ Update transaction account """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/transaction_accounts/{id}/transactions', description=""" Lists transactions belonging to a transaction account by its ID. """, tags=['transaction_account_operations', 'transaction_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_transaction_accounts__id_transactions( id: int, start_date: Optional[str] = None, end_date: Optional[str] = None, updated_since: Optional[str] = None, uncategorised: Optional[int] = None, type: Optional[Type5] = None, needs_review: Optional[int] = None, search: Optional[str] = None, page: Optional[int] = None, ): """ List transactions in transaction account """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.post( '/transaction_accounts/{id}/transactions', description=""" Creates a transaction in a transaction account by its ID. """, tags=['transaction_account_operations', 'transaction_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def post_transaction_accounts__id_transactions( id: int, body: TransactionAccountsIdTransactionsPostRequest = None ): """ Create a transaction in transaction account """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.delete( '/transactions/{id}', description=""" Deletes a transaction and all its data by ID. """, tags=['transaction_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def delete_transactions__id(id: int): """ Delete transaction """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/transactions/{id}', description=""" Gets a transaction by its ID. """, tags=['transaction_operations', 'transaction_account_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_transactions__id(id: int): """ Get a transaction """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.put( '/transactions/{id}', description=""" Updates a transaction by its ID. """, tags=['transaction_operations', 'transaction_account_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def put_transactions__id(id: int, body: TransactionsIdPutRequest = None): """ Update a transaction """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/transactions/{id}/attachments', description=""" Lists attachments belonging to a transaction by their ID. """, tags=['attachment_operations', 'transaction_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_transactions__id_attachments(id: int): """ List attachments in transaction """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.post( '/transactions/{id}/attachments', description=""" Assigns an attachment to the transaction by their ID. """, tags=['attachment_operations', 'transaction_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def post_transactions__id_attachments( id: int, body: TransactionsIdAttachmentsPostRequest = None ): """ Assigns attachment to transaction """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.delete( '/transactions/{transaction_id}/attachments/{attachment_id}', description=""" Unassigns a particular attachment by its ID from the transaction ID. This does not delete the attachment, it only removes its association from the transaction. """, tags=['attachment_operations', 'transaction_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def delete_transactions__transaction_id_attachments__attachment_id( transaction_id: int, attachment_id: int = ... ): """ Unassigns attachment in transaction """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/users/{id}', description=""" Gets a user by ID. You must be authorised as the target user in order to make this request. """, tags=['user_operations', 'user_profile_management'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_users__id(id: int): """ Get user """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.put( '/users/{id}', description=""" Updates the user by their ID. You must be authorised as the target user in order to make this request. """, tags=['account_operations', 'user_profile_management', 'user_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def put_users__id(id: int, body: UsersIdPutRequest = None): """ Update user """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/users/{id}/accounts', description=""" Lists all accounts belonging to the user by their ID. """, tags=['account_operations', 'user_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_users__id_accounts(id: int): """ List accounts in user """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.post( '/users/{id}/accounts', description=""" Creates and returns an account belonging to the user by their ID. """, tags=['account_operations', 'user_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def post_users__id_accounts(id: int, body: UsersIdAccountsPostRequest = None): """ Create an account in user """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.put( '/users/{id}/accounts', description=""" Updates the display order of accounts belonging to the user, by accepting an array of accounts in their new display order. """, tags=['account_operations', 'user_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def put_users__id_accounts(id: int, body: UsersIdAccountsPutRequest = None): """ Update the display order of accounts in user """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/users/{id}/attachments', description=""" Lists attachments belonging to a user by their ID. """, tags=['attachment_operations', 'user_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_users__id_attachments(id: int, unassigned: Optional[int] = None): """ Lists attachments in user """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.post( '/users/{id}/attachments', description=""" Creates an attachment belonging to the user by their ID. """, tags=['attachment_operations', 'user_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def post_users__id_attachments(id: int, body: UsersIdAttachmentsPostRequest = None): """ Create attachment in user """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/users/{id}/budget', description=""" Lists the user's budget, consisting of one or more budget analysis packages, one per category. Akin to the list on the Budget page in PocketSmith. """, tags=['user_budget_management', 'user_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_users__id_budget(id: int, roll_up: Optional[bool] = None): """ List budget for user """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/users/{id}/budget_summary', description=""" Get the user's budget summary, containing an expense and income analysis for all categories (excluding transfer categories) for the given period and date range. Akin to the overall budget shown on the Budget page in PocketSmith. """, tags=['user_budget_management', 'user_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_users__id_budget_summary( id: int, period: Period1 = ..., interval: int = ..., start_date: str = ..., end_date: str = ..., ): """ Get budget summary for user """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/users/{id}/categories', description=""" Lists all categories belonging to a user by their ID. """, tags=['category_operations', 'user_category_management'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_users__id_categories(id: int): """ List categories in user """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.post( '/users/{id}/categories', description=""" Creates a category belonging to the user by their ID. """, tags=['category_operations', 'user_category_management'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def post_users__id_categories(id: int, body: UsersIdCategoriesPostRequest = None): """ Create category in user """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/users/{id}/category_rules', description=""" Lists all category rules belonging to a user by their ID. """, tags=['category_operations', 'user_category_management'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_users__id_category_rules(id: int): """ List category rules in user """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/users/{id}/events', description=""" Lists events belonging to a user by their ID. """, tags=['event_handling', 'user_event_analysis'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_users__id_events(id: int, start_date: str = ..., end_date: str = ...): """ List events in user. """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.delete( '/users/{id}/forecast_cache', description=""" Delete the user's cached forecast by recalculating the forecast. """, tags=['user_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def delete_users__id_forecast_cache(id: int): """ Delete forecast cache for user """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/users/{id}/institutions', description=""" Lists all the institutions belonging to the user. """, tags=['institution_operations', 'user_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_users__id_institutions(id: int): """ List institutions in user """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.post( '/users/{id}/institutions', description=""" Creates an institution belonging to a user. """, tags=['institution_operations', 'user_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def post_users__id_institutions(id: int, body: UsersIdInstitutionsPostRequest = None): """ Create institution in user """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/users/{id}/labels', description=""" Lists labels belonging to a user by their ID. """, tags=['user_operations', 'user_category_management'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_users__id_labels(id: int): """ List labels in user """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/users/{id}/saved_searches', description=""" Lists saved searches belonging to a user by their ID. """, tags=['user_operations', 'user_profile_management'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_users__id_saved_searches(id: int): """ List saved searches in user """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/users/{id}/transaction_accounts', description=""" List all transaction accounts belonging to a user. """, tags=['transaction_account_operations', 'user_operations', 'account_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_users__id_transaction_accounts(id: int): """ List transaction accounts in user """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/users/{id}/transactions', description=""" Lists transactions belonging to a user by their ID. """, tags=['transaction_operations', 'user_operations'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_users__id_transactions( id: int, start_date: Optional[str] = None, end_date: Optional[str] = None, updated_since: Optional[str] = None, uncategorised: Optional[int] = None, type: Optional[Type12] = None, needs_review: Optional[int] = None, search: Optional[str] = None, page: Optional[int] = None, ): """ List transactions in user """ raise RuntimeError("Should be patched by MCPProxy and never executed") @app.get( '/users/{id}/trend_analysis', description=""" Get an income and/or expense budget analysis for the given date range and period across any number of categories and scenarios. Akin to the Trends page in PocketSmith. """, tags=['user_event_analysis'], security=[ APIKeyHeader(name="X-Developer-Key"), ], ) def get_users__id_trend_analysis( id: int, period: Period1 = ..., interval: int = ..., start_date: str = ..., end_date: str = ..., categories: str = ..., scenarios: str = ..., ): """ Get trend analysis for user """ 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)