# Litestar
Canonical Origin: https://litestar.dev/
## LLM Resources
- [Full Content](https://litestar.dev/llms-full.txt): Complete page content in markdown format.
---
- **Page:** Litestar: The Modern Python ASGI Framework
- **Source:** https://litestar.dev/
- **Description:** Build blazing fast APIs with automatic documentation, dependency injection, and type safety. Litestar makes complex web development simple and intuitive.
[**New website & v3 **](https://litestar.dev/blog/new-website-and-v3)
# **The Modern **Python
**ASGI Framework**
Built to scale
Fast APIs with automatic OpenAPI documentation, dependency injection, type safety, and a lot of batteries included. Litestar makes designing complex web apps simpler
[**Get started **](https://docs.litestar.dev/) [** View on Github **](https://github.com/litestar-org/litestar)
## **Focused on development experience**
- **Modern batteries included** Comprehensive optional features available out-of-the-box - authentication, validation, ORM integration, caching, middleware, and more. Use what you need, when you need it.
- **Strict & opinionated design** Thoughtful defaults and clear conventions guide you toward best practices, reducing decision fatigue and ensuring consistent, maintainable code.
- **Hierarchical configuration** Layered configuration system allows easy modularization. Override settings at any level - application, controller, or route - for maximum flexibility.
- **Powerful plugin system** Extend functionality seamlessly with official and community plugins. Build reusable components that integrate naturally with Litestar's architecture.
[Explore documentation](https://docs.litestar.dev/)
## **Everything you need to build modern APIs**
Litestar provides all the tools you need out of the box, with minimal configuration required.
- **Data Validation And Parsing** Leverage the power of type hints to define how data should be validated, parsed and serialized. [Data Validation And Parsing](https://docs.litestar.dev/2/usage/dto/index.html)
- **Open Ecosystem** Define schemas and models for validation with standard types such as dataclasses, libraries like Pydantic, msgspec, attr, or integrate your own. [Open Ecosystem](https://docs.litestar.dev/2/usage/applications.html)
- **OpenAPI** Automatically generated OpenAPI schemas help to document APIs and integrate with the frontend via TypeScript schema generation. [OpenAPI](https://docs.litestar.dev/2/usage/openapi/index.html)
- **Interactive API Documentation** Interactively explore your APIs through Swagger, Redoc or Stoplight Elements, powered by OpenAPI. [Interactive API Documentation](https://docs.litestar.dev/2/usage/openapi/ui_plugins.html)
- **Middlewares** Handle rate-limiting, CORS, CSRF, compression, logging and many more common tasks with Litestar's built-in middlewares. [Middlewares](https://docs.litestar.dev/2/usage/middleware/builtin-middleware.html)
- **Data Stores** Interfaces for various key/value stores that seamlessly integrate with your application and third party extensions. [Data Stores](https://docs.litestar.dev/2/usage/stores.html)
- **ORM Integration** First-class SQLAlchemy support let's you use your models for validation and serialization directly, reducing code duplication. [ORM Integration](https://docs.litestar.dev/2/usage/databases/sqlalchemy/index.html)
- **Dependency Injection** Powerful dependency injection on all application layers, aides in code decoupling and reduces repetition. [Dependency Injection](https://docs.litestar.dev/2/usage/dependency-injection.html)
- **Caching** Response caching with minimal configuration and overhead to speed up response times. [Caching](https://docs.litestar.dev/2/usage/caching.html)
- **WebSockets** Easy to use WebSockets integration, featuring high- and low-level APIs and support for automatic data validation and serialization. [WebSockets](https://docs.litestar.dev/2/usage/websockets.html)
- **Authentication And Authorization** Session and JWT based authentication and utilities at your disposal to start building your authentication layer with ease. [Authentication And Authorization](https://docs.litestar.dev/2/usage/security/index.html)
- **Explore Litestar now**[Start reading docs](https://docs.litestar.dev/)
## Extend Litestar with plugins
Litestar has a rich module ecosystem, with both official and community-driven plugins. This accelerates development by providing ready-to-use solutions for common needs.
[Explore all plugins](https://litestar.dev/plugins)

### Advanced Alchemy
Ready-to-go SQLAlchemy concoctions.
[**702.9K**](https://pypi.org/project/advanced-alchemy) [**813**](https://github.com/litestar-org/advanced-alchemy)
[Advanced Alchemy](https://litestar.dev/plugins/advanced-alchemy)

### Litestar AsyncPG
Asyncpg plugin for Litestar
[**2.1K**](https://pypi.org/project/litestar-asyncpg) [**15**](https://github.com/litestar-org/litestar-asyncpg)
[Litestar AsyncPG](https://litestar.dev/plugins/litestar-asyncpg)

### Litestar Autowire
Package-based route, listener, and task discovery for Litestar
[**348**](https://pypi.org/project/litestar-autowire) [**3**](https://github.com/cofin/litestar-autowire)
[Litestar Autowire](https://litestar.dev/plugins/litestar-autowire)
### Litestar Email
Email plugin for Litestar
[**2.5K**](https://pypi.org/project/litestar-email) [**16**](https://github.com/litestar-org/litestar-email)
[Litestar Email](https://litestar.dev/plugins/litestar-email)

### Litestar Granian
Granian plugin for Litestar
[**16.5K**](https://pypi.org/project/litestar-granian) [**44**](https://github.com/cofin/litestar-granian)
[Litestar Granian](https://litestar.dev/plugins/litestar-granian)

### Litestar HTMX
HTMX Integration for Litestar
[**1.7M**](https://pypi.org/project/litestar-htmx) [**12**](https://github.com/litestar-org/litestar-htmx)
[Litestar HTMX](https://litestar.dev/plugins/litestar-htmx)

### Litestar MCP
Litestar plugin for Model Context Protocol (MCP) integration
[**6K**](https://pypi.org/project/litestar-mcp) [**13**](https://github.com/cofin/litestar-mcp)
[Litestar MCP](https://litestar.dev/plugins/litestar-mcp)

### Litestar OracleDB
Oracle DB plugin for Litestar
[**15**](https://pypi.org/project/litestar-oracledb) [**4**](https://github.com/litestar-org/litestar-oracledb)
[Litestar OracleDB](https://litestar.dev/plugins/litestar-oracledb)

### Litestar Queues
Task queues, workers, schedules, and backend integrations for Litestar
[**854**](https://pypi.org/project/litestar-queues) [**10**](https://github.com/cofin/litestar-queues)
[Litestar Queues](https://litestar.dev/plugins/litestar-queues)
### Litestar SAQ
Litestar integration for SAQ
[**21.7K**](https://pypi.org/project/litestar-saq) [**35**](https://github.com/litestar-org/litestar-saq)
[Litestar SAQ](https://litestar.dev/plugins/litestar-saq)

### Litestar Vite
Vite plugin for Litestar
[**16.9K**](https://pypi.org/project/litestar-vite) [**37**](https://github.com/litestar-org/litestar-vite)
[Litestar Vite](https://litestar.dev/plugins/litestar-vite)
### SQLSpec
SQL Experiments in Python
[**10K**](https://pypi.org/project/sqlspec) [**105**](https://github.com/litestar-org/sqlspec)
[SQLSpec](https://litestar.dev/plugins/sqlspec)
## **Unlock synergy, seamless integrations with Litestar**
Explore Litestar seamless integrations with other tools and platforms, enhancing productivity and workflow efficiency.
### **Scalar**
Scalar integration.
[Card link](https://github.com/scalar/scalar)
### **RapiDoc**
RapiDoc integration.
[Card link](https://github.com/rapi-doc/RapiDoc)
### **ReDoc**
ReDoc integration.
[Card link](https://github.com/Redocly/redoc)
### **Spotlight Elements**
Elements integration.
[Card link](https://github.com/stoplightio/elements)
### **Swagger UI**
Swagger UI integration.
[Card link](https://github.com/swagger-api/swagger-ui)
### **YAML**
YAML integration.
[Card link](https://yaml.org/)
## **Work with any Python data model**
Litestar supports all popular Python data modeling libraries out of the box. Choose your favorite or mix and match based on your needs.
### **Pydantic**
The most popular data validation library for Python.
[Card link](https://docs.pydantic.dev/)
### **Dataclasses**
Python's built-in dataclasses with full support for serialization and validation.
[Card link](https://docs.python.org/3/library/dataclasses.html)
### **Attrs**
Python classes without boilerplate. Mature and battle-tested with excellent performance.
[Card link](https://www.attrs.org/)
### **TypedDict**
Type hints for dictionaries with specific key-value types and API responses.
[Card link](https://docs.python.org/3/library/typing.html#typing.TypedDict)
### **Msgspec**
Fast serialization and validation library with JSON and MessagePack support.
[Card link](https://msgspec.dev/)
## **The developer's choice for simple and powerful APIs**
Litestar was born from developers' need to boost productivity and platform performance. What began as a starlette based-solution is now a solid ASGI frameworks to build APIs that scale.
**1.7M**
Monthly downloads
[Card link](https://pypi.org/project/litestar/)
**8.5K**
GitHub Stars
[Card link](https://github.com/litestar-org/litestar)
**Open source**
Litestar is 100% powered by our passionate open source community.
[Start contributing](https://github.com/litestar-org/litestar)
[Card link](https://github.com/litestar-org/litestar)
**300**
Contributors
[Card link](https://github.com/litestar-org/litestar/graphs/contributors)
**2.1K**
Members
[Card link](https://discord.gg/litestar)
## **Sponsors**
Litestar is made possible by contributors and sponsor, it will remain free and open source under the MIT License.
[Become a sponsor](https://opencollective.com/litestar)
- [**Scalar**](https://scalar.com/)
- [**Telemetry Sports**](https://telemetrysports.com/)
---
- **Page:** Litestar Blog
- **Source:** https://litestar.dev/blog
- **Description:** Read the latest news about Litestar ecosystem
# **Litestar Blog**
Read the latest news about Litestar ecosystem

AnnouncementJul 26, 2026
## **Announcing Litestar 3**
Litestar 3 is afoot. Have a look at what awaits you

**Janek Nouvertné**

AnnouncementJul 25, 2026
## **Introducing the New Litestar Website and the upcoming 3.0 release**
We are proud to announce the launch of our new Litestar website, and some hints at the beta of Litestar 3.0.

**Julien Courtès**
---
- **Page:** Introducing the New Litestar Website and the upcoming 3.0 release
- **Source:** https://litestar.dev/blog/new-website-and-v3
- **Description:** We are proud to announce the launch of our new Litestar website, and some hints at the beta of Litestar 3.0.
We are thrilled to announce the launch of our new website along a preview of the upcoming v3 version of Litestar. This major update is the result of years of hard work and dedication from our team, and we can't wait to share it with you!
## Website
With the upcoming v3, we wanted to have a new website that would reflect evolution of the project and the ecosystem around the framework.
### Plugin Directory
We wired a page to list all the plugins available for the Litestar framework. It includes official plugins maintained by the Litestar team as well as plugins developped by the community.
#### Submit Your Plugin
If you want to develop or register your plugin, you can have it listed there by submitting your plugin:
1. Fork the [litestar-org/plugin-registry](https://github.com/litestar-org/plugin-registry) repository
2. Add your plugin information following our submission guidelines
3. Create a pull request with your plugin details
We will then merge our submission and you will be listed in the plugin page.
### Blog Section
We decided to add a blog to share some exciting news about the litestar framework and the ecosystem. We will be posting release announcements and updates.
### Next improvements
We have a ton of ideas for the website, not sure all the things we have in mind will make it one day, but here is a list of some of the things:
- Deployment guide (how to deploy your Litestar application in production)
- Tutorials (interactive tutorials to learn Litestar hands-on)
- Starter templates (boilerplates to kickstart your projects or create a plugin)
- Docker and containerization best practices
- Performance optimization tips
This section will help you take your Litestar applications from development to production with confidence.
## Litestar v3
Litestar 3 is on its way! Read all about what's coming in the [Litestar 3 announcement](/blog/v3-announcement).
### New documentation
We have revamped the documentation for the v3 release, making it more comprehensive and easier to navigate. But writing good documentation is hard and takes a lot of time, so we are still working on it and we will keep improving it as we get closer to the release.
Do not hesitate to check it out and give us feedback on how we can improve it, or even better, contribute to it if you want to help us!
## EuroPython 2026
We will be attending [EuroPython 2026](https://ep2026.europython.eu/) in Kraków in July. This is a great opportunity for us to connect with the community, share our progress on Litestar v3, and gather feedback.
Cody and Julien gave a [talk](https://ep2026.europython.eu/session/designing-performant-apis-with-litestar) about how to design performant APIs with Litestar, make sure to check it out! Also Jacob gave also a [talk](https://ep2026.europython.eu/session/supercharging-litestar-extensibility-through-plugins) about supercharging litestar with plugins.
## Join our community
The Litestar project lives because of our community. Here's how you can get involved:
### Connect on Discord
Join our vibrant [Discord community](https://discord.gg/litestar) where you can:
- Get help with your projects
- Share your creations
- Discuss new features and ideas
- Connect with other Litestar developers
### Contribute to the project
Litestar is open source and welcomes contributors! Whether you're interested in:
- **Code contributions**: Bug fixes, new features, performance improvements
- **Documentation**: Writing guides, improving examples, fixing typos
- **Community support**: Helping others on Discord and GitHub
- **Plugin development**: Creating tools that extend Litestar's capabilities
Every contribution makes a difference. Check out our [contribution guide](https://docs.litestar.dev/latest/contribution-guide) to get started.
### Talk about Litestar
If you enjoy using Litestar, consider sharing your experience with others, you can:
- Write blog posts or tutorials about your projects
- Talk to others about your experience with Litestar
## Get started today
If you want to try out Litestar, you can install it using pip or uv (or any package manager of your choice):
```bash
pip install litestar
# or
uv add litestar
```
Visit our [documentation](https://docs.litestar.dev) for comprehensive guides, explore the [plugin directory](/plugins) for useful extensions, and join our [Discord community](https://discord.gg/litestar) to connect with fellow developers.
We can't wait to see what you'll build with Litestar!
---
- **Page:** About Litestar
- **Source:** https://litestar.dev/about
- **Description:** Learn about the Litestar organization, our community-driven approach, and the team of maintainers who make it all possible.
# **About Litestar**
Learn about the Litestar organization, our community-driven approach, and the team of maintainers who make it all possible.
**6**
Maintainers
Card link
**300**
Contributors
[Card link](https://github.com/litestar-org/litestar/graphs/contributors)
**2.25.0**
Version
[Card link](https://github.com/litestar-org/litestar/releases)
**MIT**
License
[Card link](https://github.com/litestar-org/litestar/blob/main/LICENSE)
## **Our Organization**
Litestar is developed by volunteers and outside contributors, led by a dedicated team of Maintainers. Our community-driven project encourages user involvement and values every contribution.
**Community-Driven**
Developed by volunteers and outside contributors with an open, welcoming approach to all participants.
**Every Contribution Welcome**
We follow the All Contributors guidelines and appreciate every form of contribution, big or small.
**Open Participation**
Join our community through issues, discussions, pull requests, and code contributions.
## **Project History**
Litestar has evolved significantly since its inception, originally starting as 'Starlite'. The rebranding to 'Litestar' in version 2.0 marked a new chapter, avoiding confusion with similar frameworks.
January 2022
**Originally "Starlite"**
The project began its journey under the name "Starlite", establishing itself as a powerful ASGI framework.
October 2023
**Renamed to "Litestar" in v2.0**
To avoid confusion with similar framework names, we rebranded to "Litestar" with version 2.0, marking a new chapter in our development.
Q3-Q4 2026
**Litestar v3.0 Release**
Major version release bringing enhanced performance, new features, and improved developer experience to the framework.
## **Meet Our Maintainers and Members**
Litestar is developed by a dedicated team of maintainers and contributors who ensure the project's success.

### **Andrew Truong**
Maintainer [** GitHub **](https://github.com/adhtruong)

### **Cody Fincher**
Maintainer [** GitHub **](https://github.com/cofin)

### **Jacob Coffee**
Maintainer [** GitHub **](https://github.com/JacobCoffee)

### **Julien Courtès**
Maintainer [** GitHub **](https://github.com/Kumzy)

### **Peter Schutt**
Maintainer [** GitHub **](https://github.com/peterschutt)

### **Janek Nouvertné**
Maintainer [** GitHub **](https://github.com/provinzkraut)

### **DanCardin**
Member [** GitHub **](https://github.com/DanCardin)

### **euri10**
Member [** GitHub **](https://github.com/euri10)

### **Harshal Laheri**
Member [** GitHub **](https://github.com/Harshal6927)

### **Sobolevn**
Member [** GitHub **](https://github.com/sobolevn)

### **Winston H.**
Member [** GitHub **](https://github.com/winstxnhdw)
Litestar was made possible by all the contributors that participated in the project over time. Thank you!
[**All contributors**](https://github.com/litestar-org/litestar/graphs/contributors)
## **Ways to Contribute**
Litestar welcomes contributors from all backgrounds and skill levels. Join our growing community to help by answering questions, improving documentation, joining discussions, or contributing to development.
**Opening Issues**
Report bugs, request features, or ask questions to help improve the project.
[Opening Issues](https://github.com/litestar-org/litestar/issues/new)
**Participating in Discussions**
Share ideas, help others, and engage with the community in our discussions.
[Participating in Discussions](https://github.com/litestar-org/litestar/discussions)
**Reviewing Pull Requests**
Help review code changes and provide feedback to maintain high quality.
[Reviewing Pull Requests](https://github.com/litestar-org/litestar/pulls)
**Contributing Code**
Submit bug fixes, new features, or improvements to the codebase.
[Contributing Code](https://github.com/litestar-org/litestar/blob/main/CONTRIBUTING.md)
**Contributing Documentation**
Improve the documentation or fix errors.
[Contributing Documentation](https://github.com/litestar-org/litestar/blob/main/CONTRIBUTING.md)
### **Get Involved **
Every contribution is welcome and appreciated! Join our community and help make Litestar even better.
[**Contribute on GitHub **](https://github.com/litestar-org/litestar) [** Join Discord **](https://discord.gg/litestar)
---
- **Page:** SQLSpec · Litestar Plugins
- **Source:** https://litestar.dev/plugins/sqlspec
- **Description:** SQL Experiments in Python
# SQLSpec
SQL Experiments in Python
[**10K downloads**](https://pypistats.org/packages/sqlspec)• [**105 stars**](https://github.com/litestar-org/sqlspec)• [**v0.67.0**](https://github.com/litestar-org/sqlspec/releases)
[**cofin**](https://github.com/cofin)
**Type-safe SQL execution for Python, without an ORM.**
[](https://pypi.org/project/sqlspec/) [](https://pypi.org/project/sqlspec/) [](https://github.com/litestar-org/sqlspec/blob/main/LICENSE) [](https://sqlspec.dev/)
SQLSpec is a SQL execution layer for Python. You write the SQL -- as strings, through a builder API, or loaded from files. SQLSpec handles connections, parameter binding, and dialect translation. It maps results back to typed Python objects. It uses [sqlglot](https://github.com/tobymao/sqlglot) under the hood. Queries are parsed, validated, and optimized before they hit the database.
| **Area** | **Support** |
| --- | --- |
| **One API** | The same session and result APIs with sync or async drivers. |
| **Databases** | PostgreSQL, SQLite, DuckDB, MySQL, SQL Server, Oracle, CockroachDB, BigQuery, Spanner, and supported Arrow Database Connectivity backends such as Snowflake, Flight SQL, and GizmoSQL. |
| **Data tools** | Typed result mapping, Arrow export, built-in storage, and native bulk ingest where the adapter supports it. |
| **Frameworks** | Litestar, FastAPI, Flask, Sanic, and Starlette. |
## Quick Start
```
uv add sqlspec
# or
pip install sqlspec
```
```
from dataclasses import dataclass
from sqlspec import SQLSpec
from sqlspec.adapters.sqlite import SqliteConfig
@dataclass
class Greeting:
message: str
spec = SQLSpec()
db = spec.add_config(SqliteConfig(connection_config={"database": ":memory:"}))
with spec.provide_session(db) as session:
greeting = session.select_one("SELECT 'Hello, SQLSpec!' AS message", schema_type=Greeting)
print(greeting.message)
```
Write SQL, define a schema, get typed objects back. The [getting started guide](https://sqlspec.dev/getting_started/) covers adapter installation and the query builder.
## Features
- **Session lifecycle** -- sync and async sessions with pooling where the adapter supports it
- **Parameter binding and dialect translation** -- powered by sqlglot, with a fluent query builder and `**.sql**` file loader
- **Result mapping** -- map rows to Pydantic, msgspec, attrs, or dataclass models, or export to Arrow tables for pandas and Polars
- **Storage layer** -- read and write Arrow tables to local files, fsspec, or object stores
- **Framework integrations** -- Litestar plugin with DI, Starlette/FastAPI/Sanic middleware, Flask extension
- **Google ADK** -- SQLSpec-backed session, event, memory, and artifact services
- **Observability** -- OpenTelemetry and Prometheus instrumentation, structured logging with correlation IDs
- **Event channels** -- LISTEN/NOTIFY, Oracle AQ/TxEventQ, and durable table-backed queues with polling fallback
- **Migrations** -- native schema migration CLI backed by SQLSpec's SQL file loader
## Documentation
- [Getting Started](https://sqlspec.dev/getting_started/) -- installation, adapter selection, first steps
- [Usage Guides](https://sqlspec.dev/usage/) -- adapters, configuration, SQL file loader, and more
- [Recipes](https://sqlspec.dev/recipes/) -- production patterns (DI, service layers, multi-tenancy)
- [API Reference](https://sqlspec.dev/reference/) -- full API docs
- [CLI Reference](https://sqlspec.dev/usage/cli.html) -- migration and management commands
## Playground
Want to try it without installing anything? The [interactive playground](https://sqlspec.dev/playground) runs SQLSpec in your browser with a sandboxed Python runtime.
## Reference Applications
- **[PostgreSQL + Vertex AI Demo](https://github.com/cofin/postgres-vertexai-demo)** -- Vector search with pgvector and real-time chat using Litestar and Google ADK. Shows connection pooling, migrations, type-safe result mapping, vector embeddings, and response caching.
- **[Oracle + Vertex AI Demo](https://github.com/cofin/oracledb-vertexai-demo)** -- Oracle 23ai vector search with semantic similarity using HNSW indexes. Demonstrates NumPy array conversion, large object handling, and real-time performance metrics.
## Contributing
Contributions are welcome -- whether that's bug reports, new adapter ideas, or pull requests. Take a look at the [contributor guide](https://sqlspec.dev/contributing/) to get started.
## License
MIT
---
- **Page:** Advanced Alchemy · Litestar Plugins
- **Source:** https://litestar.dev/plugins/advanced-alchemy
- **Description:** Ready-to-go SQLAlchemy concoctions.
#  Advanced Alchemy
Ready-to-go SQLAlchemy concoctions.
[**702.9K downloads**](https://pypistats.org/packages/advanced-alchemy)• [**813 stars**](https://github.com/litestar-org/advanced-alchemy)• [**v1.12.0**](https://github.com/litestar-org/advanced-alchemy/releases)
[**cofin**](https://github.com/cofin)

| **Project** | **Status** |
| --- | --- |
| CI/CD | [](https://github.com/litestar-org/advanced-alchemy/actions/workflows/publish.yml) [](https://github.com/litestar-org/advanced-alchemy/actions/workflows/ci.yml) [](https://github.com/litestar-org/advanced-alchemy/actions/workflows/docs.yml) |
| Quality | [](https://codecov.io/github/litestar-org/advanced-alchemy) [](https://sonarcloud.io/summary/new_code?id=litestar-org_advanced-alchemy) [](https://sonarcloud.io/summary/new_code?id=litestar-org_advanced-alchemy) [](https://sonarcloud.io/summary/new_code?id=litestar-org_advanced-alchemy) [](https://sonarcloud.io/summary/new_code?id=litestar-org_advanced-alchemy) |
| Package | [](https://badge.fury.io/py/advanced-alchemy) |
| Community | [](https://discord.gg/litestar) [](https://matrix.to/#/#litestar:matrix.org) |
| Meta | [](https://github.com/litestar-org/advanced-alchemy) [](https://github.com/python/mypy) [](https://spdx.org/licenses/) [](https://github.com/astral-sh/ruff) |
Check out the [project documentation](https://advanced-alchemy.litestar.dev) 📚 for more information.
## About
A carefully crafted, thoroughly tested, optimized companion library for SQLAlchemy, offering:
- Sync and async repositories, featuring common CRUD and highly optimized bulk operations
- Integration with major web frameworks including Litestar, Starlette, FastAPI, Sanic
- Custom-built alembic configuration and CLI with optional framework integration
- Utility base classes with audit columns, primary keys and utility functions
- [SQLModel](https://sqlmodel.tiangolo.com/) compatibility — use `**SQLModel**` `**table=True**` models directly with repositories and services
- Composite primary key support — work with multi-column primary keys across repositories, services, and bulk operations
- Read/write replica routing with automatic query routing, round-robin/random replica selection, and sticky-primary mode
- Dogpile caching integration for query result caching
- Built in `**File Object**` data type for storing objects:
- Unified interface for various storage backends ([`**fsspec**`](https://filesystem-spec.readthedocs.io/en/latest/) and [`**obstore**`](https://developmentseed.org/obstore/latest/))
- Optional lifecycle event hooks integrated with SQLAlchemy's event system to automatically save and delete files as records are inserted, updated, or deleted.
- Optimized JSON types including a custom JSON type for Oracle
- Integrated support for UUID6 and UUID7 ([`**uuid-utils**`](https://github.com/aminalaee/uuid-utils) when installed, otherwise native in Python 3.14+, with UUID4 fallback on older versions).
- Integrated support for Nano ID using [`**fastnanoid**`](https://github.com/oliverlambson/fastnanoid) (install with the `**nanoid**` extra)
- Custom encrypted text type with multiple backend support including [`**pgcrypto**`](https://www.postgresql.org/docs/current/pgcrypto.html) for PostgreSQL and the Fernet implementation from [`**cryptography**`](https://cryptography.io/en/latest/) for other databases
- Custom password hashing type with multiple backend support including [`**Argon2**`](https://github.com/P-H-C/phc-winner-argon2), [`**Passlib**`](https://passlib.readthedocs.io/en/stable/), and [`**Pwdlib**`](https://pwdlib.readthedocs.io/en/stable/) with automatic salt generation and rehash-on-verify for transparent hash upgrades on login
- Custom TOTP shared-secret type that stores an authenticator seed encrypted at rest and verifies time-based one-time passwords via [`**pyotp**`](https://github.com/pyauth/pyotp) (install with the `**pyotp**` extra)
- Custom one-time-code type that stores email/SMS verification codes hashed in JSON with built-in expiry, single-use redemption, attempt lockout, and a secure code generator
- Pre-configured base classes with audit columns UUID or Big Integer primary keys and a [sentinel column](https://docs.sqlalchemy.org/en/20/core/connections.html#configuring-sentinel-columns).
- Synchronous and asynchronous repositories featuring:
- Common CRUD operations for SQLAlchemy models
- Bulk inserts, updates, upserts, and deletes with dialect-specific enhancements
- Integrated counts, pagination, sorting, filtering with `**LIKE**`, `**IN**`, `**IS NULL**`/ `**IS NOT NULL**`, and dates before and/or after.
- Tested support for multiple database backends including:
- SQLite via [aiosqlite](https://aiosqlite.omnilib.dev/en/stable/) or [sqlite](https://docs.python.org/3/library/sqlite3.html)
- Postgres via [asyncpg](https://magicstack.github.io/asyncpg/current/) or [psycopg3 (async or sync)](https://www.psycopg.org/psycopg3/)
- MySQL via [asyncmy](https://github.com/long2ice/asyncmy)
- Oracle via [oracledb (async or sync)](https://oracle.github.io/python-oracledb/) (tested on 18c and 23c)
- Google Spanner via [spanner-sqlalchemy](https://github.com/googleapis/python-spanner-sqlalchemy/)
- DuckDB via [duckdb\_engine](https://github.com/Mause/duckdb_engine)
- Microsoft SQL Server via [pyodbc](https://github.com/mkleehammer/pyodbc) or [aioodbc](https://github.com/aio-libs/aioodbc)
- CockroachDB via [sqlalchemy-cockroachdb (async or sync)](https://github.com/cockroachdb/sqlalchemy-cockroachdb)
- ...and much more
## Usage
### Installation
```
pip install advanced-alchemy
```
> !IMPORTANT
> Check out [the installation guide](https://advanced-alchemy.litestar.dev/latest/#installation) in our official documentation!
### Repositories
Advanced Alchemy includes a set of asynchronous and synchronous repository classes for easy CRUD operations on your SQLAlchemy models.
Click to expand the example
```
from advanced_alchemy import base, repository, config
from sqlalchemy import create_engine
from sqlalchemy.orm import Mapped, sessionmaker
class User(base.UUIDBase):
# you can optionally override the generated table name by manually setting it.
__tablename__ = "user_account" # type: ignore[assignment]
email: Mapped[str]
name: Mapped[str]
class UserRepository(repository.SQLAlchemySyncRepository[User]):
"""User repository."""
model_type = User
db = config.SQLAlchemySyncConfig(connection_string="duckdb:///:memory:", session_config=config.SyncSessionConfig(expire_on_commit=False))
# Initializes the database.
with db.get_engine().begin() as conn:
User.metadata.create_all(conn)
with db.get_session() as db_session:
repo = UserRepository(session=db_session)
# 1) Create multiple users with `add_many`
bulk_users = [
{"email": 'cody@litestar.dev', 'name': 'Cody'},
{"email": 'janek@litestar.dev', 'name': 'Janek'},
{"email": 'peter@litestar.dev', 'name': 'Peter'},
{"email": 'jacob@litestar.dev', 'name': 'Jacob'}
]
objs = repo.add_many([User(**raw_user) for raw_user in bulk_users])
db_session.commit()
print(f"Created {len(objs)} new objects.")
# 2) Select paginated data and total row count. Pass additional filters as kwargs
created_objs, total_objs = repo.get_many_and_count(LimitOffset(limit=10, offset=0), name="Cody")
print(f"Selected {len(created_objs)} records out of a total of {total_objs}.")
# 3) Let's remove the batch of records selected.
deleted_objs = repo.delete_many([new_obj.id for new_obj in created_objs])
print(f"Removed {len(deleted_objs)} records out of a total of {total_objs}.")
# 4) Let's count the remaining rows
remaining_count = repo.count()
print(f"Found {remaining_count} remaining records after delete.")
```
Here's the same example from above but using a service to create the data:
```
from advanced_alchemy import base, repository, filters, service, config
from sqlalchemy import create_engine
from sqlalchemy.orm import Mapped, sessionmaker
class User(base.UUIDBase):
# you can optionally override the generated table name by manually setting it.
__tablename__ = "user_account" # type: ignore[assignment]
email: Mapped[str]
name: Mapped[str]
class UserService(service.SQLAlchemySyncRepositoryService[User]):
"""User repository."""
class Repo(repository.SQLAlchemySyncRepository[User]):
"""User repository."""
model_type = User
repository_type = Repo
db = config.SQLAlchemySyncConfig(connection_string="duckdb:///:memory:", session_config=config.SyncSessionConfig(expire_on_commit=False))
# Initializes the database.
with db.get_engine().begin() as conn:
User.metadata.create_all(conn)
with db.get_session() as db_session:
service = UserService(session=db_session)
# 1) Create multiple users with `add_many`
objs = service.create_many([
{"email": 'cody@litestar.dev', 'name': 'Cody'},
{"email": 'janek@litestar.dev', 'name': 'Janek'},
{"email": 'peter@litestar.dev', 'name': 'Peter'},
{"email": 'jacob@litestar.dev', 'name': 'Jacob'}
])
print(objs)
print(f"Created {len(objs)} new objects.")
# 2) Select paginated data and total row count. Pass additional filters as kwargs
created_objs, total_objs = service.get_many_and_count(LimitOffset(limit=10, offset=0), name="Cody")
print(f"Selected {len(created_objs)} records out of a total of {total_objs}.")
# 3) Let's remove the batch of records selected.
deleted_objs = service.delete_many([new_obj.id for new_obj in created_objs])
print(f"Removed {len(deleted_objs)} records out of a total of {total_objs}.")
# 4) Let's count the remaining rows
remaining_count = service.count()
print(f"Found {remaining_count} remaining records after delete.")
```
Litestar Example
```
from litestar import Litestar
from litestar.plugins.sqlalchemy import SQLAlchemyPlugin, SQLAlchemyAsyncConfig
# alternately...
# from advanced_alchemy.extensions.litestar import SQLAlchemyAsyncConfig, SQLAlchemyPlugin
alchemy = SQLAlchemyPlugin(
config=SQLAlchemyAsyncConfig(connection_string="sqlite+aiosqlite:///test.sqlite"),
)
app = Litestar(plugins=[alchemy])
```
Flask Example
```
from flask import Flask
from advanced_alchemy.extensions.flask import AdvancedAlchemy, SQLAlchemySyncConfig
app = Flask(__name__)
alchemy = AdvancedAlchemy(
config=SQLAlchemySyncConfig(connection_string="duckdb:///:memory:"), app=app,
)
```
FastAPI Example
```
from advanced_alchemy.extensions.fastapi import AdvancedAlchemy, SQLAlchemyAsyncConfig
from fastapi import FastAPI
app = FastAPI()
alchemy = AdvancedAlchemy(
config=SQLAlchemyAsyncConfig(connection_string="sqlite+aiosqlite:///test.sqlite"), app=app,
)
```
Pre-built Example Apps
```
from advanced_alchemy.extensions.starlette import AdvancedAlchemy, SQLAlchemyAsyncConfig
from starlette.applications import Starlette
app = Starlette()
alchemy = AdvancedAlchemy(
config=SQLAlchemyAsyncConfig(connection_string="sqlite+aiosqlite:///test.sqlite"), app=app,
)
```
Pre-built Example Apps
```
from sanic import Sanic
from sanic_ext import Extend
from advanced_alchemy.extensions.sanic import AdvancedAlchemy, SQLAlchemyAsyncConfig
app = Sanic("AlchemySanicApp")
alchemy = AdvancedAlchemy(
sqlalchemy_config=SQLAlchemyAsyncConfig(connection_string="sqlite+aiosqlite:///test.sqlite"),
)
Extend.register(alchemy)
```
Optional event loops
The default installation uses Granian's standard loop selection and installs no optional event loop. Install and select one integration at a time:
```
python -m pip install "litestar-granian[uvloop]"
litestar --app example:app run --loop uvloop
```
On supported platforms, use the matching **rloop** or **winloop** extra and pass **--loop rloop** or **--loop winloop**.
Thanks for signing up.
", to=["user@example.com"], ) ``` ## Available Backends | **Backend** | **Config Class** | **Use Case** | | --- | --- | --- | | `**console**` | - | Development (prints to stdout) | | `**memory**` | - | Testing (stores in memory) | | `**smtp**` | `**SMTPConfig**` | Production SMTP servers | | `**resend**` | `**ResendConfig**` | Resend HTTP API | | `**sendgrid**` | `**SendGridConfig**` | SendGrid HTTP API | | `**mailgun**` | `**MailgunConfig**` | Mailgun HTTP API | | `**ses**` | `**SESConfig**` | Amazon SES API v2 (SigV4-signed) | API backends (Resend, SendGrid, Mailgun, SES) support configurable HTTP transports: ``` from litestar_email import ResendConfig # Default: uses httpx (bundled with Litestar) config = ResendConfig(api_key="re_xxx...") # Alternative: use aiohttp config = ResendConfig(api_key="re_xxx...", http_transport="aiohttp") ``` ## Testing The `**InMemoryBackend**` is designed for testing: ``` from litestar_email.backends import InMemoryBackend def test_sends_welcome_email(): InMemoryBackend.clear() # ... code that sends email ... assert len(InMemoryBackend.outbox) == 1 assert InMemoryBackend.outbox[0].subject == "Welcome!" ``` If you need direct backend access in tests, use `**config.get_backend()**`: ``` from litestar_email import EmailConfig, EmailMessage config = EmailConfig(backend="memory") backend = config.get_backend() message = EmailMessage(subject="Hello", body="Body", to=["user@example.com"]) await backend.send_messages([message]) ``` ## Development ``` make install # Install dependencies make test # Run tests make lint # Run linting make check-all # Run all checks ``` ## License MIT --- - **Page:** Litestar Queues · Litestar Plugins - **Source:** https://litestar.dev/plugins/litestar-queues - **Description:** Task queues, workers, schedules, and backend integrations for Litestar #  Litestar Queues Task queues, workers, schedules, and backend integrations for Litestar [**854 downloads**](https://pypistats.org/packages/litestar-queues)• [**10 stars**](https://github.com/cofin/litestar-queues)• [**v0.12.0**](https://github.com/cofin/litestar-queues/releases) [**cofin**](https://github.com/cofin) [](https://pypi.org/project/litestar-queues/) [](https://pypi.org/project/litestar-queues/) [](https://github.com/cofin/litestar-queues/blob/main/LICENSE) [](https://github.com/cofin/litestar-queues/actions/workflows/ci.yml) [](https://cofin.github.io/litestar-queues/) Litestar Queues lets a Litestar application persist work, run it in a worker, and inspect the result. Use it for work that should outlive the request that started it: sending email, importing files, refreshing reports, or calling a slow service. ## Quickstart Install the package: ``` pip install litestar-queues ``` Create `**app.py**`: ``` from litestar import Litestar, post from litestar.di import NamedDependency from litestar_queues import QueueConfig, QueuePlugin, QueueService, task @task("accounts.sync", queue="accounts", timeout=30) async def sync_account(account_id: str) -> dict[str, str]: return {"account_id": account_id, "status": "synced"} @post("/accounts/{account_id:str}/sync") async def create_sync_job( account_id: str, queue_service: NamedDependency[QueueService] ) -> dict[str, str]: result = await queue_service.enqueue(sync_account, account_id) return {"task_id": str(result.id), "status": result.status or "pending"} app = Litestar( route_handlers=[create_sync_job], plugins=[QueuePlugin(config=QueueConfig())], ) ``` Run the application: ``` LITESTAR_APP=app:app litestar run --reload ``` Enqueue a task: ``` curl -X POST http://127.0.0.1:8000/accounts/acct-123/sync ``` The response contains a task ID and an initial status: ``` {"task_id": "...", "status": "pending"} ``` By default, `**QueueConfig()**` starts a dedicated worker process alongside the server and uses an ephemeral SQLite database. The database is removed on normal shutdown and does not persist across restarts. ## Production boundary The default setup uses a temporary SQLite database and a local worker to get started quickly. In production, decouple task storage from execution: - **Storage**: Use Redis, Valkey, SQLSpec, or Advanced Alchemy so tasks persist across deploys and restarts. - **Workers**: Run standalone worker processes or Cloud Run jobs so background work scales independently from web requests. ## Next steps - [Start here](https://cofin.github.io/litestar-queues/getting_started/index.html) - [Understand the model](https://cofin.github.io/litestar-queues/usage/concepts.html) - [Follow a how-to guide](https://cofin.github.io/litestar-queues/usage/index.html) - [Choose backends](https://cofin.github.io/litestar-queues/usage/backends.html) - [Run an example](https://cofin.github.io/litestar-queues/examples/index.html) - [Browse the API reference](https://cofin.github.io/litestar-queues/reference/index.html) Litestar Queues supports Python 3.10 through 3.14 and is licensed under MIT. --- - **Page:** Litestar MCP · Litestar Plugins - **Source:** https://litestar.dev/plugins/litestar-mcp - **Description:** Litestar plugin for Model Context Protocol (MCP) integration #  Litestar MCP Litestar plugin for Model Context Protocol (MCP) integration [**6K downloads**](https://pypistats.org/packages/litestar-mcp)• [**13 stars**](https://github.com/cofin/litestar-mcp)• [**v0.16.0**](https://github.com/cofin/litestar-mcp/releases) [**cofin**](https://github.com/cofin) A lightweight plugin that integrates Litestar web applications with the Model Context Protocol (MCP) by exposing marked routes as MCP tools, resources, and prompts over MCP Streamable HTTP and JSON-RPC. [](https://pypi.org/project/litestar-mcp/) [](https://pypi.org/project/litestar-mcp/) [](https://opensource.org/licenses/MIT) ## Overview This plugin automatically discovers Litestar routes marked for MCP and exposes them through an MCP-native transport surface. Pass `**mcp_tool="name"**`, `**mcp_resource="name"**`, or `**mcp_prompt="name"**` straight through to `**@get**` / `**@post**` / etc. — Litestar funnels unknown kwargs into `**handler.opt**`, so no second decorator or `**opt={...}**` wrapper is needed. Standalone prompt callables that are not bound to an HTTP route can be registered through `**LitestarMCP(prompts=[...])**`. ## Features - **Protocol-Native Transport** — MCP Streamable HTTP with JSON-RPC requests and SSE streams. - **Three MCP Primitives** — tools, resources, *and* prompts, with `**prompts/list**` and `**prompts/get**` driven by the same handler discovery as the rest of the surface. - **Simple Route Marking** — pass `**mcp_tool**` / `**mcp_resource**` / `**mcp_prompt**` kwargs straight through to Litestar's route decorators, or register standalone prompts via `**LitestarMCP(prompts=[...])**`. - **RFC 6570 URI Templates** — `**mcp_resource_template="app://…/{var}"**` dispatches concrete URIs to handlers with extracted vars. - **First-Class Descriptions** — structured `**mcp_description**`, `**mcp_agent_instructions**`, `**mcp_when_to_use**`, `**mcp_returns**` kwargs. - **Type Safe** — full type hints with dataclasses; `**msgspec**`-powered tool-argument validation. - **Automatic Discovery** — routes are discovered at app initialization. - **OpenAPI Integration** — server info derived from OpenAPI config. - **Bring Your Own Auth** — MCP inherits the app's Litestar authentication middleware, including litestar-security or a custom `**AbstractAuthenticationMiddleware**`. - **Optional Task Support** — the MCP Tasks extension with Litestar Store records; applications coordinate execution across workers. - **Optional MCP Skills** — serve Agent Skills from static filesystem folders or dynamic, request-aware `**SkillSource**` backends through the `**io.modelcontextprotocol/skills**` extension with SHA-256 manifests. - **Optional A2A 1.0** — official SDK models and handlers on native Litestar JSON-RPC/SSE routes, without required Starlette, FastAPI or Uvicorn dependencies. ## Quick Start ### Installation ``` pip install litestar-mcp # or uv add litestar-mcp ``` ### Basic Usage ``` from litestar import Litestar, get, post from litestar.openapi.config import OpenAPIConfig from litestar_mcp import LitestarMCP # Mark routes for MCP exposure using the opt attribute @get("/users", mcp_tool="list_users") async def get_users() -> list[dict]: """List all users in the system.""" return [{"id": 1, "name": "Alice"}, {"id": 2, "name": "Bob"}] @post("/analyze", mcp_tool="analyze_data") async def analyze_data(data: dict) -> dict: """Analyze the provided data and return insights.""" return {"result": f"Analyzed {len(data)} items"} @get("/config", mcp_resource="app_config") async def get_app_config() -> dict: """Get the current application configuration.""" return {"debug": True, "version": "1.0.0"} # Add the MCP plugin to your Litestar app app = Litestar( route_handlers=[get_users, analyze_data, get_app_config], plugins=[LitestarMCP()], openapi_config=OpenAPIConfig(title="My API", version="1.0.0"), ) ``` ### Standalone Application (Alternative) If you are building a standalone MCP server, you can use the `**MCP**` class which provides a simplified declarative API and programmatically boots the server using the standard Litestar CLI: ``` from litestar_mcp import MCP # 1. Initialize the application mcp = MCP("my-mcp-server", instructions="Exposes utility tools.") # 2. Register tools, resources, or prompts using decorators @mcp.tool() def add(a: int, b: int) -> int: """Calculate the sum of two integers.""" return a + b # 3. Expose the app globally so that the CLI can discover it app = mcp.app if __name__ == "__main__": # 4. Boot the modern Streamable HTTP server mcp.run(transport="streamable-http", port=8000) ``` The standalone decorators accept Litestar route-handler keyword arguments such as `**dependencies**`, `**guards**`, `**response_headers**`, `**responses**`, `**summary**`, `**tags**`, DTO options, hooks, and arbitrary extra kwargs stored in `**handler.opt**`. The `**name**` keyword names the MCP primitive; use `**route_name**` to set Litestar's route-handler name separately. ### With Configuration ``` from litestar_mcp import LitestarMCP, MCPConfig config = MCPConfig( base_path="/api/mcp", # Change the base path name="Custom Server Name", # Override server name include_in_schema=True, # Include MCP routes in OpenAPI schema ) app = Litestar( route_handlers=[get_users, analyze_data, get_app_config], plugins=[LitestarMCP(config)], openapi_config=OpenAPIConfig(title="My API", version="1.0.0"), ) ``` ## Resources vs Tools: When to Use Each ### Use Resources (`**mcp_resource**`) for - **Read-only data** that AI models need to reference - **Static or semi-static information** like documentation, schemas, configurations - **Data that doesn't require parameters** to retrieve - **Reference material** that AI models should "know about" **Examples:** ``` @get("/schema", mcp_resource="database_schema") async def get_schema() -> dict: """Database schema information.""" return {"tables": ["users", "orders"], "relationships": [...]} @get("/docs", mcp_resource="api_docs") async def get_documentation() -> dict: """API documentation and usage examples.""" return {"endpoints": [...], "examples": [...]} ``` ### Use Tools (`**mcp_tool**`) for - **Actions that perform operations** or mutations - **Dynamic queries** that need input parameters - **Operations that change state** in your application - **Computations or data processing** tasks **Examples:** ``` @post("/users", mcp_tool="create_user") async def create_user(user_data: dict) -> dict: """Create a new user account.""" # Perform user creation logic return {"id": 123, "created": True} @get("/search", mcp_tool="search_data") async def search(query: str, limit: int = 10) -> dict: """Search through application data.""" # Perform search with parameters return {"results": [...], "total": 42} ``` ## How It Works 1. **Route Discovery**: At app initialization, the plugin scans all route handlers for the `**opt**` attribute 2. **Automatic Exposure**: Routes marked with `**mcp_tool**` or `**mcp_resource**` are automatically exposed 3. **MCP Transport**: The plugin adds a Streamable HTTP MCP endpoint under the configured base path (default `**/mcp**`) 4. **Server Info**: Server name and version are derived from your OpenAPI configuration ## MCP Endpoints Once configured, your application exposes these MCP-compatible endpoints: - `**POST /mcp**` - stateless MCP `**2026-07-28**` JSON-RPC and subscription streams - `**litestar --app my_app:app mcp stdio**` - in-process stdio for desktop clients - `**litestar mcp bridge**` - stdio proxy to a running Streamable HTTP server Install `**litestar-mcp[a2a]**` to mount an official A2A SDK request handler and agent card independently of MCP. The adapter accepts A2A 1.0 JSON-RPC requests with `**A2A-Version: 1.0**`; it rejects missing/legacy versions and offers no 0.3 conversion, gRPC or REST binding. Applications supply authentication, durable stores, executor resource scopes, worker coordination and push delivery policy. See the [A2A guide](https://cofin.github.io/litestar-mcp/latest/usage/a2a.html). Use `**server/discover**` instead of an initialize handshake: ``` curl -X POST http://127.0.0.1:8000/mcp \ -H 'Content-Type: application/json' \ -H 'MCP-Protocol-Version: 2026-07-28' \ -H 'Mcp-Method: server/discover' \ -d '{"jsonrpc":"2.0","id":1,"method":"server/discover","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientCapabilities":{},"io.modelcontextprotocol/clientInfo":{"name":"curl","version":"1"}}}}' ``` Every request is independent. There are no protocol sessions, sticky-routing headers, GET/DELETE transport handlers, or SSE replay. MCP IDs must be strings or finite integer-valued numbers. Missing, null, boolean, container or fractional IDs fail before tool execution or stream allocation. Progress streams apply bounded backpressure; slow subscription consumers are completed and disconnected. Shared task Stores persist records but do not distribute task execution or local input/cancel queues. See the [0.14 migration guide](https://cofin.github.io/litestar-mcp/latest/usage/migration_0_14.html) for removed aliases and configuration. **Built-in Resources:** - `**litestar://openapi**` - Your application's OpenAPI schema (always available via `**resources/read**`) ## Configuration Configure the plugin using `**MCPConfig**`: ``` from litestar_mcp import MCPConfig config = MCPConfig() ``` **Configuration Options:** | **Option** | **Type** | **Default** | **Description** | | --- | --- | --- | --- | | `**base_path**` | `**str**` | `**"/mcp"**` | Base path for the MCP Streamable HTTP endpoint | | `**include_in_schema**` | `**bool**` | `**False**` | Whether to include MCP routes in OpenAPI schema | | `**name**` | `**str \| None**` | `**None**` | Override server name. If None, uses OpenAPI title | | `**instructions**` | `**str \| None**` | `**None**` | Server instructions returned to clients from `**server/discover**` | | `**guards**` | `**list[Any] \| None**` | `**None**` | Litestar guards applied to the MCP router | | `**route_opt**` | `**dict[str, Any] \| None**` | `**None**` | Route metadata merged onto the MCP handler, including litestar-security policies | | `**allowed_origins**` | `**list[str] \| None**` | `**None**` | Exact additional Origins; present Origins must be same-origin or allowlisted | | `**include_operations**` | `**list[str] \| None**` | `**None**` | Only expose matching operation names | | `**exclude_operations**` | `**list[str] \| None**` | `**None**` | Exclude matching operation names | | `**include_tags**` | `**list[str] \| None**` | `**None**` | Only expose routes with matching OpenAPI tags | | `**exclude_tags**` | `**list[str] \| None**` | `**None**` | Exclude routes with matching OpenAPI tags | | `**tasks**` | `**bool \| MCPTaskConfig**` | `**False**` | Enable the `**io.modelcontextprotocol/tasks**` extension | | `**skills**` | `**MCPSkillsConfig \| None**` | `**None**` | Serve Agent Skills over MCP from configured directories and/or dynamic `**SkillSource**` providers | | `**opt_keys**` | `**MCPOptKeys**` | `**MCPOptKeys()**` | Rename the `**handler.opt**` keys the plugin reads (`**mcp_tool**`, `**mcp_resource**`, ...) | | `**list_page_size**` | `**int**` | `**100**` | Page size for `**tools/list**`, `**resources/list**`, `**resources/templates/list**`, `**skills/list**`, `**prompts/list**`, and `**resources/directory/read**` | | `**cache_ttl_ms**` | `**int**` | `**0**` | Conservative cache lifetime for discovery/list/resource results | | `**cache_scope**` | `**"private" \| "public"**` | `**"private"**` | Cache sharing policy | | `**subscription_max_streams**` | `**int**` | `**10000**` | Maximum concurrent `**subscriptions/listen**` streams | | `**subscription_keepalive_seconds**` | `**float**` | `**15.0**` | Subscription keepalive interval | | `**subscription_channels**` | `**ChannelsPlugin \| None**` | `**None**` | Optional cross-worker notification fan-out | | `**stream_queue_capacity**` | `**int**` | `**256**` | Bounded subscription and request-progress queues | | `**stream_cleanup_timeout**` | `**float**` | `**5.0**` | Deadline for cooperative response cleanup; expiry is logged | | `**max_blob_bytes**` | `**int \| None**` | `**26214400**` | Maximum raw byte length for base64-embedded blobs; `**None**` disables the cap | | `**before_tool_call**` | `**BeforeToolCallHook \| None**` | `**None**` | Observe each `**tools/call**` before dispatch | | `**after_tool_call**` | `**AfterToolCallHook \| None**` | `**None**` | Observe each `**tools/call**` result, exception, and duration | ## Complete Example ``` from litestar import Litestar, get, post, delete from litestar.openapi.config import OpenAPIConfig from litestar_mcp import LitestarMCP, MCPConfig # Resources - read-only reference data @get("/users/schema", mcp_resource="user_schema") async def get_user_schema() -> dict: """User data model schema.""" return { "type": "object", "properties": { "id": {"type": "integer"}, "name": {"type": "string"}, "email": {"type": "string"} } } @get("/api/info", mcp_resource="api_info") async def get_api_info() -> dict: """API capabilities and information.""" return { "version": "2.0.0", "features": ["user_management", "data_analysis"], "rate_limits": {"requests_per_minute": 1000} } # Tools - actionable operations @get("/users", mcp_tool="list_users") async def list_users(limit: int = 10) -> dict: """List users with optional limit.""" # Fetch users from database return {"users": [{"id": 1, "name": "Alice"}], "total": 1} @post("/users", mcp_tool="create_user") async def create_user(user_data: dict) -> dict: """Create a new user account.""" # Create user logic return {"id": 123, "created": True, "user": user_data} @post("/analyze", mcp_tool="analyze_dataset") async def analyze_dataset(config: dict) -> dict: """Analyze data with custom configuration.""" # Analysis logic return {"insights": [...], "metrics": {...}} # Regular routes (not exposed to MCP) @get("/health") async def health_check() -> dict: return {"status": "healthy"} # MCP configuration mcp_config = MCPConfig( name="User Management API", base_path="/mcp" ) # Create Litestar app app = Litestar( route_handlers=[ get_user_schema, get_api_info, # Resources list_users, create_user, analyze_dataset, # Tools health_check # Regular route ], plugins=[LitestarMCP(mcp_config)], openapi_config=OpenAPIConfig( title="User Management API", version="2.0.0" ), ) ``` ## Authentication Authentication is a **Litestar middleware** concern. Apps with an existing auth middleware get MCP authentication for free — `**request.user**` and `**request.auth**` are populated before tool handlers run. Three integration paths: ### Path A — Bring Your Own Middleware If your Litestar app already ships an `**AbstractAuthenticationMiddleware**` (or Litestar's built-in JWT backends), MCP inherits it automatically: ``` from litestar import Litestar from litestar.middleware import DefineMiddleware from litestar_mcp import LitestarMCP, MCPConfig app = Litestar( route_handlers=[...], plugins=[LitestarMCP(MCPConfig())], middleware=[DefineMiddleware(YourAuthMiddleware)], # MCP gets this for free ) ``` See `**docs/examples/notes/sqlspec/google_iap.py**` for a runnable example. ### litestar-security Use litestar-security for policy evaluation and RFC 9728 protected-resource metadata. Pass route policy metadata with `**MCPConfig(route_opt={"auth": required("api-key")})**`; evaluator failures can emit the required `**WWW-Authenticate**` resource metadata. ### In-process stdio Run `**litestar --app my_app:app mcp stdio**` to serve the application in-process to a desktop MCP client. Use `**mcp bridge**` when the MCP server is already running over Streamable HTTP. Stdio uses native `**Litestar.lifespan()**`. Its `**shutdown_timeout**` bounds request cleanup and shutdown after startup completes; application hooks own bounded, cancellation-safe startup rollback. `**MCPStdioContext.session**` remains an application session. Provide a verified identity for protected tasks; anonymous stdio requests have no owner ID. ## Development ``` # Clone the repository git clone https://github.com/cofin/litestar-mcp.git cd litestar-mcp # Install with development dependencies make install # Run the complete Python quality gate make check-all # Run the pinned MCP 2026-07-28 conformance suite make conformance # Build strict documentation and validate examples make docs make validate-examples validate-uvx validate-pep723 # Run example uv run python docs/examples/hello_world/main.py ``` The conformance target owns Node.js `**24.18.1**` through `**NODE_VERSION**` in the Makefile. When [nodenv](https://github.com/nodenv/nodenv) is available, the target selects that version with `**NODENV_VERSION**`; otherwise it uses the active `**node**`/`**npm**` installation. A local `**.node-version**` is ignored so contributors can use nodenv without changing repository state. The conformance runner reports passed, waived and failed scenarios separately. Its pinned alpha validator has documented task-extension schema waivers in `**tools/ci/run_mcp_conformance.py**`; `**MCP_CONFORMANCE_STRICT=1**` disables those waivers. A waived check is not a protocol pass. ## License MIT License. See [LICENSE](https://github.com/cofin/litestar-mcp/blob/main/LICENSE) for details. ## Contributing Contributions welcome! Please see our [contribution guide](https://github.com/cofin/litestar-mcp/blob/main/docs/contribution-guide.rst) for details. --- - **Page:** Litestar OracleDB · Litestar Plugins - **Source:** https://litestar.dev/plugins/litestar-oracledb - **Description:** Oracle DB plugin for Litestar #  Litestar OracleDB Oracle DB plugin for Litestar [**15 downloads**](https://pypistats.org/packages/litestar-oracledb)• [**4 stars**](https://github.com/litestar-org/litestar-oracledb)• [**v0.2.0**](https://github.com/litestar-org/litestar-oracledb/releases) [**cofin**](https://github.com/cofin)  | **Project** | | **Status** | | --- | --- | --- | | CI/CD | | [](https://github.com/litestar-org/litestar-oracledb/actions/workflows/publish.yml) [](https://github.com/litestar-org/litestar-oracledb/actions/workflows/ci.yml) [](https://github.com/litestar-org/litestar-oracledb/actions/workflows/docs.yml) | | Quality | | [](https://codecov.io/github/litestar-org/litestar-oracledb) [](https://sonarcloud.io/summary/new_code?id=litestar-org_litestar-oracledb) [](https://sonarcloud.io/summary/new_code?id=litestar-org_litestar-oracledb) [](https://sonarcloud.io/summary/new_code?id=litestar-org_litestar-oracledb) [](https://sonarcloud.io/summary/new_code?id=litestar-org_litestar-oracledb) | | Package | | [](https://badge.fury.io/py/litestar) | | Community | | [](https://reddit.com/r/litestarapi) [](https://discord.gg/litestar) [](https://matrix.to/#/#litestar:matrix.org) [](https://blog.litestar.dev) [](https://twitter.com/LitestarAPI) [](https://blog.litestar.dev) | | Meta | | [](https://github.com/litestar-org/litestar-oracledb) [](https://github.com/python/mypy) [](https://spdx.org/licenses/) [](https://github.com/sponsors/litestar-org) [](https://github.com/astral-sh/ruff) [](https://github.com/psf/black) | A barebones Oracle Database plugin for Litestar. This plugin is useful for when you plan to use no ORM or need to manage the Oracle connection separately. ## Usage ### Installation ``` pip install litestar-oracledb ``` ### Example Here is a basic application that demonstrates how to use the plugin. ``` from __future__ import annotations from typing import TYPE_CHECKING from litestar import Controller, Litestar, Request, get from litestar_oracledb import AsyncDatabaseConfig, AsyncPoolConfig, OracleDatabasePlugin if TYPE_CHECKING: from oracledb import AsyncConnection class SampleController(Controller): @get(path="/") async def sample_route(self, request: Request, db_connection: AsyncConnection) -> dict[str, str]: """Check database available and returns app config info.""" with db_connection.cursor() as cursor: await cursor.execute("select 'a database value' a_column from dual") result = await cursor.fetchone() request.logger.info(result[0]) if result: return {"a_column": result[0]} return {"a_column": "dunno"} oracledb = OracleDatabasePlugin( config=AsyncDatabaseConfig( pool_config=AsyncPoolConfig(user="system", password="super-secret", dsn="localhost:1513/FREEPDB1") # noqa: S106 ) ) app = Litestar(plugins=[oracledb], route_handlers=[SampleController]) ``` --- - **Page:** Litestar SAQ · Litestar Plugins - **Source:** https://litestar.dev/plugins/litestar-saq - **Description:** Litestar integration for SAQ # Litestar SAQ Litestar integration for SAQ [**21.7K downloads**](https://pypistats.org/packages/litestar-saq)• [**35 stars**](https://github.com/litestar-org/litestar-saq)• [**v0.8.0**](https://github.com/litestar-org/litestar-saq/releases) [**cofin**](https://github.com/cofin) ## Installation ``` pip install litestar-saq ``` For OpenTelemetry support: ``` pip install litestar-saq[otel] ``` ## Usage Here is a basic application that demonstrates how to use the plugin. ``` from litestar import Litestar from litestar_saq import QueueConfig, SAQConfig, SAQPlugin saq = SAQPlugin( config=SAQConfig( use_server_lifespan=True, queue_configs=[ QueueConfig(name="samples", dsn="redis://localhost:6379/0") ], ) ) app = Litestar(plugins=[saq]) ``` You can start a background worker with the following command now: ``` litestar --app-dir=examples/ --app basic:app workers run Using Litestar app from env: 'basic:app' Starting SAQ Workers ────────────────────────────────────────────────────────────────── INFO - 2023-10-04 17:39:03,255 - saq - worker - Worker starting: Queue