Logo vun Mirror

Mirror

Communautéit
toby

đŸȘžâœš Looking at yourself

Editeurtoby
Repositorymirror-mcp
SproochTypeScript
Forks
4
StÀren
15
Disponibel Tools
1
Transporttypstdio
Kategorien
LizenzMIT
Linken
  • Tools mat KI-Workflows verbannen

    Mirror stellt MCP-Funktioune bereit, déi vu kompatibele KI-Clienten a KI-Agente kënne benotzt ginn.

  • 1 disponibel Tools

    Kuckt Iech déi opruffbar Aktiounen hei drënner un, mat Nimm a Beschreiwungen, wa se vum Server geliwwert ginn.

  • Konfiguratioun fir ze kopĂ©ieren

    Benotzt d'Installatiounsbeispiller, fir dĂ«se Server an Ärem bevorzugte MCP-Client ze konfigurĂ©ieren.

  • Indicateure fir Open Source

    15 StÀren an 4 Forks aus dem verlinkte Repository.

mirror-mcp

npm version License: MIT

A Model Context Protocol (MCP) server that provides a reflect tool, enabling LLMs to engage in self-reflection and introspection through recursive questioning and MCP sampling.

Overview

mirror-mcp allows AI models to "look at themselves" by providing a reflection mechanism. When an LLM uses the reflect tool, it can pose questions to itself and receive answers through the Model Context Protocol's sampling capabilities. This creates a powerful feedback loop for self-analysis, reasoning validation, and iterative problem-solving.

Features

  • đŸȘž Self-Reflection Tool: Enables LLMs to ask themselves questions and receive computed responses
  • 🔄 MCP Sampling Integration: Uses the Model Context Protocol's sampling mechanism for responses
  • 📩 npm Installable: Easy installation and deployment
  • ⚡ Lightweight: Minimal dependencies and fast startup
  • 🔧 Configurable: Customizable reflection parameters and sampling options

Installation

Quick Install for VS Code

Install in VS Code Install in VS Code Insiders

MCP Host Configuration

For other MCP-compatible clients, add the following configuration:

json
{
  "type": "stdio",
  "command": "npx", 
  "args": ["mirror-mcp@latest"]
}

Via npm

bash
npm install -g mirror-mcp

Via npx (no installation required)

bash
npx mirror-mcp

From Source

bash
git clone https://github.com/toby/mirror-mcp.git
cd mirror-mcp
npm install
npm run build
npm start

API Reference

Tools

reflect

Enables the LLM to ask itself a question and receive a response through MCP sampling. The tool supports custom system and user prompts to help the LLM self-direct what kind of response it gets.

Self-Direction with Custom Prompts:

  • System Prompt: Define the role or perspective for the reflection (e.g., "expert coach", "critical thinker", "creative problem solver")
  • User Prompt: Specify the format, structure, or focus of the reflection response
  • Default Behavior: When no custom prompts are provided, uses built-in reflection guidance focused on strengths, weaknesses, assumptions, and alternative perspectives

Parameters:

  • question (string, required): The question the LLM wants to ask itself
  • context (string, optional): Additional context for the reflection
  • system_prompt (string, optional): Custom system prompt to direct the reflection approach
  • user_prompt (string, optional): Custom user prompt to replace the default reflection instructions
  • max_tokens (number, optional): Maximum tokens for the response (default: 500)
  • temperature (number, optional): Sampling temperature (default: 0.8)

Example:

json
{
  "name": "reflect",
  "arguments": {
    "question": "How confident am I in my previous analysis of the data?",
    "context": "Previous analysis showed a 23% increase in user engagement",
    "max_tokens": 300,
    "temperature": 0.6
  }
}

Example with custom prompts:

json
{
  "name": "reflect",
  "arguments": {
    "question": "What are the potential weaknesses in my reasoning?",
    "system_prompt": "You are an expert critical thinking coach helping to identify logical fallacies and reasoning gaps.",
    "user_prompt": "Analyze my reasoning step-by-step and provide specific examples of potential weaknesses or blind spots.",
    "context": "Working on a complex machine learning model evaluation",
    "max_tokens": 400,
    "temperature": 0.7
  }
}

Response:

json
{
  "reflection": "Upon reflection, my confidence in the 23% engagement increase analysis is moderate to high. The data sources appear reliable, and the methodology follows standard practices. However, I should consider potential confounding variables such as seasonal effects or concurrent marketing campaigns that might influence the results.",
  "metadata": {
    "tokens_used": 67,
    "reflection_time_ms": 1240
  }
}

Architecture & Rationale

Design Philosophy

mirror-mcp is built on the principle that self-reflection is crucial for robust AI reasoning. By enabling models to question their own outputs and reasoning processes, we create opportunities for:

  • Error Detection: Models can identify potential flaws in their logic
  • Confidence Calibration: Self-assessment helps gauge certainty levels
  • Iterative Improvement: Reflective questioning can lead to better solutions
  • Metacognitive Awareness: Understanding of the model's own reasoning process

