PHPackages                             tourze/mcp-contracts - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. tourze/mcp-contracts

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

tourze/mcp-contracts
====================

MCP契约

1.0.0(8mo ago)0661MITPHPCI passing

Since Jun 26Pushed 6mo agoCompare

[ Source](https://github.com/tourze/mcp-contracts)[ Packagist](https://packagist.org/packages/tourze/mcp-contracts)[ RSS](/packages/tourze-mcp-contracts/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (3)Versions (3)Used By (1)

MCP Contracts
=============

[](#mcp-contracts)

[English](README.md) | [中文](README.zh-CN.md)

[![Latest Version](https://camo.githubusercontent.com/44dc27b71815e681a7b89b703b16465f5623e17c2083b02eee08251b6ca2ca35/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f75727a652f6d63702d636f6e7472616374732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/mcp-contracts)[![Build Status](https://camo.githubusercontent.com/be61f1026b7be5f996bd2aebb9be2eb1e53139f392ecc64d5c87d7dcec3dddd7/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f746f75727a652f6d63702d636f6e7472616374732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/tourze/mcp-contracts)[![Quality Score](https://camo.githubusercontent.com/e56169a2408a17d3af7b9a0765729e3fa982013fcc05c1ec3196ceb4046e5fef/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f746f75727a652f6d63702d636f6e7472616374732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/tourze/mcp-contracts)[![Total Downloads](https://camo.githubusercontent.com/6678fbf8e64f220b06f2d6763d442578433430f19e8a7d86322d9c6549d9e5b8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f75727a652f6d63702d636f6e7472616374732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/mcp-contracts)

A PHP library providing contracts and interfaces for MCP (Model Context Protocol) tools integration, designed for Symfony applications.

Features
--------

[](#features)

- **Tool Interface**: Defines standard interface for MCP tools
- **Attribute Support**: Provides `AsTool` attribute for tool registration
- **Symfony Integration**: Built-in support for Symfony's dependency injection
- **Type Safety**: Full PHP 8.1+ type declarations
- **Extensible**: Easy to extend and customize for specific needs

Installation
------------

[](#installation)

```
composer require tourze/mcp-contracts
```

Quick Start
-----------

[](#quick-start)

### 1. Implement the Tool Interface

[](#1-implement-the-tool-interface)

```
