All notable changes to this project will be documented in this file.
max_content_widthparameter oncreate_cli()-- overrides Click's default terminal-width-based help formatting. When the terminal is narrow, Click calculates description column width from the longest command name, often leaving zero space for descriptions (shown as...). This parameter forces a wider layout so descriptions are always visible.
simplify_idsprefix optimization -- whensimplify_ids=True, module ID prefix now uses only the first path segment instead of all segments. This produces shorter, cleaner command names while maintaining uniqueness via function name differentiation anddeduplicate_ids()safety net.- Before:
credit_purchase.purchase.status.get_purchase_status_by_payment_intent.get(73 chars) - After:
credit_purchase.get_purchase_status_by_payment_intent.get(57 chars)
- Before:
- Default (
simplify_ids=False) behavior unchanged -- all path segments preserved for backward compatibility.
create_mcp_server()method -- standalone MCP server creation with two modes: full FastAPI route scan, or custom modules from anextensions_dir. Creates a fresh Registry/Executor (independent of the singleton), resolves serve defaults from settings, and supportsapproval_handlerpass-through.create_cli()method -- generate an apcore-cli Click group from FastAPI routes. Scans routes, registers them as HTTP proxy modules viaHTTPProxyRegistryWriter, and builds a Click group withlist,describe,completion, andmansubcommands. Supportshelp_text_max_lengthfor configurable help text truncation.HTTPProxyRegistryWriterre-export -- available as a lazy import fromfastapi_apcorevia PEP 562__getattr__. Does not break import whenapcore-toolkitis not installed.get_writer("http-proxy")format --output.get_writer()now supports"http-proxy"format, creating anHTTPProxyRegistryWriterwithbase_url,auth_header_factory, andtimeoutkwargs.simplify_idsparameter oninit_app()andscan()-- consistent withcreate_mcp_server()andcreate_cli(), allowing simplified module IDs across all scanning entry points.- New apcore re-exports --
ExecutionCancelledErrorandModuleDisabledErrorfrom apcore 0.13.1. - 10 new tests -- covering
create_mcp_server(ValueError guard, empty registry warning, scan+serve pipeline),create_cli(ImportError guard, Click group return),scan(simplify_ids=),get_writer("http-proxy"),get_writerunknown format, lazy__getattr__import, and__getattr__error path.
registry.watch(paths=...)call ininit_app()-- removed invalidpathskeyword argument.Registry.watch()takes no arguments; it watches the directories already configured via the constructor.create_mcp_server(scan=False)silent misconfiguration -- now logs a warning when called withscan=Falseand noextensions_dir, since the MCP server would have zero tools.- Top-level
HTTPProxyRegistryWriterimport -- was an eager import that broke the entire package whenapcore-toolkitlackedhttp_proxy_writer. Replaced with PEP 562 lazy__getattr__.
- Dependency versions bumped --
apcore>=0.13.1,apcore-toolkit>=0.3.0,apcore-cli>=0.2.1. typer>=0.9replaced withclick>=8.0in[cli]optional dependency -- apcore-cli uses click directly.- Package version bumped to 0.3.0.
simplify_idsoption forOpenAPIScanner-- when enabled, generates clean module IDs using only the function name instead of the full FastAPI operationId. For example,product.get_product_product__product_id_.getbecomesproduct.get_product.get. Defaults toFalsefor backward compatibility._extract_func_name()static method -- reverses FastAPI'sgenerate_unique_id()transformation to recover the original Python function name from an operationId. Handles path parameters, nested paths, and hyphens correctly._strip_method_suffix()static method -- minimal default simplification that removes only the trailing_{method}from operationIds.get_scanner()now accepts**kwargs-- keyword arguments are forwarded to the scanner constructor, enablingget_scanner("openapi", simplify_ids=True).- 5 new tests for
simplify_idsbehavior -- covers shortened IDs, function name extraction, no duplicates, default mode preserving path info, and factory kwarg passthrough.
_generate_module_id()refactored -- uses_extract_func_name()whensimplify_ids=True, or_strip_method_suffix()whenFalse. Extracted common prefix logic to reduce duplication.- Module docstring in
openapi.pyupdated to document both ID generation modes.
- Initial release of
fastapi-apcore. FastAPIApcoreunified entry point -- single class consolidating Registry, Executor, ContextFactory, TaskManager, scanning, MCP serving, and OpenAI export. Thread-safe singleton viaget_instance().init_app(app)-- one-call initialization: auto-discovers YAML bindings, scans FastAPI routes, registers modules, enables hot-reload, and starts embedded MCP server.ApcoreSettingsconfiguration system -- frozen dataclass with 40 settings, read fromAPCORE_*environment variables with full validation.FastAPIContextFactory-- maps FastAPIRequestto apcoreContextwithIdentityextraction fromrequest.state.user(supports id/pk/sub fallback, roles/groups/scopes, W3C TraceContext).- Registry/Executor singleton management -- thread-safe lazy singletons with double-checked locking for Registry, Executor, ExtensionManager, ContextFactory, MetricsCollector, and embedded MCP server.
- Extension system --
FastAPIDiscoverer(YAML bindings + module package scanning) andFastAPIModuleValidator(reserved words, length checks) implementing apcore protocols.setup_extensions()factory. - Observability auto-setup --
setup_observability()creates TracingMiddleware, MetricsMiddleware, ObsLoggingMiddleware, ErrorHistoryMiddleware, UsageMiddleware, and PlatformNotifyMiddleware from settings. - Output writers --
FastAPIRegistryWriter(direct registry registration with Pydantic flattening and schema-based FunctionModule creation) andYAMLWriter(YAML binding file generation). - Convenience shortcuts --
executor_call,executor_call_async,executor_stream,cancellable_call,cancellable_call_async,submit_task,get_task_status,cancel_task,report_progress,elicit. - AsyncTaskManager integration -- singleton task manager with configurable concurrency and cleanup.
- Typer CLI with four command groups:
scan-- scan FastAPI routes with--source,--output,--include,--exclude,--ai-enhance,--verify,--dry-run.serve-- start MCP server with autoinit_app,--transport,--explorer,--jwt-secret,--approval,--tags,--output-formatter.export-- export modules as OpenAI-compatible tools with--strict,--embed-annotations.tasks-- manage async tasks:list,cancel,cleanup.
- Two scanner backends --
NativeFastAPIScanner(direct route inspection) andOpenAPIScanner(OpenAPI spec-based). - Serialization helpers --
module_to_dict()andmodules_to_dicts()for ScannedModule conversion. - Complete
__init__.pyexports --FastAPIApcore,ApcoreSettings,get_apcore_settings,FastAPIContextFactory, scanners, and all apcore type re-exports. - PEP 561
py.typedmarker for type checker support. - Comprehensive test suite -- 129 tests across 14 test files.
- Project structure -- public API (
__init__.py,client.py,cli.py) at top level; internal engine files inengine/subdirectory; scanners inscanners/; output writers inoutput/.