# MARS-Curiosity > MARS-Curiosity: REST library for Delphi, server and client. JAX-RS style resources, JWT, OpenAPI 3, FireDAC, server-sent events, MCP servers for AI agents; Windows and Linux. MARS-Curiosity is an open source (MPL 2.0) library to build REST servers and clients with Embarcadero Delphi. Source code, releases and demos: https://github.com/andrea-magni/MARS ## Guide - [Introduction](https://andrea-magni.github.io/MARS/guide/introduction.md): MARS-Curiosity is a lightweight, Delphi-native library for building RESTful web services and the clients that consume them. It supports Delphi 10.4 Sydney up to 13 Florence and runs on Windows and Linux. - [Why MARS?](https://andrea-magni.github.io/MARS/guide/why-mars.md): Why choose MARS-Curiosity for REST APIs in Delphi: JAX-RS style declarative resources, server and client in one library, FireDAC datasets, JWT, OpenAPI 3, MCP servers for AI agents, Indy or Delphi Cross Socket, Windows and Linux. - [Installation](https://andrea-magni.github.io/MARS/guide/installation.md): MARS-Curiosity can be installed with the executable installer (recommended), with TMS Smart Setup, or manually from sources. - [Your First Server](https://andrea-magni.github.io/MARS/guide/getting-started.md): This walkthrough builds a minimal MARS server from scratch and explains every moving part. The same structure is what MARSCmd generates and what the MARSTemplate demo contains. - [Core Concepts](https://andrea-magni.github.io/MARS/guide/core-concepts.md): MARS has a small number of concepts that, once understood, explain everything else. This page is the mental model; the Server section covers each in depth. - [Deployment](https://andrea-magni.github.io/MARS/guide/deployment.md): Deploy a MARS-Curiosity REST server built with Delphi - Windows service, Linux with systemd, Docker, nginx or IIS reverse proxy, HTTPS, IIS ISAPI, Apache and FastCGI, production checklist. - [AI Agent Skills](https://andrea-magni.github.io/MARS/guide/agent-skills.md): Agent Skills that teach Claude Code and other AI coding agents to scaffold, develop and secure MARS-Curiosity REST servers in Delphi: installation as a plugin, with npx or by hand, and usage examples. - [FAQ](https://andrea-magni.github.io/MARS/guide/faq.md): Frequently asked questions about MARS-Curiosity, the Delphi REST library: creating a REST server in Delphi, JSON, JWT authentication, OpenAPI, FireDAC, CORS, HTTPS, Linux and Docker, REST clients, server-sent events, MCP servers for AI agents. ## Server - [Engine](https://andrea-magni.github.io/MARS/server/engine.md): The engine (IMARSEngine, implemented by TMARSEngine in MARS.Core.Engine.pas) is the top of the server hierarchy. It owns global configuration, holds the applications, and routes every incoming HTTP request to the right application and resource. You create exactly one engine per process. - [Applications](https://andrea-magni.github.io/MARS/server/application.md): An application (IMARSApplication, implemented by TMARSApplication) groups related resources under a base path and carries its own configuration. An engine can host several applications — for example a public API at /api and an admin API at /admin. - [Resources & Methods](https://andrea-magni.github.io/MARS/server/resources.md): A resource is an ordinary Delphi class decorated with [Path]. Its public methods, decorated with HTTP-verb attributes, are your endpoints. Resources are instantiated per request — a fresh instance is created, used, and freed within a single activation, so they are inherently thread-safe with... - [Attributes](https://andrea-magni.github.io/MARS/server/attributes.md): Attributes are how you describe endpoints in MARS. They live mainly in MARS.Core.Attributes.pas (with more in MARS.Metadata.Attributes.pas, MARS.Core.JSON.pas and the data units). This page groups them by purpose; see Reference ▸ Attributes for a compact cheat-sheet. - [Parameters & Injection](https://andrea-magni.github.io/MARS/server/injection.md): How MARS-Curiosity fills resource fields and method parameters: path, query, header, cookie, form and body binding, [Context] injection of request, token and configuration, and custom injection services. - [Content Negotiation](https://andrea-magni.github.io/MARS/server/content-negotiation.md): How MARS-Curiosity chooses message body readers and writers from Accept and Content-Type, the built-in JSON, XML, dataset and stream writers, and how to register your own. - [Request Lifecycle](https://andrea-magni.github.io/MARS/server/request-lifecycle.md): Every request is handled by a TMARSActivation (MARS.Core.Activation.pas), exposed to your code as IMARSActivation. Understanding its phases explains where authorization, injection, serialization and hooks happen — and where you can plug in. - [Error Handling](https://andrea-magni.github.io/MARS/server/error-handling.md): When a resource method raises, MARS turns the exception into an HTTP response. You control the status code, content type and body either by raising the right exception type or by handling errors centrally with an invoke-error hook. The exception types live in MARS.Core.Exceptions.pas. ## Features - [Authentication (JWT)](https://andrea-magni.github.io/MARS/features/authentication.md): JWT authentication in MARS-Curiosity: the token resource, credential validation, Bearer header or cookie, key rotation, token renewal and the JWT backends. - [Authorization](https://andrea-magni.github.io/MARS/features/authorization.md): Once a request is authenticated, MARS decides whether it is allowed to run the selected method. Authorization is declarative: you annotate resources and methods, and the activation enforces the rules before your code runs. - [FireDAC & Datasets](https://andrea-magni.github.io/MARS/features/firedac.md): MARS has deep, first-class support for FireDAC: a resource method can return a TFDDataSet (or an array of them) and MARS serializes it to JSON automatically; clients can send back the changed rows (a delta) and the server applies the updates. This makes Delphi-to-Delphi, data-aware REST servers... - [JSON Serialization](https://andrea-magni.github.io/MARS/features/serialization.md): MARS maps Delphi values to and from JSON through the helpers in MARS.Core.JSON.pas. In day-to-day use you simply return records/objects/arrays and accept them as [BodyParam] — the content-negotiation layer does the rest. This page covers the conversion rules and how to customize them. - [OpenAPI 3 & Swagger](https://andrea-magni.github.io/MARS/features/openapi.md): MARS can generate an OpenAPI 3 specification for an application directly from your resources — no hand-written YAML. It reflects over the registered resources, methods, parameters, return types and authorization rules to build a TOpenAPI document (MARS.OpenAPI.v3.pas), which you expose as JSON... - [Server-Sent Events](https://andrea-magni.github.io/MARS/features/sse.md): Server-Sent Events (SSE) let a server push a stream of events to a client over a single, long-lived HTTP connection. MARS supports SSE on both ends: a resource method returns a TMARSServerSideEvent that writes events for as long as the client stays connected, and the client consumes them with... - [MCP Servers (AI Agents)](https://andrea-magni.github.io/MARS/features/mcp.md): Model Context Protocol (MCP) is the open standard that lets AI agents (Claude, Claude Code, ChatGPT, Copilot and many others) discover and call tools exposed by a server. MARS ships first-class MCP support: derive a resource from TMCPResource, mark methods with [MCPTool], and any MARS server... - [HTML & Templates](https://andrea-magni.github.io/MARS/features/templates.md): MARS is not only for JSON APIs — it can serve HTML, static files and server-rendered pages. This is handy for admin panels, landing pages, dashboards, or hypermedia front-ends (htmx). Several integrations are available; pick the one that fits your stack. - [Request/Response Logging](https://andrea-magni.github.io/MARS/features/logging.md): MARS can log every request and response by plugging into the global activation hooks. A logger registers BeforeInvoke, AfterInvoke and InvokeError handlers during ignition and writes an entry for each phase, so you get incoming requests, completed responses (with timing) and errors without... ## Client - [Client Overview](https://andrea-magni.github.io/MARS/client/overview.md): MARS ships a complete client library for consuming REST services from Delphi. It works against any REST server, with extra conveniences when the server is MARS (JSON ↔ record mapping, JWT handling, FireDAC dataset sync). - [Components](https://andrea-magni.github.io/MARS/client/components.md): The MARS client is component-based, so you can build a consumer visually. After installing the MARSClient.CoreDesign (and MARSClient.FireDACDesign) packages, the components appear on the MARS-Curiosity Client palette page. - [Calling Resources](https://andrea-magni.github.io/MARS/client/resources.md): This page covers how to issue requests with the client resource components: HTTP verbs, passing path/query parameters, JSON record mapping, streams, and asynchronous calls. - [Client Authentication](https://andrea-magni.github.io/MARS/client/authentication.md): TMARSClientToken performs the login handshake against a server token resource and holds the resulting JWT. Resources that reference the token component automatically send it on every request. - [FireDAC Client](https://andrea-magni.github.io/MARS/client/firedac.md): When the server exposes FireDAC datasets, the client can fetch them into live TFDMemTables, let the user edit them, and post the changes back as a delta. This gives you a near-classic data-aware experience over REST. The component is TMARSFDResource (MARS.Client.FireDAC.pas), installed by the... - [Client Logging](https://andrea-magni.github.io/MARS/client/logging.md): Every request sent by a MARS client, and the response it gets, can be logged: verb, URL, headers, bodies, status, duration and exception. It works the same way with TMARSNetClient, TMARSHttpClient and TMARSIndyClient, and costs nothing when nobody is listening. ## Reference - [Attributes Reference](https://andrea-magni.github.io/MARS/reference/attributes.md): A compact cheat-sheet of MARS attributes. See Server ▸ Attributes for explanations and examples. Unless noted, attributes are in MARS.Core.Attributes. - [Media Types Reference](https://andrea-magni.github.io/MARS/reference/media-types.md): TMediaType (MARS.Core.MediaType) defines constants for the common MIME types used in [Produces] / [Consumes] and content negotiation. Prefer these constants over string literals. - [Configuration Parameters](https://andrea-magni.github.io/MARS/reference/parameters.md): MARS configuration is a name/value store (TMARSParameters) available at the engine and application levels. Values are typically loaded from an .ini file next to the executable with FEngine.Parameters.LoadFromIniFile, and can be read in code or injected with [[EngineParam] /... ## Demos - [Demos](https://andrea-magni.github.io/MARS/demos/index.md): The Demos folder contains ready-to-run projects, each focused on a specific MARS feature. Open the project group, build, and run the server (most also include a client and a test project). Below is what each one teaches, with a representative snippet. - [Tailwind CSS for Delphi developers](https://andrea-magni.github.io/MARS/demos/tailwindcss-tutorial.md): A beginner's guide to styling MARS web apps. ## More - [Release Notes](https://andrea-magni.github.io/MARS/release-notes.md): What changed in each MARS-Curiosity release, newest first. Each entry is a one-liner with a link to the documentation, the demo or the issue; the GitHub release has the full notes, upgrade notes included.