Table of Contents

Getting started with MCP Transports

This page covers assigning a transport to a server, the one that needs no configuration at all, and how Start, Run, and Stop relate. For the full comparison and the HTTP options see the user guide.

Prerequisites

  • Delphi 11 Alexandria or newer (or C++Builder) with TMS AI Studio installed.
  • A TTMSMCPServer with at least one tool. See MCP Server.
  • For the HTTP transports, a free port and — in production — a certificate.

Add the unit for the transport you want: TMS.MCP.Transport.STDIO, TMS.MCP.Transport.NamedPipe, TMS.MCP.Transport.SSE, or TMS.MCP.Transport.StreamableHTTP. TMS.MCP.Transport holds the base class.

The default: no transport at all

A server with no Transport assigned uses STDIO. That is not a placeholder — it is the right answer for the most common first deployment, where a desktop AI assistant launches your executable and speaks to it over the pipe it already owns. Nothing to configure, no port, no certificate.

Assigning a transport explicitly

Create the transport, set its properties, assign it to Server.Transport, then start the server:

procedure TServerApp.Run;
var
  Server: TTMSMCPServer;
  Transport: TTMSMCPStdioTransport;
begin
  Server := TTMSMCPServer.Create(nil);
  try
    Server.ServerName := 'InventoryServer';
    Server.ServerVersion := '1.0.0';
    RegisterTools(Server);

    Transport := TTMSMCPStdioTransport.Create(Server);
    Server.Transport := Transport;

    Server.Start;

    { Blocks, pumping messages until stdin closes. }
    Transport.Run;
  finally
    Server.Free;
  end;
end;

Create the transport with the server as owner and it is freed with the server.

Start, Run, and Stop

Three methods, with distinct jobs:

Method Does
Server.Start Brings the transport up and begins accepting messages.
Transport.Run Blocks, pumping messages until the transport ends.
Transport.ProcessMessages Pumps whatever is pending and returns.
Server.Stop Shuts the transport down.

A console or service application calls Run and stays there for its lifetime. A GUI application must not — it would freeze the message loop. There, Start is usually enough, because the networked transports pump on their own worker threads; call ProcessMessages from a timer only if a transport needs driving.

Running reports whether the transport is up.

Check it works

Start the application and connect a client. If the client lists your tools, the transport is carrying traffic. If it cannot connect at all, the problem is almost always the transport rather than the server — a port in use, a pipe name mismatch, or a certificate the client will not accept.

See also