DAZ Command MCP Server

DAZ Command MCP Server

An MCP server that provides session-based shell command execution and file management with intelligent LLM-powered summarization. It enables users to manage isolated workflows and track progress through automated event logging and session history.

Category
Visit Server

README

DAZ Command MCP Server

DAZ Command MCP Logo

A Model Context Protocol (MCP) server that provides session-based command execution with intelligent LLM-powered summarization.


๐Ÿš€ Features

  • ๐Ÿ”ง Session Management: Create, open, and manage isolated command execution sessions
  • โšก Command Execution: Run shell commands with timeout controls and working directory management
  • ๐Ÿ“ File Operations: Read and write text files with comprehensive error handling
  • ๐Ÿค– LLM Summarization: Automatic session progress tracking using structured LLM responses
  • ๐Ÿ“‹ Event Logging: Complete audit trail of all operations within sessions
  • ๐Ÿ”’ Thread-Safe: Robust concurrent operation with proper synchronization

๐Ÿ“ฆ Installation

Prerequisites

  • Python 3.8+
  • fastmcp library
  • dazllm library for LLM integration

Quick Setup

  1. Clone this repository:
git clone https://github.com/yourusername/daz-command-mcp.git
cd daz-command-mcp
  1. Install dependencies:
pip install -r requirements.txt
  1. Configure your LLM model in the script (default: lm-studio:openai/gpt-oss-20b)

๐ŸŽฏ Usage

Starting the Server

python main.py

Available Tools

Session Management

  • daz_sessions_list() - List all sessions and identify the active one
  • daz_session_create(name, description) - Create and activate a new session
  • daz_session_open(session_id) - Open and activate an existing session
  • daz_session_current() - Get details of the currently active session
  • daz_session_close() - Close the current session
  • daz_session_rename(old_name, new_name) - Rename an existing session
  • daz_session_delete(session_name) - Delete a session by moving to deleted_sessions

Command & File Operations

All command and file operations require an active session and context parameters:

  • daz_command_cd(directory, current_task, summary_of_what_we_just_did, summary_of_what_we_about_to_do) - Change working directory
  • daz_command_read(file_path, current_task, summary_of_what_we_just_did, summary_of_what_we_about_to_do) - Read a text file
  • daz_command_write(file_path, content, current_task, summary_of_what_we_just_did, summary_of_what_we_about_to_do) - Write a text file
  • daz_command_run(command, current_task, summary_of_what_we_just_did, summary_of_what_we_about_to_do, timeout=60) - Execute shell commands

Learning & Instructions

  • daz_add_learnings(learning_info) - Add important discoveries and context to the session
  • daz_instructions_read() - Read current session instructions
  • daz_instructions_add(instruction) - Add a new instruction to the session
  • daz_instructions_replace(instructions) - Replace all instructions with a new list
  • daz_record_user_request(user_request) - Record a user request at the start of multi-step tasks

Example Workflow

# Create a new session
daz_session_create("Setup Project", "Setting up a new Python project with dependencies")

# Navigate to project directory  
daz_command_cd("/path/to/project", 
               "Setting up Python project",
               "Created new session for project setup", 
               "Navigate to project root directory")

# Run commands
daz_command_run("pip install -r requirements.txt",
                "Setting up Python project", 
                "Navigated to project directory",
                "Install project dependencies")

# Read configuration
daz_command_read("config.json",
                 "Setting up Python project",
                 "Installed dependencies successfully", 
                 "Review current configuration settings")

# Write new file
daz_command_write("setup.py", "...",
                  "Setting up Python project",
                  "Reviewed configuration file",
                  "Create package setup file")

๐Ÿ—๏ธ Architecture

Session Storage

Sessions are stored as JSON files in the sessions/ directory with the following structure:

{
  "id": "unique-session-id",
  "name": "Session Name", 
  "description": "Detailed description",
  "created_at": 1692123456.789,
  "updated_at": 1692123456.789,
  "summary": "LLM-generated summary",
  "progress": "Current progress status",
  "current_directory": "/current/working/dir",
  "events_count": 42
}

