API reference

ToolProviderClient Class

Extends IDisposable
Client that connects to the MCP server as a Tool Provider, registering its capabilities (tools, resources, prompts) and handling execution requests.
Tool Providers are the authority for what capabilities are available. On connect, the client discovers local capabilities via LocalExecutor and registers them with the server. The server then serves these capabilities to MCP clients (AI agents) and forwards execution requests back to this provider.
var client = new ToolProviderClient("192.168.1.100", 8090); client.OnRequestExecuted += (method, success) => Debug.Log($"Request: {method}"); await client.ConnectAsync(); // ... later ... client.Disconnect();

Constructors

ToolProviderClient ( serverAddress , serverPort )
Create a new Tool Provider client.
Signature
ToolProviderClient(string serverAddress, int serverPort=8090)
Parameters
serverAddress: string  IP address or hostname of the MCP server (e.g., "192.168.1.100").
serverPort: int  Port number for the MCP HTTP server (default: 8090).

Properties

AccessToken : string
[Get][Set]
The access token for authenticating with the MCP Bridge server.
Must be set before calling ConnectAsync.
Signature
string AccessToken
IsConnected : bool
[Get]
Whether the client is currently connected to the MCP server.
Signature
bool IsConnected
ServerAddress : string
[Get][Set]
The server address this client connects to.
Signature
string ServerAddress
ServerPort : int
[Get][Set]
The server port this client connects to.
Signature
int ServerPort
ServerUrl : string
[Get]
The full server URL.
Signature
string ServerUrl

Events

OnCapabilitiesRegistered : Action
Fired when capabilities have been successfully registered with the server.
Signature
Action OnCapabilitiesRegistered
OnConnectionStateChanged : Action< bool >
Fired when the connection state changes.
Signature
Action<bool> OnConnectionStateChanged
OnError : Action< string >
Fired when an error occurs during execution or connection.
Signature
Action<string> OnError
OnRequestExecuted : Action< string, bool >
Fired when a request has been executed (success or failure).
Parameters: method, success
Signature
Action<string, bool> OnRequestExecuted

Protected Methods

RaiseCapabilitiesRegistered ()
Raise the OnCapabilitiesRegistered event.
For use by derived classes in testing.
Signature
void RaiseCapabilitiesRegistered()
Returns
void
RaiseError ( error )
Raise the OnError event.
For use by derived classes in testing.
Signature
void RaiseError(string error)
Parameters
error: string
Returns
void
RaiseRequestExecuted ( method , success )
Raise the OnRequestExecuted event.
For use by derived classes in testing.
Signature
void RaiseRequestExecuted(string method, bool success)
Parameters
method: string
success: bool
Returns
void
SetConnected ( connected )
Signature
void SetConnected(bool connected)
Parameters
connected: bool
Returns
void

Methods

ConnectAsync ( cancellationToken )
Connect to the MCP server and start listening for requests.
Signature
virtual async Task< bool > ConnectAsync(CancellationToken cancellationToken=default)
Parameters
cancellationToken: CancellationToken  Optional cancellation token.
Returns
async Task< bool >  True if connection was successful, false otherwise.
Disconnect ()
Disconnect from the MCP server.
Signature
virtual void Disconnect()
Returns
void
Dispose ()
Dispose the client and release all resources.
Signature
virtual void Dispose()
Returns
void