Skip to content

ncosentino/narnia

Repository files navigation

Narnia

Narnia is a hybrid MCP server + Blazor web UI for browsing and searching GitHub Copilot CLI session history.

If you use Copilot CLI heavily, you know the pain: a Windows update reboots your machine and every active session terminal is gone. Narnia makes it easy to find and resume sessions — either by asking a new Copilot session to search for you (via MCP), or by browsing a local web interface.


Features

  • MCP Server — exposes tools that any MCP-compatible client (including Copilot CLI) can call to search and browse your session history
  • Web UI — Blazor-based local web interface for browsing, searching, and reading session details, checkpoints, and conversation turns
  • Session workspace — reads supplemental metadata from ~/.copilot/session-state/ including git root and session artifact files

Prerequisites

  • .NET 10 SDK
  • Copilot CLI with an existing ~/.copilot/session-store.db

Running the MCP Server

The MCP server uses stdio transport and is designed to be launched by an MCP host.

Build

dotnet build src/NexusLabs.Narnia.McpServer

Configure in Copilot CLI

Add the following to your ~/.copilot/mcp-config.json:

{
  "mcpServers": {
    "narnia": {
      "command": "dotnet",
      "args": ["run", "--project", "C:/path/to/narnia/src/NexusLabs.Narnia.McpServer"],
      "env": {}
    }
  }
}

After publishing as a NativeAOT binary (dotnet publish src/NexusLabs.Narnia.McpServer -c Release):

{
  "mcpServers": {
    "narnia": {
      "command": "C:/path/to/NexusLabs.Narnia.McpServer.exe",
      "args": [],
      "env": {}
    }
  }
}

Available MCP Tools

Tool Description
list_recent_sessions Most recently updated sessions
search_sessions FTS5 full-text search across summaries, turns, and checkpoints
get_session_details Full session metadata and statistics
get_session_checkpoints All checkpoints with structured content
get_session_turns Conversation turns (paginated)
get_session_workspace Git root and session artifact files from the filesystem
list_sessions_by_repository Filter sessions by git repository
list_sessions_by_cwd Filter sessions by working directory
open_narnia_ui Start the web UI if not running and open it in the default browser

Running the Web UI

dotnet run --project src/NexusLabs.Narnia.Web

Then open http://localhost:5000 in your browser.


Configuration

Both the MCP server and web UI read configuration from environment variables:

Variable Description Default
NARNIA__DatabasePath Path to session-store.db ~/.copilot/session-store.db
NARNIA__SessionStatePath Path to session state directory ~/.copilot/session-state
NARNIA__WebUiUrl URL used by open_narnia_ui to check/open the web UI http://localhost:5244
NARNIA__WebProjectPath Path to the Web project (for open_narnia_ui to start the server). Auto-detected from source layout if not set. (auto-detected)

Building from Source

git clone https://github.com/nexus-labs/narnia
cd narnia
dotnet build
dotnet test

Publish MCP server as NativeAOT

dotnet publish src/NexusLabs.Narnia.McpServer -c Release

Architecture

narnia/
  src/
    NexusLabs.Narnia.Core/        # Shared library — trim-safe, AOT-compatible
    NexusLabs.Narnia.McpServer/   # MCP server — NativeAOT, stdio transport
    NexusLabs.Narnia.Web/         # Blazor Static SSR web interface
  tests/
    NexusLabs.Narnia.Core.Tests/  # xUnit v3 test suite

The Core library is the only place where data access logic lives. Both the MCP server and Web app are thin entry points that register Core services and expose them to their respective transports.

Data sources

  • session-store.db — SQLite with FTS5 full-text search (opened read-only)
  • session-state/{guid}/workspace.yaml — flat key:value YAML with filesystem metadata (e.g. git_root)
  • session-state/{guid}/files/ — session artifact files (plan.md, context files, etc.)

Related Projects

  • google-search-console-mcp -- Google Search Console MCP server: query clicks, impressions, CTR, and ranking position from your Search Console properties
  • google-keyword-planner-mcp -- Google Ads Keyword Planner MCP server: keyword ideas, search volume, competition, and CPC data
  • google-psi-mcp -- Zero-dependency MCP server for Google PageSpeed Insights Core Web Vitals

About

Nick Cosentino -- Dev Leader

This tool was built by Nick Cosentino, a software engineer and content creator known as Dev Leader. Nick creates practical .NET, C#, ASP.NET Core, Blazor, and software engineering content for intermediate to advanced developers -- covering everything from performance optimization and clean architecture to real-world career advice.

Narnia was born out of a real frustration: Windows forcing a restart and wiping every active Copilot CLI session with no easy way to recover. It serves as a practical example of building NativeAOT C# MCP servers and Blazor Static SSR apps following modern .NET standards.

Find Nick online:

BrandGhost

BrandGhost is a social media automation platform built by Nick that lets content creators cross-post and schedule content across all social platforms in one click. If you create content and want to spend less time on distribution and more time creating, check it out.


Contributing

Contributions are welcome! Please:

  1. Open an issue describing the bug or feature request before submitting a PR
  2. Run dotnet build with zero warnings before submitting
  3. Run dotnet test -- all tests must pass

License

MIT License -- see LICENSE for details.

About

An MCP server and Blazor web UI for looking at Copilot CLI's Chronicle to search and view your session data with Copilot!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors