Skip to main content

mcbp-core

Async HTTP client and shared tool registry for the BAS / 1C MCBP_AI service (/ai/v1).

This is the engine shared by two front-ends: the mcbp MCP server and a FastAPI web chat. It holds everything that knows about BAS — routes, filters, response shapes, typed errors — so those front-ends hold none of it.

Requires a server-side component. mcbp-core talks to the MCBP_AI HTTP service, a BSL module installed into a BAS/1C configuration through Конфігуратор. That module is licensed separately and is not part of this package. Without it there is nothing to connect to.

The MCBP+ configuration and the MCBP_AI service module are proprietary works of MCBP.PLUS and are distributed separately. This MIT licence covers the Python package only.

What it gives you

  • MCBPClient — one pooled httpx.AsyncClient over the BAS publication: HTTP Basic auth, retries on 503, an in-memory metadata cache, and an offline mock mode for tests.
  • Typed errors — the {"error": {"code", "message"}} envelope BAS returns is mapped to exception classes (ParameterError, NotFoundError, KeyMismatchError, PlusRequiredError, …), so callers branch on type instead of re-parsing text.
  • A tool registry — 14 ToolSpecs (JSON Schema + async executor) covering catalogs, documents, registers, metadata introspection and the gated write routes. Both front-ends register from this one list, so their surfaces cannot drift apart.

Usage

from mcbp_core.client import ConnectionConfig, MCBPClient
from mcbp_core.tools import tool_specs

client = MCBPClient(ConnectionConfig(
    base_url="http://host/base/hs/mcbp_ai",   # without the /ai/v1 suffix — the client adds it
    user="ai_service", password="***", mock=False,
))
await client.startup()
try:
    rows = await client.list_catalog(type_="Номенклатура", cursor=None, limit=50, q="кабель")
finally:
    await client.shutdown()

Selecting the tools a front-end should expose:

read_only = tool_specs(surface="mcp")                        # 10 specs
everything = tool_specs(surface="mcp", include_write=True)   # 14 specs

Tool descriptions are Ukrainian by default; ToolSpec.description_en carries the English variant used by the MCP surface.

Requirements

Python 3.11+.

License

MIT — see LICENSE.

Metadata

Release files for mcbp-core 0.1.17

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcbp-core 0.1.17
File Size Uploaded
mcbp_core-0.1.17.tar.gz 88.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mcbp-core 0.1.17
File Interpreter ABI Platform
mcbp_core-0.1.17-py3-none-any.whl Python 3 none any Details

Total release size: 147.5 kB

Release files / mcbp_core-0.1.17.tar.gz

Download URL mcbp_core-0.1.17.tar.gz
Size 88.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6d46be8383f93a33af455e9423b4d36cee5155e5a9e06959ee83da3266398499
BLAKE2b-256 checksum
How to use checksums
9817142856a3ea18bbbba1ae913e055ade7e4f8e2bf8fa0d2ec566f8d62d88e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / mcbp_core-0.1.17-py3-none-any.whl

Download URL mcbp_core-0.1.17-py3-none-any.whl
Size 58.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f313b8f1de8e90cd0121dcca7812bf6bab007d90147c9a57e811e38ea27e676
BLAKE2b-256 checksum
How to use checksums
2cb45f0bf0345e87c0d8880ad28cf170382196ff68e0d25ff6111eda132d7ce8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release history Release notifications | RSS feed

This release

0.1.17 This release

2 release files

0.1.12

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.6

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page