MCP ExplorerExplorer

Mcputils

@phimageon 5 days ago
2 MIT
FreeCommunity
AI Systems
Some utilities to play with MCP

Overview

What is Mcputils

MCPUtils is a framework designed to facilitate interaction with Model Context Protocol (MCP) tools from various sources, including Claude Desktop and VS Code. It provides configuration management, tool loading, integration with Apple’s Foundation Models, and logging support.

Use cases

MCPUtils can be utilized by developers to easily load and manage tools for various MCP servers, automate interactions, and seamlessly integrate with Apple’s Foundation Models framework for enhanced AI capabilities in applications.

How to use

To use MCPUtils, import the framework and create a logger. Utilize the ToolService to load available tools, specifying whether you want to load from Claude or VS Code. The loaded tools can then be accessed and utilized with Apple’s Foundation Models.

Key features

Key features of MCPUtils include configuration management for easy loading of server configurations, automatic discovery and loading of tools from configured MCP servers, integration with Foundation Models, and configurable logging for debugging and monitoring.

Where to use

MCPUtils is applicable in macOS development environments, particularly for applications that require advanced tool management and integration with AI models, helping developers effectively work with MCP tools and improve their application functionalities.

Content

MCPUtils - Model Context Protocol Utilities Framework

MCPUtils allow to get MCP tools from various sources.

Overview

This framework provides:

  • Configuration Management: Load MCP server configurations from Claude Desktop and VS Code
  • Tool Loading: Automatically discover and load tools from configured MCP servers
  • Foundation Models Integration: Seamless integration with Apple’s Foundation Models framework
  • Logging Support: Configurable logging throughout the framework

Usage

import MCPUtils
import Logging

// Create a logger
let logger = Logger(label: "your.app.mcp")

// Create tool service
let toolService = ToolService()

// Load all available tools
let result = await toolService.loadTools(logger: logger)

// Use tools with Foundation Models
for (clientName, tools) in result.tools {
    print("Client: \(clientName)")
    for tool in tools {
        print("  Tool: \(tool.name) - \(tool.description)")
    }
}

Loading Tools from Specific Sources

// Load only Claude MCP tools
let claudeResult = await toolService.loadClaudeMCPTools(logger: logger)

// Load only VS Code MCP tools
let vscodeResult = await toolService.loadVSCodeMCPTools(logger: logger)

Get tools ready for Apple’s FoundationModels

let tools: [any FoundationModels.Tool] = result.foundationModelsTools

Configuration Files

MCPUtils automatically discovers MCP servers from standard configuration locations:

Claude Desktop

  • ~/Library/Application Support/Claude/claude_desktop_config.json

VS Code

  • ~/Library/Application Support/Code/User/settings.json
  • .vscode/settings.json (workspace-specific)

Requirements

  • macOS 26.0+
  • Swift 6.2+

Tools

No tools

Comments