Echoes MCP Server
Enables AI integration with the Echoes storytelling platform, providing narrative knowledge graph extraction, semantic search, and arc isolation.
README
Echoes MCP Server
Model Context Protocol server for AI integration with Echoes storytelling platform.
Features
- Narrative Knowledge Graph: Automatically extracts characters, locations, events, and their relationships using Gemini AI
- 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
Installation
npm install -g @echoes-io/mcp-server
Or run directly with npx:
npx @echoes-io/mcp-server --help
Requirements
- Node.js 20+
- Gemini API key (for entity extraction)
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
# Check narrative consistency
echoes check-consistency bloom
echoes check-consistency bloom --rules kink-firsts,outfit-claims
MCP Server
Configure in your MCP client (e.g., Claude Desktop, Kiro):
{
"mcpServers": {
"echoes": {
"command": "npx",
"args": ["@echoes-io/mcp-server"],
"cwd": "/path/to/timeline",
"env": {
"GEMINI_API_KEY": "your_api_key"
}
}
}
}
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
GEMINI_API_KEY |
Yes | - | API key for Gemini entity extraction |
ECHOES_GEMINI_MODEL |
No | gemini-2.5-flash |
Gemini model for extraction |
ECHOES_EMBEDDING_MODEL |
No | Xenova/e5-small-v2 |
HuggingFace embedding model |
ECHOES_EMBEDDING_DTYPE |
No | fp32 |
Quantization level: fp32, q8, q4 (see Performance Notes) |
HF_TOKEN |
No | - | HuggingFace token for gated models |
Available Tools
| Tool | Description |
|---|---|
words-count |
Count words and statistics in a markdown file |
index |
Index timeline content into LanceDB |
search |
Search chapters, entities, or relations |
stats |
Get aggregate statistics |
check-consistency |
Analyze arc for narrative inconsistencies |
timeline-overview |
Quick overview of all arcs: status, chapters, words, POVs |
graph-export |
Export knowledge graph in various formats |
history |
Query character/arc history (kinks, outfits, locations, relations) |
review-generate |
Generate review file for pending entity/relation extractions |
review-status |
Show review statistics for an arc |
review-apply |
Apply corrections from review file to database |
Available Prompts
| Prompt | Arguments | Description |
|---|---|---|
arc-resume |
arc, episode?, lastChapters? | Load complete context for resuming work on an arc |
new-chapter |
arc, chapter | Create a new chapter |
revise-chapter |
arc, chapter | Revise an existing chapter |
expand-chapter |
arc, chapter, target | Expand 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 |
Architecture
Content Hierarchy
Timeline (content directory)
└── Arc (story universe)
└── Episode (story event)
└── Chapter (individual .md file)
Arc Isolation
Each arc is treated as a separate narrative universe:
- Entities are scoped to arcs:
bloom:CHARACTER:Alice≠work:CHARACTER:Alice - Relations are internal to arcs
- Searches can be filtered by arc to avoid cross-arc contamination
Data Flow
┌─────────────────────────────────────────────────────────────┐
│ INDEXING PHASE │
├─────────────────────────────────────────────────────────────┤
│ 1. Scan content/*.md (filesystem scanner) │
│ 2. Parse frontmatter + content (gray-matter) │
│ 3. For each chapter: │
│ a. Extract entities/relations with Gemini API │
│ b. Generate embeddings (Transformers.js ONNX) │
│ c. Calculate word count and statistics │
│ 4. Save everything to LanceDB │
└─────────────────────────────────────────────────────────────┘
Development
# Install dependencies
npm install
# Run tests
npm test
# Run tests with coverage
npm run test:coverage
# Lint
npm run lint
# Type check
npm run typecheck
# Build
npm run build
Tech Stack
| Purpose | Tool |
|---|---|
| Runtime | Node.js 20+ |
| Language | TypeScript |
| Vector DB | LanceDB |
| Embeddings | @huggingface/transformers (ONNX) |
| Entity Extraction | Gemini AI |
| MCP SDK | @modelcontextprotocol/sdk |
| Testing | Vitest |
| Linting | Biome |
Performance Notes
Embedding Quantization
The default embedding model (Xenova/e5-small-v2) supports different quantization levels via ECHOES_EMBEDDING_DTYPE:
| Level | Speed | Quality | Memory | Recommendation |
|---|---|---|---|---|
fp32 |
Baseline | Best (100%) | High | Production with ample resources |
q8 |
2-3x faster | Excellent (99.6%) | 50% less | Recommended - optimal balance |
q4 |
3-4x faster | Good (99.1%) | 75% less | Resource-constrained environments |
Note: Some models like onnx-community/embeddinggemma-300m-ONNX don't support fp16. Always check model documentation.
Recommended setting:
export ECHOES_EMBEDDING_DTYPE=q8
License
MIT
Part of the Echoes project - a multi-POV digital storytelling platform.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。