Hosting Options

When the Transport property is set to ttHTTP, the MCPServer class may be hosted via an external server framework like ASP.NET Core, via an embedded HTTP server, or in a fully offline mode. The ProcessingMode property should be set according to the type of hosting option used. Possible hosting options are:

The following aspects of class use and behavior are impacted by hosting options:

  • Processing Inbound Requests
  • Authentication
  • Configuration Requirements
  • Connection Security
  • Sending Responses

Embedded Server

Processing Inbound Requests

When functioning in embedded server mode, the component's StartListening method causes the embedded web server to begin listening for inbound MCP requests. The LocalHost and LocalPort fields must be set prior to starting the server.

if (procmode == MCPServerProcessingModes.modeEmbeddedServer) { server.ServerSettings.LocalHost = "localhost"; server.ServerSettings.LocalPort = "80"; server.StartListening(); } The StopListening method disconnects any connected clients and stops listening.

Configuration Requirements

The embedded server's behavior is configured via the ServerSettings property and the ServerCert property. These settings control the local interface and port on which the server listens, as well as the allowed authentication methods.

Authentication

When hosting MCPServer using the embedded web server, the AllowedAuthMethods field determines which authentication schemes the embedded server will allow.

Connection Security

When using the embedded server, the server hosts a plaintext (HTTP) endpoint by default. The ServerCert property is used to enable TLS for secure connections. When ServerCert is set to a TLS certificate, the embedded HTTP server will use and require TLS for inbound HTTPS connections.

Sending Responses

The type of HTTP response generated by the class depends on logic that occurs within events that fire as the class processes requests.

After processing a request, the class automatically sends an HTTP response according to the MCP standard. Errors are reported to the client via HTTP error responses, and success is reported via 200 OK. The contents of the response depend on the specific operation performed.

External Server

Processing Inbound Requests

When functioning in external server mode, the external server framework listens for HTTP requests. The HttpContext object must be passed explicitly to the class to process the request.

Authentication

Authentication occurs outside the scope of MCP SDK when using the external server mode. Prior to passing the Request to the class via ProcessRequest, the incoming request should be authenticated using the appropriate mechanism. For instance, an ASP.NET Core application may require basic or NTLM authentication to access the endpoint where the request will be processed. Once the request has been authenticated through external verification, the Request should be passed to the ProcessRequest method.

Configuration Requirements

External servers may require configuration such that MCP requests can be passed to MCP SDK. The details depend on the framework used to build the external server.

Java Servlets

The server is compatible with standard implementations of HttpServlet, if they pass all requests to the service() method.

Connection Security

When hosting the class via an external server, the security settings in the external server framework determine connection security. The class has no impact on TLS in this processing mode.

Sending Responses

The type of HTTP response generated by the class depends on logic that occurs within events that fire as the class processes requests.

When calling the ProcessRequest method, an HttpResponse object should be passed as a method parameter (as well as the HttpRequest). The class will populate the response object with the status code, headers, and body generated while processing the request. The Java servlet can then use this object to return the response to the connected client.

Offline Mode

Processing Inbound Requests

When functioning in offline mode, the class uses the Request and RequestHeaders properties to read inbound requests. These properties should be set to the request body and headers, respectively, before processing the request by calling the ProcessRequest method with null Request and Response parameters.

In offline mode, the class will not attempt to send a response to clients. Instead, the Response and ResponseHeaders properties are set to the body content and headers, respectively, of the response.

Authentication

Authentication is fully outside the scope of the class when using offline mode. The class will process requests without any direct checks for authentication.

Configuration Requirements

In offline mode, the class is agnostic to any process that occurs prior to setting the Request and RequestHeaders properties, and as such does not require any additional configuration.

Connection Security

In offline mode, the class does not have a live connection to a client, so connection security is not directly relevant to the class's operation.

Sending Responses

The type of HTTP response generated by the class depends on logic that occurs within events that fire as the class processes requests.

After processing a request in offline mode, the class will populate the Response and ResponseHeaders properties with the content of the response. This data can be extracted from these properties and returned to the client using whatever approach is appropriate.

Configuring LLM Clients

When using MCP SDK to build custom MCP servers, the LLM client must be configured to communicate with the MCP server. Most clients support two transport modes for MCP:

  • stdio
  • HTTP/S

This page documents the steps for configuring stdio and HTTP/S communication between common LLM clients like Claude, ChatGPT, and Cursor, and MCP servers built with MCP SDK.

