Download the PHP package armature/mcp-analytics without Composer

On this page you can find all versions of the php package armature/mcp-analytics. 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 mcp-analytics

Armature MCP Analytics for PHP

Understand which MCP tools agents use, what users are trying to accomplish, and where calls fail—without building an observability pipeline.

Armature · TypeScript SDK · Python SDK · Go SDK · Agent install

This package integrates with the official experimental PHP MCP SDK, mcp/sdk 0.7.x, on PHP 8.1 and newer.

Install

Create a server in the Armature dashboard, then copy both generated environment values:

EU accounts must use:

Optional only for US: ANALYTICS_INGEST_URL can be omitted because the SDK defaults to the US endpoint. Required for EU: the URL is required and must be: https://eu.armature.tech/api/mcp-analytics/ingest. Never commit a real ingest key.

Instrument a stdio server

Call Analytics::instrument() before adding or discovering tools:

The instrumentation covers manual tools, explicit Builder::add(...) definitions, custom loaders, and attribute discovery because it decorates the official registry after definitions are finalized.

mcp/sdk 0.7 accepts closures, class/method pairs, and invokable class strings (not invokable object instances). Adapt a bare named function or invokable object with Closure::fromCallable(...) before passing it to addTool().

Streamable HTTP

Add the analytics PSR-15 middleware after authentication middleware and keep the official transport defaults. If the application does not already provide PSR-17 factories and a PSR-7 server-request creator, install one implementation:

For example:

The middleware retains only the request headers and scalar authentication attributes needed for attribution. It never reads the request body or changes the request/response.

Use awaited delivery for PHP-FPM, Lambda, and other request-scoped runtimes. This is the default. Deferred delivery is accepted only with an explicit SchedulerInterface that guarantees the task will run:

The SDK does not call fastcgi_finish_request() and does not pretend work will survive after a request unless the host provides that guarantee.

How telemetry reaches tools

For a normal tool, the public input schema receives an optional top-level telemetry object:

The SDK removes this field before the customer handler runs. All fields are optional. Agents should include agent_thinking on each call and include user_intent/user_frustration only on the first call after a new user message.

Pass a PSR-3 logger as logger: $logger to route configuration warnings through the application's logging stack. Without one, the SDK uses the PHP error log. Warning context never includes tool arguments or credentials.

There are three ownership modes:

Mode Public schema Customer handler Armature export
Injected SDK adds optional telemetry Telemetry removed Captured
Owned Customer already declares telemetry Untouched Not captured
Scrub Capture disabled; public schema unchanged Cached telemetry removed Not captured

Scrub mode uses a private validation schema so stale clients can still send their cached telemetry field even when a strict customer schema has additionalProperties: false.

Disable all conversation-derived capture while keeping safe handler cleanup with:

Privacy and delivery

Before transmission, the SDK:

  1. traverses values within a bounded budget;
  2. removes MCP image/audio/blob payloads and large base64 strings;
  3. redacts high-confidence credentials and sensitive field names;
  4. applies an optional field-level redact callback;
  5. applies an optional whole-event redactEvent callback;
  6. serializes and truncates previews on valid UTF-8 boundaries.

Inputs and result previews are bounded to 8 KiB; script source is bounded to 32 KiB. The in-memory queue holds at most 1,000 candidates and emits batches of

  1. The network client uses a five-second timeout and at most two attempts, separated by 100 ms. Only connection failures, timeouts, HTTP 429, and HTTP 5xx are retried.

Analytics delivery and callbacks never fail a customer tool. Use onError only for payload-free operational diagnostics. For cross-language API parity, the second callback argument is the already finalized, sanitized batch; do not log or re-export it:

SDK delivery failures use DeliveryError, whose public diagnostics are errorCode, status, retryable, attempts, and causeClass. The original exception object and message are deliberately not chained into it.

Actor identity

Only a SHA-256 actor id is sent by default. Seed precedence is:

  1. configured actorIdentifier (also emits a bounded identity event);
  2. configured actorId;
  3. authenticated principal request attributes;
  4. the Authorization header;
  5. anonymous.

Do not use telemetry as an authentication or authorization boundary.

Requesting missing capabilities

When a delivery path is configured, the SDK adds an uninstrumented request_capability tool. Agents can use it to report unmet demand when no existing tool can complete the request.

Set requestCapability: false to disable it. With the default setting, a customer tool of the same name wins. With requestCapability: true, a collision throws during build() so the configuration cannot silently drift.

Existing custom registry, handler, or container

The official builder has setters but no corresponding getters. If the application already uses custom instances, pass the same instances when instrumenting:

Supplying a custom registry makes mcp/sdk 0.7 load builder loaders eagerly during build(). Armature also reads and re-registers tools already present in a supplied registry during Analytics::instrument() so they cannot bypass the wrapper. Those operations may therefore change lazy loading to eager loading. Loader failures remain visible and are not hidden.

Low-level recorder

Framework adapters can use Recorder without importing the official MCP SDK:

Set requestId only for a genuine idempotency key. Never pass a connection- local JSON-RPC counter; the SDK mints a unique per-call id automatically.

Verify

Run the package checks:

Against a running Streamable HTTP server, the language-independent doctor can verify the MCP schema and ingest authentication:

Use --skip-ingest for an offline schema check and --json for machine-readable output.

Troubleshooting

License

Apache-2.0.


All versions of mcp-analytics with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
mcp/sdk Version >=0.7.0 <0.8.0
psr/container Version ^1.0 || ^2.0
psr/http-message Version ^1.1 || ^2.0
psr/http-server-handler Version ^1.0
psr/http-server-middleware Version ^1.0
psr/log Version ^1.0 || ^2.0 || ^3.0
symfony/http-client Version ^6.4 || ^7.3 || ^8.0
symfony/uid Version ^5.4 || ^6.4 || ^7.3 || ^8.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 armature/mcp-analytics contains the following files

Loading the files please wait ...