Search by

adachsoft / mcp-contracts

Arkadiusz Adach

Contracts, DTOs, Value Objects, Enums and exceptions for Model Context Protocol (MCP) clients.

Package info

gitlab.com/a.adach/mcp-contracts

Issues

pkg:composer/adachsoft/mcp-contracts

Statistics

Installs: 26

Dependents: 2

Suggesters: 0

Stars: 0

v0.1.0 2026-11-26 16:35 UTC

This package is auto-updated.

Last update: 2026-11-26 15:36:17 UTC


README

MCP Contracts provides the shared PHP types used by Model Context Protocol (MCP) clients. It defines the client interface and the data structures exchanged between applications and MCP servers, without tying consumers to a particular transport implementation.

Features

  • A client interface for listing and invoking MCP tools.
  • Immutable DTOs for MCP servers, tool definitions, tool results, and content items.
  • Value objects for server identifiers and URLs.
  • Typed immutable collections and MCP-specific exceptions.

Requirements

  • PHP 8.3 or later.
  • Composer.

Installation

Install the package with Composer:

composer require adachsoft/mcp-contracts

Usage

Use the shared client contract to keep application services independent of the concrete transport. See the client integration example for a typed service example.

Integration

Implement AdachSoft\McpContracts\Client\McpClientInterface in an MCP client or transport adapter, then inject that implementation into application services. The interface accepts an McpServerDto and returns typed collections and result DTOs. See the client integration example.