Skip to main content

Echoes MCP Server

CI PyPI Python

Model Context Protocol server for AI integration with Echoes storytelling platform.

Features

  • Narrative Knowledge Graph: Automatically extracts characters, locations, events, and their relationships
  • Semantic Search: Find relevant chapters using natural language queries
  • Entity Search: Search for characters, locations, and events
  • Relation Search: Explore relationships between entities
  • Arc Isolation: Each arc is a separate narrative universe - no cross-arc contamination
  • Statistics: Aggregate word counts, POV distribution, and more
  • Dynamic Prompts: Reusable prompt templates with placeholder substitution

Architecture

Arc Isolation

Each arc in a timeline is treated as a separate narrative universe:

  • Entities are scoped to arcs: bloom:CHARACTER:Alice ≠ work:CHARACTER:Alice
  • Relations are internal to arcs: bloom:Alice:LOVES:Bob
  • Searches can be filtered by arc to avoid cross-arc contamination

This is important for multi-arc timelines where the same character may have different knowledge/experiences in different arcs.

Data Model

Timeline (content directory)
└── Arc (story universe)
    └── Episode (story event)
        └── Chapter (individual .md file)

Requirements

  • Python 3.11-3.13 (3.14 not yet supported by spaCy)
  • ~2GB disk space for models (spaCy Italian + embeddings)

Installation

pip install echoes-mcp-server

Or with uv (recommended):

uv add echoes-mcp-server

The Italian spaCy model (it_core_news_lg) is downloaded automatically on first use.

Usage

CLI

# Count words in a markdown file
echoes words-count ./content/arc1/ep01/ch001.md

# Index timeline content
echoes index ./content

# Index only a specific arc
echoes index ./content --arc bloom

# Get statistics
echoes stats
echoes stats --arc arc1 --pov Alice

# Search (filters by arc to avoid cross-arc contamination)
echoes search "primo incontro" --arc bloom
echoes search "Alice" --type entities --arc bloom

Environment Variables

# Custom embedding model (default: paraphrase-multilingual-MiniLM-L12-v2)
export ECHOES_EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2

# HuggingFace token for gated models
export HF_TOKEN=hf_xxx

# Gemini API key for entity/relation extraction (optional)
# Get your key at https://aistudio.google.com/apikey
export GEMINI_API_KEY=your_api_key

MCP Server

Configure in your MCP client (e.g., Claude Desktop, Kiro CLI):

{
  "mcpServers": {
    "echoes": {
      "command": "echoes-mcp-server",
      "cwd": "/path/to/timeline"
    }
  }
}

Or with uvx (no installation required):

{
  "mcpServers": {
    "echoes": {
      "command": "uvx",
      "args": ["echoes-mcp-server"],
      "cwd": "/path/to/timeline"
    }
  }
}

Available Tools

Tool Description
words-count Count words and statistics in a markdown file
index Index timeline content into LanceDB
search-semantic Semantic search on chapters
search-entities Search characters, locations, events
search-relations Search relationships between entities
stats Get aggregate statistics

Available Prompts

The server provides dynamic prompts that load templates from ../.github/.kiro/prompts/ and optionally append timeline-specific overrides from ./.kiro/prompts/.

Prompt Arguments Description
new-chapter arc, chapter Create a new chapter for a timeline arc
revise-chapter arc, chapter Revise an existing chapter
expand-chapter arc, chapter, target Expand a chapter to target word count
new-character name Create a new character sheet
new-episode arc, episode Create a new episode outline
new-arc name Create a new story arc
revise-arc arc Review and fix an entire arc

Prompts support placeholder substitution ({ARC}, {CHAPTER}, {TIMELINE}, etc.) and validate arguments (e.g., arc must exist, chapter must be a number).

Development

Setup

# Clone the repository
git clone https://github.com/echoes-io/mcp-server.git
cd mcp-server

# Install uv if you haven't
curl -LsSf https://astral.sh/uv/install.sh | sh

# Create venv with Python 3.13 (required for spaCy compatibility)
uv venv --python 3.13

# Install dependencies
uv sync --all-extras

# The spaCy model downloads automatically on first use, or install manually:
uv pip install https://github.com/explosion/spacy-models/releases/download/it_core_news_lg-3.8.0/it_core_news_lg-3.8.0-py3-none-any.whl

Commands

# Run tests
uv run pytest

# Run tests with coverage
uv run pytest --cov

