Mirror Mcp

io.github.toby由 GitHub 账号 toby 发布v0.0.8更新于 Oct 24, 2026

Mirror MCP: Introspection for LLMs

已验证STDIO仅桌面开发者工具AI 与机器学习

概览

AI 生成的概览

一个本地 MCP 服务器,提供 reflect 工具,让助手通过 MCP 采样向自己提问并获得回答。

可以做什么
mirror-mcp 只提供一个工具 reflect,让模型向自己提出问题,并通过 MCP 采样机制获得生成的回答。该工具接受必填的 question,以及可选的 context、system_prompt、user_prompt、max_tokens 和 temperature,模型可借此控制反思的角度与形式。默认引导关注优势、弱点、假设和替代视角,返回结果附带 token 用量与耗时元数据。
适用场景
适合希望助手在作答前检查自身推理、校准置信度或探索其他视角的场景。它是单一用途的小工具,而非通用工具集,因此只有在客户端支持 MCP 采样时才有意义。
运行要求
以 npm 包形式通过 stdio 在本地运行,可用 npx mirror-mcp 启动或全局安装;需要 Node.js 18 或更高版本。未声明任何账号、API 密钥、环境变量或请求头。仅支持桌面客户端。
安装前请注意
反思由同一模型通过 MCP 采样生成,并非独立验证,可能重复模型自身的错误。该工具只产生文本,不读写文件或外部数据,也不要求任何凭据。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Mirror Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

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.gitcd mirror-mcpnpm installnpm run buildnpm 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.gitcd mirror-mcpnpm installnpm 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.

来源:README.md,提交 36ed257

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.0.8最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分