Token导航 LogoToken导航TokenDH.com
Word MCP Agent logo
文档知识stdio官方级别未说明来源级核验

Word MCP Agent

MCP Server

基于MCP协议的智能Word文档助手,通过自然语言指令创建、编辑和管理文档,支持多Agent协作和三层记忆系统。

工具数

0

提示词数

0

GitHub Stars

11

资源数

0
Python文档处理知识管理

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

ceilf6

提供方

ceilf6

最后核验

2026/5/17 20:23

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

python3 -m venv venv

详细介绍

Word MCP Agent

An intelligent Word document assistant based on MCP (Model Context Protocol). Create, edit, and manage Word documents using natural language commands, with the ability toMulti Agent Collaborationandmemory ability.

✨ Core Features

🤖 Multi Agent Pipeline

The document creation adopts three-stage Agent collaboration to ensure high-quality output:

用户请求
    ↓
┌─────────────────────────────────────┐
│ 🔍 结构化 Agent (Structurizer)       │
│ • 解析用户意图                        │
│ • 提取参数(文件名、标题、内容要求)     │
│ • 识别缺失信息,向用户提问              │
└─────────────────────────────────────┘
    ↓
┌─────────────────────────────────────┐
│ ✍️ 创作 Agent (Writer)               │
│ • 根据结构化数据生成内容               │
│ • 调整写作风格                        │
└─────────────────────────────────────┘
    ↓
┌─────────────────────────────────────┐
│ ⭐ 评审 Agent (Reviewer)             │
│ • 评估文档质量 (1-10分)               │
│ • 评分 < 7 → 返回创作Agent重写        │
│ • 最多 3 轮迭代优化                   │
└─────────────────────────────────────┘
    ↓
高质量文档输出

🧠 Three-layer memory system

Memory hierarchyDescriptionPersistence
Short term memoryThe conversation history of the current session (last 20 rounds)
working memoryThe context and temporary variables of the current task
long-term memoryUser preferences, important facts (automatically extracted)✅ JSON

Features:

  • Automatically extract user preferences (writing style, naming conventions, etc.)
  • Support multi session isolation (through) session_id
  • Long term memory automatically clears based on importance

📝 Document operation

FunctionDescription
📝 Create DocumentGenerate High Quality Documents through Multi Agent Pipeline
📖 Read DocumentExtract Document Text and Table Content
✏️ Update DocumentAdd Content, Insert Paragraphs, Replace Text
🗑️ Delete DocumentDelete the specified document
📋 List DocumentsView all created documents
📊 Add TableInsert Format Table into Document
🔍 Search ReplaceBulk Replace Text in Documents

🌐 外部能力

FunctionDescription
🔎 Google SearchRetrieve information and organize it into documents
🖼️ Image SearchSearch for Related Images
⬇️ Image DownloadDownload images from URL to local
🖼️ Insert ImageInsert Image into Document

📁 project structure

word-MCP-agent/
├── backend/                 # 后端服务
│   ├── server.py           # FastAPI 主服务器 (SSE + LLM Agent + 记忆)
│   ├── main.py             # MCP 工具定义
│   ├── agents.py           # 多 Agent 模块 (结构化/创作/评审)
│   ├── memory.py           # 三层记忆系统
│   ├── mcpconfig.json      # 配置文件 (LLM、API Keys)
│   ├── pyproject.toml      # Python 依赖
│   ├── start.sh            # 启动脚本
│   ├── word/               # 生成的文档存放目录
│   └── memory_store/       # 长期记忆持久化目录
│
├── frontend/                # 前端应用
│   ├── index.tsx           # React 主组件
│   ├── __entry.tsx         # React 入口
│   ├── index.html          # HTML 入口
│   ├── vite.config.ts      # Vite 配置
│   ├── tsconfig.json       # TypeScript 配置
│   └── package.json        # Node 依赖
│
└── README.md

🚀 Quick Start

1. Configure the backend

cd backend

# 创建虚拟环境并安装依赖
python3 -m venv venv
source venv/bin/activate
pip install -e .

# 或使用启动脚本 (自动处理环境)
./start.sh

2. Configuration mcpconfig.json

edit backend/mcpconfig.jsonFill in your API key:

{
  "defaultLLM": {
    "baseURL": "https://api.siliconflow.cn/v1",
    "apiToken": "your-api-token",
    "model": "deepseek-ai/DeepSeek-V3"
  },
  "google": "your-serper-api-key"
}
  • LLMSupport any large model compatible with OpenAI
  • Google: Serper.dev API Key (for search function)

3. Start the backend service

cd backend
./start.sh
# 或
source venv/bin/activate && python server.py

After the server is started, it runs on http://localhost:8080

4. Start the front-end

cd frontend
npm install
npm run dev

The front-end development server runs on http://localhost:3000

📡 API endpoint

Core endpoint

EndpointMethodDescription
/GETServer Status
/toolsGETGet the list of available tools
/documentsGETGet document list
/callPOSTDirectly call the tool
/sseGETSSE connection
/sse/agentPOSTLLM Agent (SSE streaming, with memory)
/chatPOSTLLM Agent (non streaming)

Memory management endpoint

EndpointMethodDescription
/memory/sessionsGETList all sessions
/memory/session/{id}GETGet session information
/memory/session/{id}DELETEDelete session
/memory/session/{id}/clearPOSTClear short-term memory
/memory/session/{id}/historyGETRetrieve conversation history
/memory/session/{id}/rememberPOSTAdd Long Term Memory
/memory/session/{id}/recallGETSearch for Long Term Memory

💡 Usage example

Basic document creation

创建一个关于 React 的介绍文档
列出所有文档