Configuring stdio Transport

In stdio mode, the LLM client starts your MCP server process and keeps it running while the client session is active. The client must know the the absolute path to your MCP server executable and any arguments the server executable requires, typically configured in a JSON file that the client reads at startup.

When using a demo MCP server included with MCP SDK, the demo must be compiled and run before testing with LLM clients so that the executable can be created.

Claude stdio

Claude Desktop uses a JSON config file claude_desktop_config.json that contains (or can contain) an mcpServers object. Each entry defines in this object defines how Claude should start an MCP server as a sub-process.

Example

Below is sample JSON that, if inserted into Claude's claude_desktop_config.json file, will cause Claude to launch one of the demo MCP servers included with MCP SDK:

{ "mcpServers": { "my-custom-server": { "command": "C:/Users/MyUser/Documents/MCP SDK 2026 Delphi Edition/demos/MCP Server Monitor/mcpservermonitor.exe" } } }

If the server executable requires arguments, add an args array within the custom server JSON element.

Cursor stdio

Cursor supports local MCP server over stdio via the mcp.json configuration file that contains (or can contain) an mcpServers object. Each element within mcpServers defines a custom MCP server, and typically includes the command used to launch the server, an args array, and optionally env.

Example

Below is sample JSON that, if inserted into Cursor's mcp.json file, will cause Claude to launch one of the demo MCP servers included with MCP SDK:

{ "mcpServers": { "my-custom-server": { "command": "C:/Users/MyUser/Documents/MCP SDK 2026 Delphi Edition/demos/MCP Server Monitor/mcpservermonitor.exe", "args": [] } } }

VSCode stdio

VSCode supports local MCP server over stdio via the mcp.json configuration file that contains (or can contain) an mcpServers object. This configuration file is created within your VSCode workspace (.vscode/mcp.json). Each element within mcpServers defines a custom MCP server and includes the command used to launch the server and an args array.

Example

Below is sample JSON that, if inserted into VSCode's mcp.json file, will cause Claude to launch one of the demo MCP servers included with MCP SDK:

{ "mcpServers": { "my-custom-server": { "command": "C:/Users/MyUser/Documents/MCP SDK 2026 Delphi Edition/demos/MCP Server Monitor/mcpservermonitor.exe", "args": [] } } }

ChatGPT currently does not support local MCP connections over stdio. Custom MCP servers must use HTTP/S to communicate with ChatGPT's web platform.

Configuring HTTP/S Transport

In HTTP/S mode, your MCP server runs as a network service (local or hosted). The client connects to it using a URL and (optionally) auth headers or OAuth. Your client configuration must include the server URL and any required headers.

Many LLM clients require an HTTPS connection (not HTTP) and that the MCP server has a CA-signed SSL certificate. Signed SSL Certificates are not distributed by /n software.

Claude HTTP/S

Claude Desktop supports remote MCP servers via its Connectors UI (Add Custom Connector), where you provide the URL that Claude can use to connect to an MCP server listening for HTTP requests.

Configuring Claude to work with an MCP server built with MCP SDK depends on URL of the server listening for inbound requests. When using the embedded HTTP server in the MCPServer component, this corresponds to the LocalHost property. When using the MCPServer component with an external HTTP server, the URL depends on this external server rather than anything specific to MCP SDK.

ChatGPT HTTP/S

ChatGPT supports remote MCP servers through Developer Mode by creating a custom 'app' that points to a custom MCP URL. Developer mode must first be enabled, then the 'Apps' setting panel shows a 'Create App' option. The configuration of this app must include the URL over which ChatGPT can send HTTP requests to the MCP server.

Configuring ChatGPT to work with an MCP server built with MCP SDK depends on URL of the server listening for inbound requests. When using the embedded HTTP server in the MCPServer component, this corresponds to the LocalHost property. When using the MCPServer component with an external HTTP server, the URL depends on this external server rather than anything specific to MCP SDK.

Cursor HTTP/S

Cursor supports remote MCP servers in mcp.json. A common remote configuration is an mcpServers entry with a url, plus optional headers.

Example

Below is sample JSON that can be inserted into Cursor's mcp.json file to connect to a custom MCP server over HTTP:

{ "mcpServers": { "my-custom-server": { "url": "https://example.com/mcp", "headers": { "Authorization": "Bearer YOUR_TOKEN" } } } }