pharos-ai-doc-genie

pharos-ai-doc-genie

Enables AI agents to generate real Office documents (.pptx, .docx, .xlsx) and source code from natural language via MCP protocol.

Category
访问服务器

README

Pharos AI Doc Genie — Document Generation Skill

Built for Pharos Skill-to-Agent Dual Cascade Hackathon — Phase 1

A reusable, standardized Skill module that enables any AI Agent in the Pharos ecosystem to generate real Office documents (.pptx, .docx, .xlsx) and source code from natural language — powered by DashScope LLM API.

License: MIT Node.js MCP


🎯 Problem Statement

AI Agents in the Pharos economy need to produce tangible outputs — not just text responses. When an agent helps a user prepare a business proposal, it should deliver a real .docx file. When it analyzes data, it should produce an actual .xlsx spreadsheet. When it creates a presentation, it should output a .pptx that opens in PowerPoint.

Existing solutions either:

  • Generate plain text/Markdown that requires manual formatting
  • Depend on proprietary cloud APIs with unpredictable availability
  • Lack standardized interfaces for agent-to-skill communication

Pharos AI Doc Genie fills this gap with a production-ready, standardized Skill that generates real Office files and code from natural language.


🧩 Skill Architecture

┌──────────────────────────────────────────────┐
│                AI Agent (Pharos)              │
│         (Any MCP-compatible Agent)            │
└─────────────────┬────────────────────────────┘
                  │ MCP Protocol (JSON-RPC 2.0)
                  │ stdio transport
┌─────────────────▼────────────────────────────┐
│          Pharos AI Doc Genie Skill            │
│                                               │
│  ┌──────────┐ ┌──────────┐ ┌──────────┐      │
│  │ generate │ │ generate │ │ generate │      │
│  │ _word    │ │  _ppt    │ │ _excel   │ ...  │
│  └────┬─────┘ └────┬─────┘ └────┬─────┘      │
│       │            │            │             │
│  ┌────▼────────────▼────────────▼──────┐      │
│  │        LLM (DashScope qwen)         │      │
│  │    Content Generation Layer         │      │
│  └────────────────┬────────────────────┘      │
│                   │                            │
│  ┌────────────────▼────────────────────┐      │
│  │     Python (python-pptx, etc.)      │      │
│  │     File Conversion Layer           │      │
│  │     Markdown → real .pptx/.docx     │      │
│  └────────────────┬────────────────────┘      │
└───────────────────┼───────────────────────────┘
                    │
         ┌──────────▼──────────┐
         │   Output Files      │
         │  .pptx  .docx       │
         │  .xlsx  .py/.js/... │
         └─────────────────────┘

Key design principles:

  • Stateless: Each tool call is independent — no session state needed
  • Idempotent: Same input produces consistent output structure
  • Self-contained: Zero external service dependencies beyond the LLM API
  • Standardized: MCP protocol ensures any compatible Agent can call it

🛠️ Tools (4 Skills)

Tool Output Use Case Model
generate_ppt .pptx presentation Pitch decks, training, reports qwen3.7-plus
generate_word .docx document Proposals, manuals, reports qwen3.7-plus
generate_excel .xlsx spreadsheet Data tables, financials, inventory qwen3.7-plus
generate_code Source code (.py/.js/.go/...) Rapid prototyping, boilerplate qwen-long-latest

Tool Schema Examples

generate_ppt: Create a professional presentation

{
  "name": "generate_ppt",
  "arguments": {
    "topic": "AI in Enterprise: 2026 Trends",
    "requirements": "Executive summary for CTO audience, 12 slides, focus on ROI and adoption metrics",
    "slide_count": 12
  }
}

generate_excel: Generate structured data

{
  "name": "generate_excel",
  "arguments": {
    "description": "Q2 2026 sales data: Region, Product Category, Revenue, Units Sold, Growth%, Top Salesperson",
    "rows": 30
  }
}

🚀 Quick Start

Prerequisites

  • Node.js >= 18
  • Python 3.8+ with python-pptx, python-docx, openpyxl
  • DashScope API Key (Alibaba BaiLian)

Install Python dependencies

pip install python-pptx python-docx openpyxl

Run the MCP Server

node src/mcp-server.js

The server listens on stdin/stdout using the MCP stdio transport. Configure your Agent's MCP client to launch this process.

Test with MCP Inspector

npx @modelcontextprotocol/inspector node src/mcp-server.js

Manual Test (JSON-RPC via pipe)

echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}' | node src/mcp-server.js

📁 Project Structure

pharos-ai-doc-genie/
├── src/
│   └── mcp-server.js       # MCP stdio server (self-contained)
├── convert.py               # Python: Markdown → .pptx/.docx/.xlsx
├── output/                  # Generated Office files
├── package.json             # Node.js project config
├── README.md                # This file
├── LICENSE                  # MIT License
└── .gitignore

🔌 Integration

With Claude Desktop

{
  "mcpServers": {
    "pharos-ai-doc-genie": {
      "command": "node",
      "args": ["/absolute/path/to/pharos-ai-doc-genie/src/mcp-server.js"]
    }
  }
}

With OpenAI Agents

The server uses standard MCP tool schemas that are directly compatible with OpenAI function calling format. Simply configure your Agent to launch the server as an MCP subprocess.

With Pharos Agents

Pharos Agents can call this Skill via the MCP protocol. Once the Skill is registered, Agents discover it through tools/list and call it through tools/call.


🧪 Testing

# List available tools
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | node src/mcp-server.js

# Generate a Word document
echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"generate_word","arguments":{"topic":"Project Proposal: AI Chatbot","requirements":"A formal proposal for building an enterprise AI chatbot. Include: executive summary, technical approach, timeline, budget estimate.","length":"medium"}}}' | node src/mcp-server.js

# Generate code
echo '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"generate_code","arguments":{"requirement":"A Python async function that fetches data from a REST API with exponential backoff retry logic","language":"python","comments":"en"}}}' | node src/mcp-server.js

⚡ Performance

Tool Avg. Response Time Max Tokens File Size
generate_word ~20-40s 16384 30-50 KB (.docx)
generate_ppt ~30-60s 16384 25-40 KB (.pptx)
generate_excel ~15-25s 16384 5-15 KB (.xlsx)
generate_code ~15-30s 16384 N/A (text)

🔒 Security

  • No API key exposure: The DashScope API key is server-side only and never sent to Agents
  • Input validation: All Agent inputs are validated before processing
  • Output isolation: Generated files are written to a dedicated output directory
  • No persistent state: Each tool call is isolated with no cross-call data leakage

🗺️ Roadmap

Phase 2 (Agent Arena)

  • [ ] Deploy as a persistent Skill on Pharos chain
  • [ ] On-chain billing per document generation
  • [ ] NFT-based document ownership and verification
  • [ ] Multi-agent collaborative document editing

Beyond

  • [ ] PDF generation and manipulation
  • [ ] Image-to-document conversion (OCR → formatted docx)
  • [ ] Multi-language document templates
  • [ ] Real-time collaborative editing via WebSocket

👤 Author

huimingchen081-beep (GitHub)

Built for the Pharos Skill-to-Agent Dual Cascade Hackathon — Phase 1 (Skill Hackathon).


📄 License

MIT License — see LICENSE for details.


🙏 Acknowledgments

  • Pharos Network — for building the AI Agent economy infrastructure
  • DashScope (Alibaba BaiLian) — for the LLM API powering content generation
  • Model Context Protocol (Anthropic) — for the standardized agent-skill communication protocol
  • python-pptx / python-docx / openpyxl — for Office file generation

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选