CzechFabric SDK
Complete Python SDK for CzechFabric MCP - Perfect mirror of backend system
The CzechFabric SDK provides a complete, type-safe interface to all CzechFabric backend tools. All 13 tools are implemented with exact parameter and schema matching.
Features
- ✅ 13 Tools - Complete coverage of all backend tools
- ✅ Type-Safe - Full Pydantic models matching backend exactly
- ✅ Format Support - TONE (40-60% token savings), JSON, and both formats
- ✅ Async & Sync - Use async/await or synchronous wrappers
- ✅ Validation - Input validation before API calls
- ✅ Error Handling - Comprehensive exception types
- ✅ Version Checking - Automatic compatibility checks
- ✅ Production Ready - Comprehensive testing and documentation
Installation
pip install czechfabric-sdk
Quick Start
Async Usage
import asyncio
from czechfabric_sdk import CzechFabricClient, TransportMode
async def main():
client = CzechFabricClient(
api_key="your-api-key",
base_url="https://mcp.czechfabric.cz"
)
# Get departures
result = await client.get_departures(
stop_name="Anděl",
mode=TransportMode.METRO,
max_results=10,
format="json"
)
print(result)
asyncio.run(main())
Sync Usage
from czechfabric_sdk import SyncCzechFabricClient, TransportMode
client = SyncCzechFabricClient(
api_key="your-api-key",
base_url="https://mcp.czechfabric.cz"
)
# Get departures
result = client.get_departures(
stop_name="Anděl",
mode=TransportMode.METRO,
max_results=10
)
print(result)
Helper Methods
# Domain-organized helpers
await client.tools.transport.get_departures("Anděl")
await client.tools.air_quality.current("Karlovo náměstí")
await client.tools.routing.plan_route("A", "B")
Tools
Transport (9 tools)
- Departures:
get_departures(),departures_by_coordinates(),suggest_departure_stops_nearby() - Geocoding:
geocode(),reverse_geocode() - Stops:
find_all_stops_near(),get_stop_metadata(),list_all_stops() - Routing:
plan_route_mapycz()
Air Quality (4 tools)
get_air_quality_near_location()- Current air quality near locationget_air_quality_by_district()- Air quality by districtget_air_quality_history()- Historical datalist_air_quality_components()- List all pollutants
Response Formats
All tools support three response formats:
tone(default) - Token-efficient TONE format stringjson- Standard JSON dictboth- Full Pydantic model with both formats
Error Handling
from czechfabric_sdk.exceptions import (
InvalidAPIKeyError,
RateLimitExceededError,
ValidationError,
NetworkError
)
try:
result = await client.get_departures("Anděl")
except InvalidAPIKeyError:
print("Invalid API key")
except RateLimitExceededError:
print("Rate limit exceeded")
except ValidationError as e:
print(f"Validation error: {e}")
except NetworkError as e:
print(f"Network error: {e}")
Version Compatibility
The SDK automatically checks backend compatibility:
# Strict mode - fails on version mismatch
client = CzechFabricClient(
api_key="key",
base_url="https://mcp.czechfabric.cz",
strict_mode=True # Raises error on mismatch
)
# Normal mode - warns on mismatch
client = CzechFabricClient(
api_key="key",
base_url="https://mcp.czechfabric.cz",
check_version=True # Warns on mismatch (default)
)
Documentation
- Full Documentation: https://czechfabric.cz/docs/sdk
- API Reference: See
docs/directory - Examples: See
examples.md - Changelog: See
CHANGELOG.md
Requirements
- Python 3.9 or higher
- Valid CzechFabric API key
- Internet connection
Development
# Clone repository
git clone https://github.com/czechfabric/czechfabric-sdk.git
cd czechfabric-sdk
# Install with dev dependencies
pip install -e ".[dev]"
# Run tests
pytest tests/ -v
# Run linting
ruff check czechfabric_sdk
# Run type checking
mypy czechfabric_sdk
License
MIT License - see LICENSE file.
Support
- GitHub Issues: https://github.com/czechfabric/czechfabric-sdk/issues
- Email: support@czechfabric.cz
- Documentation: https://czechfabric.cz/docs/sdk
Contributing
Contributions welcome! Please see our contributing guidelines.
Made with ❤️ for the Czech Republic
Metadata
Release files for czechfabric-sdk 2.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| czechfabric_sdk-2.0.2.tar.gz | 23.4 kB | Without provenance | Details for czechfabric_sdk-2.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| czechfabric_sdk-2.0.2-py3-none-any.whl | Python 3 | none | any | Details for czechfabric_sdk-2.0.2-py3-none-any.whl |
Total release size: 46.8 kB
Release files / czechfabric_sdk-2.0.2.tar.gz
| Download URL | czechfabric_sdk-2.0.2.tar.gz |
|---|---|
| Size | 23.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7d27f07c606e668303b4cba8996ef8308908adb29d5e421473265e330390734e
|
|
BLAKE2b-256 checksum How to use checksums |
d5885aba0234581dc162420eb37d5145a5dcd0690cab8d69eaab0fad427945cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Release files / czechfabric_sdk-2.0.2-py3-none-any.whl
| Download URL | czechfabric_sdk-2.0.2-py3-none-any.whl |
|---|---|
| Size | 23.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9fb9914796f0f0f687ce385faee9d7d82ccf8843b72695670e0d381d1a165f5d
|
|
BLAKE2b-256 checksum How to use checksums |
ddcf58bf59f5c589be55cfd1c4387d603f511a351302b99429209651dd1feb4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Security for czechfabric-sdk 2.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.