Skip to main content
Glama

trinitas-mcp

trinitas-mcp ist ein modularer MCP-Server (Model Context Protocol) für Context, Memory und Multi-Model-Orchestrierung. Er wurde als wiederverwendbare Komponente entwickelt und eignet sich besonders für Szenarien, in denen strukturierte Dialog-Memory und Review-Workflows benötigt werden.

Der Server trennt klar zwischen Vorbereitung & Verwaltung (MCP-Server) und tatsächlicher Ausführung von LLM-Calls (Host-Orchestrator). Dadurch bleibt der MCP-Server keyless und fokussiert.

Basiert auf dem offiziellen Model Context Protocol Python SDK (mcp[cli] / FastMCP).

Features

  • Erweiterte Memory-Schicht

    • Keyword-Suche, FTS5-Volltextsuche und optionale Embedding-basierte semantische Suche

    • Metadaten werden bei FTS5 und semantischer Suche berücksichtigt

  • Review-Workflow

    • propose_review_strategy — erzeugt eine task-spezifische Review-Strategie

    • execute_review — bereitet strukturierte Review-Ausführung vor

    • Robuster Host-Orchestrator mit Retries, Rate Limiting, Cost Tracking und Parallelisierung

  • Persistenz & Abfrage

    • Review-Ergebnisse werden in SQLite gespeichert

    • Abfrage über Tools oder als MCP Resource (review://{review_id} / review://{session_id})

  • Mehrere Transportwege

    • stdio (Standard für Claude Desktop / Cursor)

    • HTTP + SSE / Streamable HTTP (für remote Nutzung)

  • Produktionsfeatures (HTTP-Modus)

    • Health- und Readiness-Checks (/health, /ready)

    • Graceful Shutdown

Related MCP server: BuildAutomata Memory MCP Server

Voraussetzungen

  • Python >= 3.10

  • Netzwerkzugriff für Registry-Tools (lokal gecacht)

Quick Start (stdio)

python3 -m venv .venv && source .venv/bin/activate
pip install -e .
trinitas-mcp

Der Server läuft dann per stdio und kann direkt mit Claude Desktop oder Cursor verwendet werden.

Claude Desktop / Cursor: siehe examples/claude_desktop_config.json.

Vollständiger Review-Workflow

Ein lauffähiges End-to-End-Beispiel:

python examples/full_review_workflow.py

examples/full_review_workflow.py

Der Workflow umfasst typischerweise folgende Schritte:

  1. Dialog-Turns in Memory speichern

  2. Review-Strategie generieren (propose_review_strategy)

  3. Review vorbereiten und ausführen (execute_review + Host-Orchestrator)

  4. Ergebnisse persistieren

  5. Reviews über review:// Resource oder Tools abfragen

Für Live-LLM-Calls: python examples/full_review_workflow.py --live (API-Key über TRINITAS_ORCHESTRATOR_API_KEY).

HTTP Modus (remote)

Es gibt zwei HTTP-Transports — wichtig für die richtige Client-URL:

Transport

Server-Start

MCP-Endpunkt

Typische Clients

streamable-http

--transport streamable-http

http://HOST:8000/mcp

Claude Code (--transport http), moderne MCP-Clients

sse (legacy)

--transport sse

http://HOST:8000/sse (GET) + /messages/ (POST)

Ältere SSE-MCP-Clients

Claude Code (empfohlen)

Server (z. B. auf dem Homeserver, alle Interfaces):

trinitas-mcp --transport streamable-http --host 0.0.0.0 --port 8000

Client (auf dem Rechner mit Claude):

claude mcp remove trinitas-mcp   # falls bereits falsch konfiguriert
claude mcp add trinitas-mcp --transport http http://91.192.10.248:8000/mcp
claude mcp list

Häufiger Fehler: http://…:8000/sse mit --transport http → Server loggt POST /sse 405. Claude sendet POST (Streamable HTTP); Legacy-SSE erwartet GET auf /sse.

Troubleshooting nach erfolgreicher Verbindung:

  • listMcpResources zeigt oft (No resources found) — normal. trinitas nutzt Resource-Templates, keine statischen Resources:

    • conversation://{session_id} — Dialog-Kontext (z. B. conversation://demo)

    • review://{review_id} oder review://{session_id} — gespeicherte Reviews

  • Tool-Test ohne Netzwerk: Bitte Claude, ping_mcp oder get_session_stats mit session_id: "test" aufzurufen.

  • Registry-Tools (list_available_providers) brauchen ausgehendes HTTPS vom Server zur GitHub-Pages-Registry.

  • Im Server-Log sollte bei Tool-Calls Processing request of type CallToolRequest erscheinen; fehlt das, bricht der Client ab bevor die Anfrage ankommt.

Legacy SSE

trinitas-mcp --transport sse --host 0.0.0.0 --port 8000

Client-Config: examples/mcp_sse_client.json

Health Checks

curl http://127.0.0.1:8000/health
curl http://127.0.0.1:8000/ready

Alternativ: examples/run_sse_server.sh (legacy SSE)

Architektur

┌─────────────────────┐          ┌──────────────────────────────┐
│   MCP Server        │          │     Host-Orchestrator        │
│                     │          │                              │
│ • Memory (FTS5 +    │          │ • LLM Calls (OpenAI-kompatibel)│
│   Semantic Search)  │          │ • Retries + Rate Limiting     │
│ • Review Tools      │◄────────►│ • Cost Tracking               │
│ • Resources         │          │ • Parallel Execution          │
│ • Prompts           │          │ • Observability               │
└─────────────────────┘          └──────────────────────────────┘

Der MCP-Server kümmert sich um Context, Memory und Struktur. Die eigentlichen LLM-Calls werden vom Host-Orchestrator durchgeführt. Diese Trennung macht den Server einfacher, sicherer und besser testbar.

Konfiguration

Wichtige Umgebungsvariablen:

Variable

Beschreibung

TRINITAS_DATA_DIR

Verzeichnis für SQLite-Datenbank

TRINITAS_SEMANTIC_SEARCH

Semantische Suche aktivieren/deaktivieren (1 / 0)

TRINITAS_EMBEDDING_BACKEND

auto, hashing oder sentence-transformers

TRINITAS_RATE_LIMIT_<PROVIDER>

Rate Limit pro Provider (Requests/Minute)

TRINITAS_MCP_TRANSPORT

stdio oder sse

TRINITAS_HEALTH_PATH / TRINITAS_READY_PATH

Health-Check-Pfade (HTTP-Modus)

TRINITAS_SHUTDOWN_TIMEOUT

Graceful-Shutdown-Timeout in Sekunden

Weitere Konfigurationsmöglichkeiten findest du in REPORT.md.

Entwicklung

Das Projekt verwendet ein commit-basiertes Workflow-Modell. Die verbindlichen Arbeitsregeln stehen in AGENT_INSTRUCTIONS.md.

Weiterführende Dokumentation

Lizenz

MIT License

Available Tools

5 tools
list_available_providersA
Read-onlyIdempotent

List all providers from the AI Provider Registry.

Fetches the live registry document and returns provider summaries including id, api_style, free-tier status, and supported capabilities.

Returns: JSON string with registry metadata and provider list.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations provide readOnly, idempotent, openWorld hints. Description adds that it fetches live registry and returns JSON, enhancing transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three concise sentences, front-loaded with purpose, no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Output schema exists; description still mentions return format and key fields. Complete for a simple listing tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters exist, so schema coverage is 100%. Description adds no parameter info but baseline for 0 parameters is 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool lists all providers from the AI Provider Registry, with specific fields returned. It is distinct from sibling tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use vs alternatives, but the simple nature and clear purpose imply usage. Could be improved with contextual cues.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

retrieve_recent_contextA
Read-onlyIdempotent

Retrieve the most recent dialog turns for a session.

Returns turns in chronological order (oldest first) so they can be directly used as LLM context.

Args: session_id: Conversation session to query. limit: Maximum number of recent turns to return (default 10).

Returns: JSON string with session id, turn count, and turn list.

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNo
session_idYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare safe behavior (readOnly, idempotent, non-destructive). The description adds value by explaining the chronological ordering and that the output is suitable as LLM context, but it does not disclose potential edge cases such as empty sessions or error conditions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is very concise: two sentences followed by structured Args/Returns sections. It is front-loaded with the purpose and contains no extraneous information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simplicity of the tool (2 params, no nested objects), the presence of an output schema, and comprehensive annotations, the description covers all necessary aspects: what it does, what it returns, and how to use it. No additional detail is required.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description fully compensates by clearly explaining both parameters: session_id as 'Conversation session to query' and limit as 'Maximum number of recent turns to return (default 10)', providing meaning beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description specifies the action 'retrieve' and the resource 'most recent dialog turns for a session', clearly distinguishing it from sibling tools that write (store_dialog_turn) or search memory (search_memory).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for obtaining LLM context but does not explicitly guide when to prefer this over alternatives like search_memory, which could also retrieve context. No when-not-to-use guidance is given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

route_best_modelA
Read-onlyIdempotent

Recommend the best AI provider for a given task type.

Uses the public kbarbel640-del/ai-provider-registry to score providers by capability match, free-tier preference, and known provider strengths.

Args: task_type: Task category — chat, code, reasoning, vision, search, embeddings, image, or tools. constraints: Optional routing constraints: - prefer_free (bool): Prefer free-tier providers. - exclude_providers (list[str]): Provider ids to skip. - api_style (str): Required API style (e.g. openai).

Returns: JSON string with top recommendation and up to four alternatives.

ParametersJSON Schema
NameRequiredDescriptionDefault
task_typeYes
constraintsNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint, idempotentHint, etc. Description adds context about using a public registry and scoring criteria, which adds value beyond annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose, then source, then args in structured format. Clear but could be slightly more concise without losing clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers purpose, inputs (with options), source, and return format. With output schema present, return details are sufficient. No missing critical aspects for a recommendation tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Despite 0% schema description coverage, description extensively explains task_type values and constraints fields, adding meaning beyond the schema's minimal type info. Return format also described.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states the tool recommends the best AI provider for a task type, using specific verb 'recommend' and resource 'best AI provider'. Distinguishes from siblings like list_available_providers which merely lists providers.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Implies usage for choosing a provider but lacks explicit guidance on when not to use or alternatives like list_available_providers for just listing. No exclusions mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_memoryA
Read-onlyIdempotent

Search dialog memory within a session by text substring.

Performs a case-insensitive LIKE search over turn content and roles. Suitable for finding earlier mentions of topics, decisions, or entities.

Args: session_id: Conversation session to search. query: Substring to match in content or role. limit: Maximum results to return (default 20).

Returns: JSON string with matching turns, newest first.

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNo
queryYes
session_idYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and idempotentHint=true. Description adds detail about case-insensitive LIKE search and ordering (newest first), which adds context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Concise and well-structured: purpose, behavior, suitability, parameters, returns. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With an output schema present, the description adequately describes return format (JSON, matching turns, newest first). Could mention pagination or limit behavior more explicitly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, but the description provides a detailed Args section explaining each parameter's purpose and default for limit.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states the verb 'search' and resource 'dialog memory' within a session. Distinct from siblings like 'store_dialog_turn' or 'retrieve_recent_context'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly describes suitability for finding earlier mentions, but does not specify when not to use or compare to alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

store_dialog_turnA

Store a single dialog turn in persistent session memory.

Persists a message (user, assistant, system, or tool) for later retrieval and context assembly. Metadata can hold arbitrary JSON-serializable context such as model name, tool calls, or review state.

Args: session_id: Unique conversation session identifier. role: Speaker role (e.g. user, assistant, system). content: Message text content. metadata: Optional key-value context attached to this turn.

Returns: JSON string with the stored turn record including assigned id.

ParametersJSON Schema
NameRequiredDescriptionDefault
roleYes
contentYes
metadataNo
session_idYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds behavioral details beyond annotations, such as metadata handling and return format, but does not explicitly mention side effects like overwriting or appending.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured with a brief intro, Args list, and Returns note, with no extraneous information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers all necessary aspects for a store tool: what it stores, parameters, and return value, making it complete given the presence of an output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With zero schema coverage, the description fully explains each parameter's meaning and purpose, e.g., 'Unique conversation session identifier' for session_id, which adds significant value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'store' and the resource 'dialog turn in persistent session memory', distinguishing it from sibling tools like list_available_providers or retrieve_recent_context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains that the tool is used for persisting messages for later retrieval and context assembly, but does not explicitly state when not to use it or provide alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 5 tool updatesv0.1.0
    • First observedlist_available_providers
    • First observedretrieve_recent_context
    • First observedroute_best_model
    • First observedsearch_memory
    • First observedstore_dialog_turn

TDQS

A4.4/5.0

Scored across 5 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: list providers, retrieve recent dialog, route best model, search memory, and store dialog turn. No overlapping functionality.

Naming Consistency5/5

All tool names follow the verb_noun pattern in snake_case (e.g., list_available_providers, store_dialog_turn), providing a predictable and consistent naming scheme.

Tool Count4/5

5 tools is on the lower side but acceptable for a server combining provider routing and dialog memory. Each tool serves a clear role without redundancy.

Completeness4/5

Dialog memory covers store, retrieve, and search adequately. Provider coverage has list and route but lacks a single-provider detail lookup, a minor gap.

Maintenance

ActivityMaintained
ResponsivenessSyncing

Related MCP Connectors

Related MCP Servers