2.2 KiB
2.2 KiB
Internal architecture
The default data path is:
MCP client -> server facade -> CRM domain mixins -> NbClient -> local nb CLI -> NocoBase
The local nb environment is the identity boundary. The MCP does not keep a shared NocoBase account, and NocoBase ACL remains authoritative.
Package boundaries
crm.pyis the stableCrmServicefacade. Metadata discovery, directory resolution, record queries, presentation, analytics, and reporting live in separatecrm_*modules.server.pyowns dependency assembly and the public command entrypoint. The fourserver_tools_*modules register the existing MCP contracts;server_runtime.pyowns HTTP authentication and ASGI assembly;tool_errors.pyowns structured error mapping.config.pykeeps the public frozen configuration dataclasses and uses one data-driven section loader for camelCase and snake_case JSON aliases.nb_client.pyis the only read/query adapter to the localnbCLI.nocobase_http.pyis limited to HTTP operations the CLI does not expose cleanly, such as multipart upload and attachment relations.
Bootstrap and advanced deployment
scripts/agent_install.pyis a compatibility entrypoint. Its standard-library-only implementation lives inscripts/agent_installer/;flow.pycomposes the public one-commandinstalljourney, while the lower-level inspect, prepare, authentication, diagnostics, and client-config functions remain independently testable recovery primitives.scripts/manage_mcp_service.pyis the compatibility entrypoint for optional Linux loopback HTTP mode. Configuration serialization, runtime operations, and CLI parsing live in separatemcp_service_*modules.
Default installation remains stdio, read-only, without a background service, listener port, uploads, raw rows, or shared credentials.
Compatibility rules
- Keep the
nocobase-crm-mcpconsole entrypoint andCrmServiceimport stable. - Treat MCP tool names, input schemas, response shapes, configuration aliases, installer commands, and service-manager commands as public contracts.
- Personal API Keys may only enter the
nbCLI private TTY prompt. Never move them through Agent chat, argv, environment variables, logs, or temporary files.