mcs-driver-core
Core driver contract for the Model Context Standard (MCS).
This package defines the language-agnostic MCSDriver and MCSToolDriver
interfaces, metadata classes (DriverMeta, DriverBinding, DriverResponse),
extraction strategies, prompt strategies, and optional mixins
(ToolCallSignaling, SupportsNativeTools).
It has zero runtime dependencies and weighs only a few kilobytes.
Installation
pip install mcs-driver-core
Quick start
from mcs.driver.core import MCSDriver, DriverMeta, DriverResponse
class MyDriver(MCSDriver):
...
Capability detection
Optional features (health checks, native tool-calling via
get_native_tool_context, streaming tool-call signaling, …) are advertised as
flags in DriverMeta.capabilities. Each optional contract carries its flag
as a CAPABILITY constant. There are two operations — detection ("is the
feature there?") and invocation ("give me the object that provides it") —
and both avoid isinstance:
from mcs.driver.core import DriverMeta, SupportsNativeTools
# detection: a pure read over the (aggregated) capability flags
if driver.meta.has_capability(SupportsNativeTools):
...
# invocation: get the layer that satisfies the contract -- typed, no cast,
# works whether `driver` is a plain driver, an orchestrator, or a decorator
if (dc := DriverMeta.resolve_capability(driver, SupportsNativeTools)):
ctx = dc.get_native_tool_context(model)
Do not rely on isinstance for feature detection. Drivers are
composable: a decorator (auth, permission, hooks, …) wraps another driver,
satisfies the same MCSDriver / MCSToolDriver interfaces, and is injected
via dependency injection — so from the outside it just looks like a driver,
and the client cannot know what the stack contains. isinstance only sees
the outermost layer and misses capabilities provided deeper in the
stack. Each decorator aggregates the inner driver's capabilities and adds
its own, so meta.capabilities reflects the whole stack; isinstance
does not.
What lives in core — and what doesn't
mcs-driver-core holds the contracts (MCSDriver, MCSToolDriver,
DriverMeta) plus the reference implementations that are pure composition
mechanism — and nothing more:
BaseDriver— the leaf. A ready-made implementation of the mandatory driver methods (prompt generation, response parsing). It carries no resolution logic of its own: a leaf has no inner layers, so the resolution entry point'sisinstancefallback matches it directly.BaseDecorator— the transparent wrapping node. It delegates every interface call to a single inner driver and resolves capabilities by searching inward, so an inner capability stays reachable through the decorator. Being nothing but delegation plus stack-navigation, it belongs here alongsideBaseDriver.
Both are zero-dependency and carry no concept of their own; they are the minimal machinery the contract already implies.
The orchestrator lives in its own package (mcs-orchestrator-base),
even though it is also a wrapping driver. The difference is decisive: it
brings an abstraction of its own — a pluggable ResolutionStrategy (tool
pipelines, namespacing, tool-switching layers). That is a strategy family
with a concept of its own, not bare mechanism, so it earns a package of its
own (and keeps the kernel free of that weight).
Rule of thumb: pure composition mechanism — the leaf and the wrapping delegation — lives in the kernel; composition that carries its own strategy becomes its own package.
Links
- Homepage: https://www.modelcontextstandard.io
- Source: https://github.com/modelcontextstandard/python-sdk
- Specification: https://modelcontextstandard.io/Specification
License
Apache-2.0
Metadata
Release files for mcs-driver-core 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mcs_driver_core-0.4.1.tar.gz | 34.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcs_driver_core-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 65.5 kB
Release files / mcs_driver_core-0.4.1.tar.gz
| Download URL | mcs_driver_core-0.4.1.tar.gz |
|---|---|
| Size | 34.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
465c06c0de9e0d4f257b0f40a09ad59a531204b5a9e783966631a76da7428300
|
|
BLAKE2b-256 checksum How to use checksums |
ac4b7b930d999f737ab60d2c1948ac9a81fca3b4be3dcfba308dec4e0e094e26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / mcs_driver_core-0.4.1-py3-none-any.whl
| Download URL | mcs_driver_core-0.4.1-py3-none-any.whl |
|---|---|
| Size | 31.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c7278c46f3d2d21d6045d616aec7cbb4ce245b2243e679f6ed837fc660a69759
|
|
BLAKE2b-256 checksum How to use checksums |
01e27ac40b798bc10d7f3c1e02e34907afa522595193d885f072ae0516340746
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|