Multi Agent Collaboration

When the input is vague, the structured agent will ask for more information:

用户: 帮我写一份文档
助手: 请问文档要叫什么名字?
用户: 年度报告
助手: [创作Agent生成内容] → [评审Agent评分8/10] → 文档创建成功!

Combining search

帮我搜索一下人工智能的最新发展,然后写成一篇文档

insert image

创建一份关于圣诞节的文档并插入一些精美的相关图片

Use memory function

// 前端发送请求时指定 session_id
fetch('/sse/agent', {
  method: 'POST',
  body: JSON.stringify({
    query: "帮我创建一个文档",
    session_id: "user_123"  // 不同用户使用不同 session_id
  })
})

🔧 Available tools

Documentation Tool

Tool NameDescription
create_document_with_agents【 Recommendation 】 Multi Agent Pipeline Creation Document
structurize_inputOnly structurally parse user input
create_documentCreate documents directly (without quality checks)
read_documentRead document content
update_documentUpdate document
delete_documentDelete document
list_documentsList all documents
add_tableAdd Table
search_replaceSearch for replacement

search tool

Tool NameDescription
google_searchGoogle search for text information
google_image_searchGoogle Image Search
download_imageDownload images locally
insert_imageInsert image into document

Memory tools

Tool NameDescription
save_to_memorySave to long-term memory
recall_memoryRetrieve from long-term memory
get_memory_statsRetrieve memory statistics

🏗️ tech stack

back-end

  • Python 3.10+
  • FastAPI - Web Framework
  • Python docx - Word Document Processing
  • Httpx - HTTP client
  • MCP (Model Context Protocol) - Tool Protocol

Multi Agent System

  • Self developed Agent Pipeline
  • Support AgentScope integration (optional)

Memory system

  • Three layer memory architecture
  • JSON file persistence
  • Automatically clear by importance

front-end

  • React 18
  • TypeScript
  • Vite - Build Tool
  • SSE (Server Sent Events) - Real time communication

AI

  • DeepSeek-V3/Other Large Models
  • Serper.dev (Google Search API)

🔌 Expand development

Add a new agent

In backend/agents.py Inheritance in the Middle BaseAgent

class MyAgent(BaseAgent):
    def __init__(self):
        super().__init__("MyAgent", "系统提示词")
    
    def process(self, input_data):
        # 处理逻辑
        return result

Add new tool

In backend/server.py of TOOLS and TOOL_HANDLERS Registration in China:

TOOLS["my_tool"] = {
    "description": "工具说明",
    "parameters": {...}
}

def my_tool_handler(**kwargs):
    return {"success": True, "result": ...}

TOOL_HANDLERS["my_tool"] = my_tool_handler

Custom Memory Retrieval

In backend/memory.py of Session._extract_to_long_term Add rules in:

def _extract_to_long_term(self, role: str, content: str):
    if "我喜欢" in content:
        self.long_term.add(
            f"用户偏好: {content}",
            category="preference",
            importance=0.8
        )

📊 system architecture

┌─────────────────────────────────────────────────────────────────┐
│                         前端 (React)                             │
│                    http://localhost:3000                        │
└────────────────────────────┬────────────────────────────────────┘
                             │ SSE / HTTP
                             ▼
┌─────────────────────────────────────────────────────────────────┐
│                    FastAPI Server                               │
│                    http://localhost:8080                        │
├─────────────────────────────────────────────────────────────────┤
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐           │
│  │   LLM 调用    │  │  工具执行器   │  │  SSE 流      │            │
│  └──────┬───────┘  └──────┬───────┘  └──────────────┘           │
│         │                 │                                     │
│  ┌──────▼─────────────────▼──────┐                              │
│  │        多 Agent Pipeline       │                             │
│  │  ┌────────┐ ┌────────┐ ┌────────┐                            │
│  │  │结构化   │→│创作     │→│评审    │                            │
│  │  │Agent   │ │Agent   │ │Agent   │                            │
│  │  └────────┘ └────────┘ └────────┘                            │
│  └───────────────────────────────┘                              │
│                                                                 │
│  ┌─────────────────────────────────────────────────────────┐    │
│  │                    记忆系统                              │    │
│  │  ┌──────────┐  ┌──────────┐  ┌──────────────────────┐   │    │
│  │  │短期记忆   │  │工作记忆    │  │长期记忆 (JSON持久化)│  │  │     │
│  │  └──────────┘  └──────────┘  └──────────────────────┘   │    │
│  └─────────────────────────────────────────────────────────┘    │
│                                                                 │
│  ┌─────────────────────────────────────────────────────────┐    │
│  │                    工具集                                │    │
│  │  文档操作 │ 搜索功能 │ 图片处理 │ 记忆操作                   │    │
│  └─────────────────────────────────────────────────────────┘    │
└─────────────────────────────────────────────────────────────────┘
                             │
                             ▼
              ┌──────────────────────────┐
              │   外部服务                │
              │  • LLM API               │
              │  • Serper.dev (搜索)      │
              └──────────────────────────┘

📝 Changelog

v2.0.0

  • ✨ Add multi-agent pipeline (structured/creative/review)
  • ✨ Add a three-layer memory system
  • ✨ Add Memory Management API
  • 🔧 Optimize the quality of document creation

v1.0.0

  • 🎉 初始版本
  • 📝 Basic document operations
  • 🌐 Google Search Integration
  • 🖼️ Image search and insertion

License

MIT

目录标签

目录标签

Python文档处理知识管理Word文档处理本地部署多Agent协作自然语言交互记忆系统文档自动化

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

api-key

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdioapi-key部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP