Dext Now Speaks with AI: How a Community Contribution Brought the MCP Server

The open-source community is fascinating. You build a solid foundation, share it with the world, and when you least expect it, you receive a contribution that not only adds an incredible feature but elevates the architectural level of the entire ecosystem.
Recently, we received a monumental Pull Request signed by our colleague and Embarcadero MVP Alessandro Medeiros that natively implements the MCP (Model Context Protocol) in the Dext Framework.
In this article, we will explore what MCP is, the impeccable quality of this Delphi implementation, and how this PR inspired us to rewrite the future of sessions and real-time integrations in Dext.
What is the Model Context Protocol (MCP)?
Section titled “What is the Model Context Protocol (MCP)?”
The Model Context Protocol (MCP) is an open standard that solves one of the biggest current problems with Generative AI: isolation. AIs like Claude are brilliant, but on their own, they don’t have access to your internal database, corporate business rules, or legacy systems.
MCP acts as a universal “serial port”. By spinning up an MCP Server, you tell the AI: “Here are the tools and data you can use”. The AI then begins to actively query and interact with your system in a standardized way.
And now, Dext does this natively in Delphi.
The Implementation: Elegance and Declarative RTTI
Section titled “The Implementation: Elegance and Declarative RTTI”The technical quality of the implementation received in Dext is something worth highlighting. The team didn’t just deliver a simple “wrapper”, but a robust architecture, following the framework’s strict design patterns (oriented towards solid abstractions and low coupling).
To create an AI tool (an MCP Tool) that exposes your Delphi business rule, the declarative approach using the new Dext attributes makes everything absurdly simple:
[MCPTool('gerar-relatorio-texto', 'Gera um relatório de exemplo com múltiplos conteúdos. ' + 'Demonstra o uso de TMCPToolResult.AddContent para resultados ricos.')][MCPParam('titulo', 'Título do relatório', ptString)][MCPParam('linhas', 'Número de linhas de dados de exemplo', ptInteger, False)]function GerarRelatorio(const Args: TJSONObject): TMCPToolResult; virtual;This simple signature is interpreted via RTTI, automatically registered in the TWebHostBuilder and perfectly coexists with the REST endpoints already present on the HTTP server. Furthermore, the implementation covers the protocol’s multiple transports: support for native Stdio channels, SSE (Server-Sent Events), and the innovative HTTP Streamable standard.
The Inspiration: How This Evolves the Dext Framework
Section titled “The Inspiration: How This Evolves the Dext Framework”The beauty of open-source is not only in the code that is delivered but in the inspiration it sparks.
The latest version of the MCP protocol dictates that the Streamable transport model (Post-based with active Stream and state control) supersedes the older model of separate requests for SSE and isolated HTTP POSTs.
Analyzing this wonderful AI-focused implementation, we realized we could bring this same powerful concept to the web core of Dext!
This gave rise to our newest official specification: Spec S23 (Http-Streamable-HTMX).
Inspired by the MCP Streamable Sessions mechanism, we are refactoring the framework’s state control and rendering to work bidirectionally using HTMX. This will allow:
- The Dext HTTP pipeline to send continuous HTML/JSON fragments under a single connection.
- Our S13 specification (Redis Client) to be elevated to support Pub/Sub so telemetry and state (Session ID) can be shared across distributed server instances.
- Complete web applications to be built with less overhead, maximum performance, and zero dependency on complex JavaScript ecosystems.
The PR that came focused on AI has just refactored how Delphi will handle asynchronous HTTP connections in Dext!
Conclusion
Section titled “Conclusion”This integration proves that Delphi, backed by a modern architecture like the Dext Framework, is more alive and ready than ever for the Artificial Intelligence era. With just a few lines of code, you can now transform your legacy systems into powerful context sources for AI Agents.
We deeply thank MVP Alessandro Medeiros for this historic contribution. The foundation is set. What will you connect to AI now?
Did you like the news? Discover the complete project and leave a ⭐ on the Official Dext Repository on GitHub.