Tcl Requires Chilkat v11.6.0+
Tcl
Configure MCP Connection Settings
See more MCP Client Examples
Demonstrates Mcp.SetConnectionSettings, which copies connection settings -- such as an HTTP proxy, SOCKS proxy, bind IP address, and TLS options -- from a Socket and applies them before connecting.
Background. This is optional; if not used, a direct connection is made. It is useful when the MCP server must be reached through a proxy or with specific TLS settings.
Chilkat Tcl Downloads
load ./chilkat.dll
set success 0
set mcp [new_CkMcp]
# Configure connection settings on a Socket -- such as an HTTP proxy, SOCKS proxy, bind IP address,
# or TLS options -- and apply them to the MCP client before connecting. This is optional; if not
# used, a direct connection is made.
set sock [new_CkSocket]
CkSocket_put_HttpProxyHostname $sock "proxy.example.com"
CkSocket_put_HttpProxyPort $sock 8080
set success [CkMcp_SetConnectionSettings $mcp $sock]
if {$success == 0} then {
puts [CkMcp_lastErrorText $mcp]
delete_CkMcp $mcp
delete_CkSocket $sock
exit
}
set success [CkMcp_Connect $mcp "https://learn.microsoft.com/api/mcp"]
if {$success == 0} then {
puts [CkMcp_lastErrorText $mcp]
delete_CkMcp $mcp
delete_CkSocket $sock
exit
}
puts "Connected using the configured connection settings."
delete_CkMcp $mcp
delete_CkSocket $sock