Search by

Semitexa MCP - a Model Context Protocol server that lets coding agents build and check Semitexa apps

Package info

github.com/semitexa/semitexa-mcp

Type:semitexa-module

pkg:composer/semitexa/mcp

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

2026.12.03.1851 2026-12-03 16:25 UTC

README

A Model Context Protocol server through which a coding agent (Claude Code, Cursor, Claude Desktop) learns a Semitexa project, generates code the framework expects, and checks what it changed.

Install

Not yet part of the installer. Until its first release it is available as dev-master:

composer require --dev semitexa/mcp:dev-master

Purpose

An agent that guesses a framework's conventions writes code that looks right and is not. This package gives the agent the framework's own tools instead: what the project contains, how a page or a module is made here, and the same checks a developer runs before calling a change done.

Connect an agent

The server speaks MCP over stdio and runs only when APP_ENV=dev, because its tools change the project. bin/semitexa mcp starts it in the app container; bin/semitexa mcp:config prints what to give each agent, with this project's path:

claude mcp add semitexa -- "/path/to/project/bin/semitexa" mcp
{"mcpServers": {"semitexa": {"command": "/path/to/project/bin/semitexa", "args": ["mcp"]}}}

The second form is for Cursor (.cursor/mcp.json) and Claude Desktop (claude_desktop_config.json).

Protocol versions 2025-06-18, 2025-03-26 and 2024-11-05 are answered; a client asking for another gets the newest.

Over HTTP, on this machine

For a client that connects only over HTTP, bin/mcp-http.php serves the same server over Streamable HTTP. Start it on the host, from the project root, and leave it running in that terminal:

php vendor/semitexa/mcp/bin/mcp-http.php 127.0.0.1:8765 var/mcp-http.token bin/semitexa mcp

Then, in a second terminal, register it with the client:

claude mcp add --transport http semitexa http://127.0.0.1:8765/mcp \
  --header "Authorization: Bearer $(cat var/mcp-http.token)"

It listens on a loopback address only. The first start writes a random token to the token file (mode 0600). A request is refused before it reaches the server when:

  • its bearer token is missing or wrong;
  • it carries an Origin header, as a request from a web page does;
  • its Host is not that loopback address, as with a DNS name rebound to 127.0.0.1.

It answers POST /mcp, one JSON-RPC message per request. GET is 405: there is no server-to-client stream, so a server's own notifications are dropped. A call the server has not answered within SEMITEXA_MCP_HTTP_TIMEOUT seconds (960 by default) gets an error answer.

Remote, behind a TLS proxy (a trial VM)

--remote serves one tester's trial VM through a TLS proxy (Caddy, nginx) that forwards to the bridge. OAuth is not part of it.

SEMITEXA_MCP_HTTP_HOSTS=mcp.example.com \
  php vendor/semitexa/mcp/bin/mcp-http.php --remote 127.0.0.1:8765 var/mcp-http.token bin/semitexa mcp

The client's URL is https://mcp.example.com/mcp/<token>, with the token from the token file. The token is the secret: whoever has the URL drives the project.

  • The address is an IP the proxy reaches: loopback when the proxy runs on the host, the host's address on the proxy's network when it runs in a container.
  • A request reaches the server only at /mcp/<token>, compared in constant time. No Authorization header is read.
  • Until the token has been shown, every refusal is the same 404. That covers any other path, a wrong token, and a malformed or slow request.
  • An address that is not loopback prints a warning. Let only the proxy reach that port.
  • The Host must be one of SEMITEXA_MCP_HTTP_HOSTS (comma- or space-separated). A name without a port matches it on any port. A request with an Origin is refused.
  • The body cap is 1 MiB. At most 64 connections are held at once (in both modes); past that, 503. A call gets SEMITEXA_MCP_HTTP_TIMEOUT seconds, as on this machine.
  • semitexa_invoke is not offered: it runs a handler as a request would.
  • Errors carry no internals:
    • a protocol error keeps its code. Its message becomes a fixed text, except "method not found" and "invalid params", which name only what the client sent. Its data is dropped;
    • a tool that threw says only <tool> failed.;
    • a failed command keeps its output and loses its stderr. The output is what the agent acts on, so a failing check can still show its own error text and test traces, with container paths, to the token holder;
    • the project's path on this host reads ..
  • Keep the path out of the proxy's access log, or treat that log as holding the token.

Role in Semitexa

Depends on semitexa/core. The tools, resources and prompts come from providers in the installed packages, so a package adds its own without this one knowing it.

Key Features

  • #[AsMcpProvider] to declare a provider, built through the container
  • McpToolProviderInterface, McpResourceProviderInterface, McpPromptProviderInterface
  • Read-only, destructive and idempotent hints on every tool, so a client can ask the user first
  • A tool's failure reaches the agent as a result it can read, not as a protocol error
  • A provider that cannot be built is left out and named on stderr; the others keep working
  • stdout carries protocol messages only, even when a tool prints

Tools

  • Know: semitexa_orient, semitexa_ask, semitexa_task, semitexa_routes, semitexa_route, semitexa_logs
  • Do: semitexa_scaffold (a recipe), semitexa_generate (any make:* generator), semitexa_invoke
  • Check: semitexa_verify, semitexa_doctor

Generators show what they would create unless asked to write, and never overwrite. Each recipe is also a prompt, and the project's AGENTS.md and the framework's docs pages are resources.

Docs

https://semitexa.com/docs/reference/commands-mcp