Content
# HistorIQ
HistorIQ is an AI historical novel platform based on the Model Context Protocol (MCP) architecture. It integrates RAG (Retrieval-Augmented Generation), AI Agent, and locally deployed large language models (LLM) to allow users to ask about historical events, figures, and cultural themes in natural language. The system then generates contextualized responses through multi-step reasoning and knowledge retrieval.
## Core Highlights / Features
| Item | Description |
| ------------------- | --------------------------------------------------------- |
| 🧠 **MCP Architecture Driven** | Uses the "Model Context Protocol (MCP)" to divide Client / Server / Agent / RAG, modular and scalable. |
| ✍️ **Historical Novel Generation Model** | AI acts as a "historical novel writer", automatically generating chapters, character psychology, and literary narrative, supporting Markdown formatting. |
| 🧵 **Chapter-based Narrative Structure** | Each generation includes 4-6 chapters, with literary and plot-consistent titles and themes, directly publishable. |
| 📖 **Humanistic Literacy Enhancement** | Clearly guides AI to cite poetry, classic phrases, and historical quotes, allowing readers to appreciate historical and literary beauty. |
| 🌐 **Full Traditional Chinese Design** | Includes UI interface, prompts, and story content, all implemented in traditional Chinese, conforming to local cultural reading habits. |
| 🔊 **Voice Reading and Highlight Animation** | Implements Web Speech API, supporting story reading + highlighting current sentences, with guqin background music. |
| 🔁 **Continuation and Interactive Reinforcement** | Users can further click on functions like "Continue Story", "Style Rewrite", and "Three-sentence Summary" to add interactive story elements. |
| 📜 **RAG Integration** | Introduces Retrieval-Augmented Generation (RAG) module to supplement background knowledge. |
## MCP (Model Context Protocol)
#### This project follows the design principles of MCP (Model Context Protocol) and implements the following key modules and specifications:
| Module | Description | Implementation Status |
| ------------------ | ----------------------------------------------------- | ------ |
| `MCP Server` | Acts as the core mediator of the context protocol, handling multi-turn dialogue states, agent distribution, context management, and task scheduling | ✅ Completed |
| `MCP Client (Web)` | Provides user interaction entry, supporting problem input, context display, button interaction, etc. | ✅ Completed |
| `AI Agent` | Receives server task assignments, performing multi-step reasoning and role-based content generation | ✅ Completed |
| `RAG Retriever` | Retrieves external knowledge content (e.g., historical database) and returns context to AI models for use | ✅ Completed |
| `LLM Interface Module` | Supports local LLM (e.g., LM Studio) language model API calls and response parsing | ✅ Completed |
| `Function Menu Control` | Provides interactive buttons after story completion, such as "Continue Story", "Style Conversion", etc., and dispatches corresponding services by MCP Server | ✅ Completed |
| `Context Management Mechanism` | Each user has an independent session ID, recording historical Q&A context, providing context maintenance functionality | ✅ Completed |
| `Multi-module Decoupling Architecture` | Each module (RAG, Agent, Server, Client) has clear responsibilities and independent maintenance boundaries | ✅ Completed |
| `Extended Task Chain Design` | Supports story continuation branches and button-triggered tasks, such as "AI Lecture", "Summary Generation", etc. | ✅ Completed |
| `MCP Specification Compatibility` | Compliant with MCP's Request/Response and task hierarchy logic, scalable to more agents or tools | ✅ Preliminary Completion |
## Overall Architecture and Functional Module Overview
| Module Layer | Component | Description |
| ------------ | ---------------------- | ---------------------- |
| `MCP Client` | `index.html`, `app.py` | Front-end page and Web API entry |
| `MCP Server` | `mcp_server.py` | Implements all AI logic and service functions |
| `AI Agent` | `story_agent.py` | Calls LLM to generate content (Gemma) |
| `RAG` | `rag.py` | Vector search supplements knowledge background (embedded in prompt) |
## Services Provided by MCP Server
| Function | API | Function Description |
| ------------------ | ----------------- | --------------- |
| `stream_story()` | `/stream` | Generates historical novels based on input themes |
| `summarize()` | `/summarize` | Three-sentence summary of the story |
| `chapter_titles()` | `/chapter-titles` | Automatically generates chapter titles and summaries |
| `variant_style()` | `/variant-style` | Rewrites content in a specified style (e.g., poetic) |
| `continue_story()` | `/continue-story` | Continues the story from the original content and appends subsequent chapters |
## User Interaction Functions (Front-end Integration)
| Function Button | Description | Corresponding API |
| --------- | -------------- | ----------------- |
| `Start Reading` | Text reading with synchronized highlighting | Web Speech API |
| `Summary` | Generates a three-sentence concise summary | `/summarize` |
| `Chapters` | Chapter directory suggestions (including themes and descriptions) | `/chapter-titles` |
| `Style Change` | Poetic/epic style rewriting | `/variant-style` |
| `Continue Story` | Continues chapters, maintaining narrative coherence | `/continue-story` |
## Special Optimization Design Highlights
- ✅ Input field and function area fixed at the bottom
- ✅ AI streaming output, content stacked naturally from top to bottom
- ✅ Uses Markdown formatting for clear and beautiful display
- ✅ Guides AI to integrate historical poetry and classic quotes, enhancing humanistic literacy
- ✅ Basic RAG implantation, expandable for knowledge enhancement modules
## Front-end UI Screen Display
#### Initial Screen

#### Screen after Article Generation Completion

#### Screen after Clicking Summary Button

Connection Info
You Might Also Like
markitdown
Python tool for converting files and office documents to Markdown.
OpenAI Whisper
OpenAI Whisper MCP Server - 基于本地 Whisper CLI 的离线语音识别与翻译,无需 API Key,支持...
oh-my-opencode
Background agents · Curated agents like oracle, librarians, frontend...
BurpMCP-Ultra
The most comprehensive MCP server for Burp Suite Professional — 137 tools,...
Pepper
iOS dynamic library MCP for agents
pump-fun-sdk
Token creation launching, bonding curve trading, AMM migration, tiered fees,...