Skip to main content

MCP server for Echoes storytelling platform with Narrative Knowledge Graph

Project description

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
  • Statistics: Aggregate word counts, POV distribution, and more

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

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

# Search
echoes search "Alice meets Bob"
echoes search "Alice" --type entities

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

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 (LlamaIndex)
โ”‚   โ”œโ”€โ”€ embeddings.py    # Embedding models
โ”‚   โ””โ”€โ”€ spacy_utils.py   # spaCy with auto-download
โ””โ”€โ”€ 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)
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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

echoes_mcp_server-5.0.1.tar.gz (292.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

echoes_mcp_server-5.0.1-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file echoes_mcp_server-5.0.1.tar.gz.

File metadata

  • Download URL: echoes_mcp_server-5.0.1.tar.gz
  • Upload date:
  • Size: 292.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for echoes_mcp_server-5.0.1.tar.gz
Algorithm Hash digest
SHA256 47eb75660f9b4a8fe788509575e90ebb1424ba278b8fb9fe253cc82bf1d5c316
MD5 bde2dd6e967713662e7cd35b5a6ea2de
BLAKE2b-256 dafe652cf1882dbd8347842ee700847d71c14985aa6bb393e3bc5bcfc7f639ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for echoes_mcp_server-5.0.1.tar.gz:

Publisher: ci.yml on echoes-io/mcp-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file echoes_mcp_server-5.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for echoes_mcp_server-5.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 50d42180aa8d855170e2d0a5341e3887e5af79479ecfd80edca1f28b38716e11
MD5 2cb07ecdb525f69b46dd4e0f5092e9af
BLAKE2b-256 178dddd79a123d41747088e4b849ed30a2fcc9f313ac4eb1fc7f3555d3e7417d

See more details on using hashes here.

Provenance

The following attestation bundles were made for echoes_mcp_server-5.0.1-py3-none-any.whl:

Publisher: ci.yml on echoes-io/mcp-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page