Download the PHP package yoanbernabeu/webmcp-bundle without Composer

On this page you can find all versions of the php package yoanbernabeu/webmcp-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package webmcp-bundle

WebMcpBundle

CI Static Analysis PHP 8.2+ Symfony 6.4+

Experimental — Web MCP is a draft specification currently being developed by the W3C Web Machine Learning Community Group. The protocol, the browser APIs, and this bundle's API may change at any time. See the Chrome for Developers blog post for more context.

A Symfony bundle that exposes your controller routes as Web MCP tools using simple PHP attributes. No JavaScript to write.

That's it. The browser AI can now call your API.

What is Web MCP?

Web MCP (Web Model Context Protocol) is an emerging standard, currently in draft at the W3C (Web Machine Learning Community Group), that provides a browser-level API allowing web pages to expose structured tools to AI.

It builds on top of the Model Context Protocol (MCP) created by Anthropic, but targets the browser: instead of server-side integrations, the page itself registers tools via navigator.modelContext.registerTool().

AI browser extensions (like Claude, ChatGPT, etc.) can then:

This turns any web page into an AI-capable endpoint. Instead of the user copy-pasting data between your app and an AI extension, the extension talks directly to your backend.

Example use case: A user browsing your app asks the Claude browser extension "What Italian restaurants are nearby?". The extension sees a search_restaurants tool is available on the page, calls it with {"cuisine": "italian"}, and returns the results in natural language.

You can test and inspect your Web MCP tools with the Model Context Tool Inspector Chrome extension.

Learn more:

Installation

The bundle registers itself automatically via Symfony Flex. The assets:install command copies the bundle's JavaScript runtime to public/bundles/webmcp/.

Usage

Annotate your controllers

Each controller method you want to expose as an MCP tool gets two attributes: #[Route] (with an explicit name:, required) and #[AsWebMcpTool].

Simple GET endpoint

GET with query parameters

Inputs without mapTo are sent as query string parameters for GET requests.

GET with path parameter

mapTo: 'id' maps the input restaurant_id to the route parameter {id}.

POST with JSON body

For non-GET methods, inputs (except path params) are sent as a JSON body with Content-Type: application/json.

Render the JavaScript

Add the Twig function to your template, typically before </body>:

This outputs a <script> tag that registers all tools via navigator.modelContext. If the browser does not support Web MCP, the script does nothing.

Attribute reference

#[AsWebMcpTool]

Placed on a controller method. The method must also have a #[Route] with an explicit name:.

Parameter Type Required Description
name string Yes Unique tool name (duplicates throw at compile time)
description string Yes Tool description visible to the AI
inputs WebMcpInput[] No Input parameters

WebMcpInput

Value object describing a tool input parameter.

Parameter Type Required Default Description
name string Yes Parameter name
type string No 'string' JSON Schema type (string, number, boolean, array)
description string No '' Parameter description visible to the AI
required bool No false Whether the parameter is required
mapTo ?string No null Route parameter name if different from input name (mapTo: 'id' for {id})

Security

The bundle does not handle security. Your existing Symfony security applies as-is:

Rules

Requirements

Contributing

License

MIT


All versions of webmcp-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
symfony/http-kernel Version ^6.4|^7.0|^8.0
symfony/dependency-injection Version ^6.4|^7.0|^8.0
symfony/config Version ^6.4|^7.0|^8.0
symfony/routing Version ^6.4|^7.0|^8.0
twig/twig Version ^3.0|^4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package yoanbernabeu/webmcp-bundle contains the following files

Loading the files please wait ...