Event Logging

Every operation is logged with comprehensive details in event_log.jsonl:

{
  "timestamp": 1692123456.789,
  "type": "run|read|write|cd|user_request|learning",
  "current_task": "The task being worked on",
  "summary_of_what_we_just_did": "What was just completed",
  "summary_of_what_we_about_to_do": "What's planned next",
  "inputs": {...},
  "outputs": {...}, 
  "duration": 0.123
}

LLM Integration

The server uses asynchronous LLM processing to maintain session summaries:

  • ๐Ÿ”„ Background Processing: Summarization runs in a separate thread
  • ๐Ÿ›ก๏ธ Fault Tolerance: LLM failures don't affect MCP operations
  • ๐Ÿ“‹ Structured Output: Uses Pydantic models for reliable parsing
  • โš™๏ธ Configurable Model: Easy to switch between different LLM providers

โš™๏ธ Configuration

LLM Model

Edit the LLM_MODEL_NAME constant in src/models.py:

LLM_MODEL_NAME = "your-model-name"

Session Directory

Sessions are stored in ./sessions/ by default. This can be modified by changing the SESSIONS_DIR constant in src/models.py.

๐Ÿ› ๏ธ Error Handling

  • ๐Ÿ”„ Graceful Degradation: Operations continue even if LLM summarization fails
  • ๐Ÿ“ Comprehensive Logging: All errors are logged to stderr
  • โœ… Input Validation: Robust parameter checking and sanitization
  • ๐Ÿ”’ File Safety: Atomic file operations prevent corruption

๐Ÿ”— Integration

This MCP server integrates with Claude Desktop and other MCP-compatible clients. Add it to your MCP configuration:

{
  "mcpServers": {
    "daz-command": {
      "command": "python",
      "args": ["/path/to/main.py"]
    }
  }
}

๐Ÿ“ Project Structure

daz-command-mcp/
โ”œโ”€โ”€ README.md              # This file
โ”œโ”€โ”€ main.py                # Entry point
โ”œโ”€โ”€ requirements.txt       # Dependencies
โ”œโ”€โ”€ images/                # Documentation images
โ”œโ”€โ”€ sessions/              # Session storage (auto-created)
โ””โ”€โ”€ src/                   # Source code
    โ”œโ”€โ”€ __init__.py
    โ”œโ”€โ”€ command_executor.py    # Command execution logic
    โ”œโ”€โ”€ history_manager.py     # Session history management
    โ”œโ”€โ”€ mcp_tools.py          # MCP tool definitions
    โ”œโ”€โ”€ models.py             # Data models and constants
    โ”œโ”€โ”€ session_manager.py    # Session lifecycle management
    โ”œโ”€โ”€ summary_generator.py  # LLM summary generation
    โ”œโ”€โ”€ summary_worker.py     # Background summarization worker
    โ”œโ”€โ”€ utils.py              # Utility functions
    โ””โ”€โ”€ tests/                # Unit tests
        โ”œโ”€โ”€ test_add_learnings.py
        โ”œโ”€โ”€ test_initialization_fix.py
        โ”œโ”€โ”€ test_llm_system_integration.py
        โ”œโ”€โ”€ test_new_parameter_system.py
        โ””โ”€โ”€ test_summary_generation.py

๐Ÿงช Testing

Run the comprehensive test suite:

# Run all tests
python -m pytest src/tests/

# Run specific test
python -m pytest src/tests/test_summary_generation.py -v

# Run with coverage
python -m pytest src/tests/ --cov=src

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Add tests if applicable
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Submit a pull request

๐Ÿ“œ License

[Add your license here]

๐Ÿ“ฆ Dependencies

  • fastmcp: MCP server framework
  • dazllm: LLM integration library

๐Ÿ’ฌ Support

For issues and questions, please open an issue on GitHub or contact [your contact information].


Built with โค๏ธ for the Model Context Protocol ecosystem

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured