# swift-mcp-client

> MCP Client

This repository provides the `MCPServerManager` class for managing multiple MCP server instances, including lifecycle, connection management, and automatic tool discovery, using a JSON configuration file. This repository provides the `MCPServerManager`

## Overview

- **Category:** Developer Tools
- **Language:** Swift
- **Stars:** 0
- **Forks:** 0
- **Owner:** eastlondoner
- **GitHub:** https://github.com/eastlondoner/swift-mcp-client
- **Created:** 2025-01-27T19:09:50+00:00
- **Updated:** 2025-02-19T10:58:37+00:00
- **Source:** https://model-context-protocol.com/clients/swift-mcp-client-model-context-protocol

## Setup

## Setup

1.  Load server configurations from a JSON file using `MCPServersConfig.load(from: configURL)`. 
2.  Create a server manager instance using `MCPServerManager()`. 
3.  Start servers and get available tools using `manager.startServers(from: config)`. 
4.  Get a client instance for a specific server using `manager.getClient("server_name")`. 
5.  Use the client to make tool calls using `client.callTool(toolName: "tool_name", arguments: ["argument_name": "argument_value"])`. 
6.  Stop all servers when done using `manager.stopAll()`.

## Tools

## Available Tools

1.  Multiple Server Management (Start and manage multiple MCP servers simultaneously)
2.  Automatic Tool Discovery (Discovers and provides access to available tools for each server during initialization)
3.  Timeout Handling (Built-in timeout protection for server connection attempts)
4.  Resource Cleanup (Properly closes connections and cleans up resources when stopping servers)
5.  Error Handling (Comprehensive error handling for server startup and connection operations)
