LLM-Persistent-Agent-System-Service
A service layer component providing persistent state management for Large Language Models (LLMs), facilitating conversational flow, history recall, and dynamic switching between various backend LLM engines.
Author

Vic563
Quick Info
Actions
Tags
LLM-Persistent-Agent-System-Service (MCP Implementation)
This is a TypeScript-engineered service framework conforming to the Model Context Protocol (MCP) specification, designed to endow LLMs with robust, externalized memory capabilities. It exposes utilities for interactive dialogue sessions and seamless orchestration across disparate LLM processing units.
Core Functionalities (Tools)
-
converse- Transmit an input utterance to the currently designated LLM backend.- Requires a mandatory
utterancepayload. - Supports service endpoints including OpenAI implementations, Anthropic models, OpenRouter gateways, and local Ollama instances.
- Requires a mandatory
-
fetch_session_log- Retrieve chronologically stored interaction records.- Accepts an optional
count_capargument to cap the number of records returned. - Setting
count_cap: nullforces retrieval of the entire preserved history. - Results are structured chronologically, appended with time markers.
- Accepts an optional
-
purge_session_log- Completely erase all previously recorded conversational artifacts.- Deletes the entirety of the session's persistent data.
-
delegate_backend- Dynamically reassign the operational LLM engine.- Valid targets include OpenAI, Anthropic, OpenRouter, and Ollama.
- The chosen backend selection is persistently stored across sessions.
-
reconfigure_model- Modify the specific computational model utilized by the active backend engine.- Model specifications are contingent upon the selected provider:
- Anthropic Offerings:
- Claude 3 Lineup:
claude-3-haiku: Optimized for maximal throughput and minimal latency in high-volume scenarios (e.g., support queues).claude-3-sonnet: Engineered for optimal general-purpose task execution.claude-3-opus: Tailored for complex inferential logic and peak performance requirements.
- Claude 3.5 Lineup:
claude-3.5-haiku: Improved efficiency and cost-performance profile.claude-3.5-sonnet: Superior analytical capabilities, especially in code-centric or interactive simulation tasks.
- Claude 3 Lineup:
- OpenAI Parameters: Supported identifiers such as 'gpt-4o', 'gpt-4o-mini', 'gpt-4-turbo'.
- OpenRouter Formats: Accepts arbitrary 'vendor/model' strings (e.g., 'mistralai/mixtral-8x7b').
- Ollama Targets: Accepts any model name locally accessible by the Ollama runtime (e.g., 'solar', 'llama3:8b').
- Anthropic Offerings:
- The selected model configuration is maintained throughout the service lifecycle.
- Model specifications are contingent upon the selected provider:
Deployment & Setup
Dependency installation prerequisites: bash npm install
Compiling the service binary: bash npm run build
For continuous development integration (automatic recompilation): bash npm run watch
Integration Instructions (For Claude Desktop)
To link this service, integrate the following configuration snippet into your application's local settings file:
MacOS Path: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows Path: %APPDATA%/Claude/claude_desktop_config.json
Configuration Structure:
{ "mcpServers": { "persistent-llm-hub": { "command": "/path/to/LLM-Persistent-Agent-System-Service/build/index.js", "env": { "OPENAI_API_KEY": "Your_Secret_Key_For_OpenAI", "ANTHROPIC_API_KEY": "Your_Secret_Key_For_Anthropic", "OPENROUTER_API_KEY": "Your_Secret_Key_For_OpenRouter" } } } }
Required Runtime Secrets (Environment Variables)
OPENAI_API_KEY: Authentication token for OpenAI access.ANTHROPIC_API_KEY: Authentication token for Anthropic access.OPENROUTER_API_KEY: Authentication token for OpenRouter proxy access.
Diagnostic Assistance
Debugging inter-process communication over stdio requires specialized utilities. We recommend utilizing the official MCP Inspector:
bash npm run inspector
This command launches an interface accessible via a browser URL, providing enhanced visibility into the communication channels.
Operational Enhancements Log
Modern Claude Model Integration (Q1 2024)
- Incorporated support for the newest Anthropic models:
- Claude 3 Family (Haiku, Sonnet, Opus)
- Claude 3.5 Family (Haiku, Sonnet)
Unbounded History Retrieval Feature
- Added functionality to retrieve the complete historical transcript.
- To fetch all records, invoke
fetch_session_logwith{ "count_cap": null }. - Specifying
{ "count_cap": N }retrieves the N most recent entries. - The default limit, if unspecified, is set to ten previous interactions.