Technical Architecture

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   LLM Client    │───▶│   mirror-mcp    │───▶│  MCP Sampling   │
│                 │    │                 │    │   Infrastructure │
│ Calls reflect() │    │ Processes       │    │                 │
│                 │◀───│ reflection      │◀───│ Returns response│
└─────────────────┘    └─────────────────┘    └─────────────────┘

Key Components

  1. Reflection Engine: Processes incoming self-directed questions
  2. Sampling Interface: Interfaces with MCP's sampling capabilities
  3. Context Manager: Maintains conversation context for coherent reflections
  4. Response Formatter: Structures reflection responses for optimal consumption

Why MCP?

The Model Context Protocol provides a standardized way for AI models to connect with external resources and tools. By implementing mirror-mcp as an MCP server, we ensure:

  • Interoperability: Works with any MCP-compatible client
  • Standardization: Follows established protocols for tool integration
  • Scalability: Can be deployed alongside other MCP servers
  • Future-Proofing: Benefits from ongoing MCP ecosystem development

Sampling Strategy

The reflection mechanism leverages MCP's sampling capabilities to generate thoughtful responses. The sampling process:

  1. Takes the self-directed question as a prompt
  2. Applies configurable sampling parameters (temperature, max tokens)
  3. Generates a response using the underlying model
  4. Returns the reflection with appropriate metadata

This approach ensures that reflections are generated using the same model capabilities as the original reasoning, creating authentic self-assessment.

Development

Prerequisites

  • Node.js 18 or higher
  • npm or yarn
  • TypeScript (for development)

Development Setup

bash
git clone https://github.com/toby/mirror-mcp.git
cd mirror-mcp
npm install
npm run dev

Testing

bash
npm test

Building

bash
npm run build

Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

Areas for Contribution

  • Enhanced reflection strategies
  • Additional sampling parameters
  • Performance optimizations
  • Documentation improvements
  • Test coverage expansion

Related Projects

  • Model Context Protocol: The foundational protocol specification
  • MCP Ecosystem: Various other MCP servers and tools

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • The Model Context Protocol team for creating the foundational specification
  • The broader AI research community working on metacognition and self-reflection
  • Contributors and early adopters who help shape this tool

"The unexamined life is not worth living" - Socrates

Enable your AI models to examine their own reasoning with mirror-mcp.

Installatioun

TypingMind
Viraussetzungen:

Node.js 18+

{
  "mcpServers": {
    "mirror": {
      "command": "npx",
      "args": [
        "mirror-mcp@latest"
      ]
    }
  }
}

Disponibel Tools

  • reflect

    Enable targeted LLM self-reflection with customizable prompts for specialized analysis. Use custom system_prompt and user_prompt parameters to get focused, expert-level reflections instead of generic responses. Particularly effective for domain-specific analysis, critical thinking, coaching perspectives, and structured output formats.

Mirror MCP mat verschiddene KI-Modeller benotzen

TypingMind verbĂ«nnt MCP-Tools um Niveau vum AarbechtsberĂ€ich. Soubal Mirror verbonnen ass, kĂ«nnt Dir et mat verschiddene KI-Modeller an TypingMind benotzen, amplaz et fir all Modell separat anzeriichten. DĂ«s MCP-Integratioun leeft lokal iwwer den TypingMind-MCP-Connector op Ärem Apparat.

Ariichtungsuleedung fir de lokale Connector ze benotzen

Benotzt dĂ«s Optioun, wann den MCP-Server ZougrĂ«ff op lokal Fichieren, Appen oder privat Ressourcen op Ärem Computer brauch.

1

D'MCP-Astellungen opmaachen

Gitt an TypingMind op „Astellungen“, „Erweidert Astellungen“, dann op „Model Context Protocol“ a wielt „Connector ariichten“.

  1. Maacht TypingMind an Ärem Browser op.
  2. Klickt op d'Astellungssymbol.
  3. Gitt op „Erweidert Astellungen“.
  4. Maacht d'Sektioun „Model Context Protocol“ op.
  5. Klickt op „Connector ariichten“ a wielt „DĂ«sen Apparat“.
Ariichtungsbildschierm vum TypingMind-MCP-Connector mat „DĂ«sen Apparat“ ausgewielt
2

De Connector-Befeel ausféieren

Wielt „DĂ«sen Apparat“, kopĂ©iert de Befeel aus TypingMind a fĂ©iert en am Terminal aus. Loosst de Prozess lafen, wĂ€rend Dir MCP benotzt.

  1. Kopéiert den Ariichtungsbefeel, deen TypingMind uweist.
  2. Maacht Terminal op macOS oder Windows Terminal op Windows op.
  3. Pescht de Befeel an a féiert en aus.
  4. BestÀtegt d'Installatioun vum Package, wann den Terminal Iech freet, ob Dir weiderfuere wëllt.
  5. Loosst den Terminal an de Prozess doranner lafen, wÀrend Dir MCP-Tools benotzt.
3

Mirror als Server derbÀisetzen