# Lint
uv run ruff check .

# Format
uv run ruff format .

# Type check
uv run mypy src/

Demo

Test with real timeline content:

# Create symlinks to timeline repos (adjust paths as needed)
cd demo
ln -s ../../timeline-anima/content anima
ln -s ../../timeline-eros/content eros

# Run demo
uv run python demo/run_demo.py

Example output:

============================================================
📚 Timeline: ANIMA
============================================================
📖 Chapters found: 55
📝 Total words: 199,519
📁 Arcs: ['anima', 'matilde']
👤 POVs: ['nic']

============================================================
📚 Timeline: EROS
============================================================
📖 Chapters found: 465
📝 Total words: 733,034
📁 Arcs: ['ale', 'ele', 'gio', 'ro', 'work']
👤 POVs: ['Ele', 'Nic', 'ale', 'angi', 'gio', 'nic', 'ro', 'vi']

============================================================
🔍 NER Demo (Named Entity Recognition)
============================================================
📄 Sample: anima/ep01/ch001
🏷️  Entities found: 33
   LOC: Malpensa, Terminal 2
   ORG: LinkedIn, Ryanair
   PER: GioGio, Cristo

Project Structure

src/echoes_mcp/
├── __init__.py          # Package version
├── cli.py               # CLI interface (click)
├── server.py            # MCP server
├── database/
│   ├── lancedb.py       # LanceDB operations
│   └── schemas.py       # Pydantic schemas
├── indexer/
│   ├── scanner.py       # Filesystem scanner
│   ├── extractor.py     # Entity extraction (Gemini/spaCy)
│   ├── embeddings.py    # Embedding models
│   └── spacy_utils.py   # spaCy with auto-download
├── prompts/
│   ├── handlers.py      # Prompt loading and MCP integration
│   ├── substitution.py  # Placeholder replacement
│   └── validation.py    # Arc/argument validation
└── tools/
    ├── words_count.py   # Word counting
    ├── stats.py         # Statistics
    ├── search.py        # Search operations
    └── index.py         # Indexing tool

demo/
├── run_demo.py          # Demo script
├── anima -> ...         # Symlink to timeline-anima/content
└── eros -> ...          # Symlink to timeline-eros/content

Tech Stack

Purpose Tool
Package manager uv
Linter/Formatter Ruff
Type checker mypy
Testing pytest
Vector DB LanceDB
Embeddings sentence-transformers
NER spaCy (Italian model)
Entity Extraction Gemini 3 Flash (primary) / spaCy (fallback)
Knowledge Graph LlamaIndex

Node.js Comparison

If you're coming from Node.js:

Node/npm Python/uv
npm install uv sync
npm add pkg uv add pkg
npm run test uv run pytest
npx cmd uv run cmd
package.json pyproject.toml
node_modules/ .venv/
Biome Ruff
Vitest pytest

License

MIT


Part of the Echoes project - a multi-POV digital storytelling platform.

Metadata

Release files for echoes-mcp-server 5.8.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for echoes-mcp-server 5.8.1
File Size Uploaded Provenance
echoes_mcp_server-5.8.1.tar.gz 306.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for echoes-mcp-server 5.8.1
File Interpreter ABI Platform
echoes_mcp_server-5.8.1-py3-none-any.whl Python 3 none any Details

Total release size: 338.5 kB

Release files / echoes_mcp_server-5.8.1.tar.gz

Download URL echoes_mcp_server-5.8.1.tar.gz
Size 306.8 kB
Tags Source
SHA-256 checksum
How to use checksums
acdfbb73c05a3094e038b2942b593320f6d0471fc1297045fb6b655703742e63
BLAKE2b-256 checksum
How to use checksums
468db04b4ca9b883bf542b5419761879a13e75ea75c966eab3c56381f70cec7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 26, 2025.

Transparency log

Release files / echoes_mcp_server-5.8.1-py3-none-any.whl

Download URL echoes_mcp_server-5.8.1-py3-none-any.whl
Size 31.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b074c9c191889843dc1e06312d63b2cb864735971793601c30e6c19844c07bc9
BLAKE2b-256 checksum
How to use checksums
68ca45d26b29779a94e46dea8eaa07659edb6522c61ce7921e9eef1b5f3757ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 26, 2025.

Transparency log

Security for echoes-mcp-server 5.8.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for echoes_mcp_server-5.8.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 26, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page