MCP Directory
ServersClientsBlog

xASO - App Store Optimization

AI-powered App Store Optimization platform for mobile apps

Go to xASO
MCP Directory

Model Context Protocol Directory

MKSF LTD
Suite 8805 5 Brayford Square
London, E1 0SG

MCP Directory

  • About
  • Blog
  • Documentation
  • Contact

Menu

  • Servers
  • Clients

© 2025 model-context-protocol.com

The Model Context Protocol (MCP) is an open standard for AI model communication.
Powered by Mert KoseogluSoftware Forge
  1. Home
  2. Clients
  3. swift-mcp-client

swift-mcp-client

GitHub

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`

0
0

Server Management

The MCPServerManager class offers a streamlined approach to managing multiple MCP server instances, encompassing server lifecycle, connection management, and tool discovery.

Usage

The code snippet illustrates loading server configurations from a servers.json file using MCPServersConfig.load. A MCPServerManager instance is created to start servers, yielding a dictionary mapping server names to their discovered tools. A client instance for a specific server (e.g., "filesystem") is retrieved to execute tool calls, exemplified by listing a directory. Finally, manager.stopAll() halts all servers.

The servers.json example demonstrates configuring a server with its command, arguments, and environment variables.

Key Features

  • Multiple Server Management: Enables simultaneous startup and management of multiple MCP servers.
  • Automatic Tool Discovery: Automatically identifies and provides access to each server's available tools upon initialization.
  • Timeout Handling: Incorporates timeout mechanisms for server connection attempts.
  • Resource Cleanup: Ensures proper connection closure and resource cleanup during server shutdown.
  • Error Handling: Provides robust error handling for server startup and connection processes.

Configuration

MCPServersConfig allows specifying server configurations in a JSON file, loaded via the load function. Configurations include the server executable, command-line arguments, and environment variables. Each server is uniquely identified by a name used for client retrieval. Server startup failures propagate as an MCPError, halting the startup process.

Repository

EA
eastlondoner

eastlondoner/swift-mcp-client

Created

January 27, 2025

Updated

February 19, 2025

Language

Swift

Category

Developer Tools