Wann de Connector-Status „Prett“ ass, klickt op „Serveren Ă€nneren“ a pescht d'MCP-Serverkonfiguratioun an.

  1. Waart, bis de Connector-Status „Prett“ weist.
  2. Klickt op „Serveren Ă€nneren“.
  3. Pescht d'MCP-Serverkonfiguratioun vu Mirror an.
  4. SpÀichert d'Serverlëscht.
  5. Aktualiséiert, wann Dir kontrolléiere wëllt, ob de Connector nach ëmmer prett ass.
MCP-Astellunge vun TypingMind mat aktivem Server an dem KnĂ€ppchen „Serveren Ă€nneren“
{
  "mcpServers": {
    "mirror": {
      "command": "npx",
      "args": [
        "-y",
        "mirror-mcp"
      ]
    }
  }
}
4

D'Verbindung mat verschiddene Modeller benotzen

SpĂ€ichert d'ServerlĂ«scht, maacht „Plugins“ op an aktivĂ©iert d'MCP-Tools vu Mirror. Wielt dann e belibegen Ă«nnerstĂ«tzte KI-Modell an TypingMind a benotzt d'Tools am Chat oder weist se engem KI-Agent zou.

  1. Maacht d'SĂ€it „Plugins“ an TypingMind op.
  2. Aktivéiert d'MCP-Tools vu Mirror.
  3. Start e Chat a wielt de KI-Modell, deen Dir benotze wëllt.
  4. Benotzt d'MCP-Tools am Chat oder weist se engem KI-Agent zou.
  5. Wiesselt bei Bedarf op en anere KI-Modell, ouni MCP nei ze verbannen.
TypingMind-Chat mat aktivéierte MCP-Tools an engem ausgewielte KI-Modell
Hëlleft Dir mir bei dëser Aufgab mat Mirror?
Mirror
Jo. Ech hunn et gelies.
Dat hunn ech mat Mirror fonnt.

Heefeg gestallte Froen

Fir wat gëtt de MCP-Server Mirror benotzt?

Mirror ass e MCP-Server, deen et kompatibele KI-Clienten erlaabt, sech mat externen Tools a Kontext ze verbannen. An TypingMind kĂ«nnt Dir dĂ«se MCP-Server eemol derbĂ€isetzen a seng Tools an Ärem KI-AarbechtsberĂ€ich zur VerfĂŒgung stellen.

Kann ech Mirror MCP mat méi KI-Modeller an TypingMind benotzen?

Jo. TypingMind verbënnt MCP-Tools um Niveau vum AarbechtsberÀich. Sou kënnt Dir Mirror mat verschiddene KI-Modeller wéi Claude, ChatGPT, Gemini oder anere Modeller benotzen, déi Dir an TypingMind konfiguréiert hutt, ouni de MCP-Server fir all Modell separat anzeriichten.

Firwat Mirror MCP mat TypingMind benotzen?

TypingMind ass eng vun de beschte BenotzeruewerflĂ€che fir LLM-Chat, well et mĂ©i KI-Modeller, Prompts, Plugins, KI-Agenten, API-SchlĂ«sselen a MCP-Tools an engem AarbechtsberĂ€ich zesummebrĂ©ngt. Wann Mirror verbonnen ass, kĂ«nnt Dir seng MCP-Tools mat Äre bevorzugte Modeller benotzen a glĂ€ichzĂ€iteg Är Chataarbecht an TypingMind organisĂ©ieren.

Wéi verbannen ech Mirror MCP mat TypingMind?

Mirror leeft iwwer de lokale MCP-Connector vun TypingMind. Dat eegent sech am beschten, wann de MCP-Server ZougrĂ«ff op lokal Fichieren, Desktop-Apps, Kommandozeilen-Tools oder privat Ressourcen op Ärem Computer brauch.

WĂ©i eng Tools stellt Mirror MCP an TypingMind zur VerfĂŒgung?

Mirror stellt 1 MCP-Tools zur VerfĂŒgung, dĂ©i Dir op der Plugins-SĂ€it vun TypingMind aktivĂ©iere kĂ«nnt, fir se am Chat ze benotzen oder KI-Agenten zouzeweisen.

Muss ech meng API-Schlëssele mat TypingMind deelen, fir Mirror MCP ze benotzen?

Nee. TypingMind setzt op lokal Veraarbechtung a lĂ©isst Iech d'Kontroll iwwer Är Modellubidder, API-SchlĂ«sselen, Prompts a MCP-Konfiguratioun. Wann Mirror eng AuthentifizĂ©ierung verlaangt, setzt dĂ©i nĂ©ideg Headeren, OAuth-Astellungen oder lokal Konfiguratioun fir dee MCP-Server derbĂ€i, wann Dir d'Verbindung erstallt.

Änlech MCP-Serveren

All weisen

Elo Ären eegene KI-Workspace ariichten

AbonnĂ©iert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukĂŒnfteg GewĂ«nnspiller informĂ©iert ze ginn 👇