mcp-agent

mcp-agent

Calendar and task management with kernel-level scraping for robust parsing, and integrates with DocMost wiki as source of truth.

Category
访问服务器

README

mcp-agent

SimpleMCP Agent — Calendar & Task management with kernel-level scraping.


Architecture

┌─────────────────────────────────────────────────────────────────────┐
│                           USER / CLI                                │
└───────────────────────────────┬─────────────────────────────────────┘
                                │
                         ┌──────▼──────┐
                         │  MCP Host   │   mcp_host/host.py
                         │  (REPL/API) │
                         └──────┬──────┘
                                │
                         ┌──────▼──────┐
                         │    Agent    │   mcp_host/agent.py
                         │ (ReAct loop)│   DocMost-first system prompt
                         └──────┬──────┘
                                │
               ┌────────────────┼────────────────┐
               │                │                │
        ┌──────▼──────┐  ┌──────▼──────┐        │
        │  MCP Client │  │  Anthropic  │        │
        └──────┬──────┘  │    LLM      │        │
               │  stdio  └─────────────┘        │
        ┌──────▼────────────────────────┐        │
        │         MCP Server            │        │
        │  Tools                        │        │
        │  ├── calendar (list/search)   │        │
        │  ├── tasks (CRUD)             │        │
        │  └── docmost (source-of-truth)│        │
        └───────┬───────────────┬───────┘        │
                │               │                │
        ┌───────▼──────┐ ┌──────▼────────────┐   │
        │Kernel Scraper│ │ DocMost REST API  │   │
        │ (httpx+BS4)  │ │ integrations/     │   │
        └───────┬──────┘ │ docmost/client.py │   │
                │        └──────────────────-┘   │
        ┌───────▼──────┐          │               │
        │Calendar Feed │ ┌────────▼──────────┐    │
        │ (ICS / HTML) │ │ DocMost Instance  │    │
        └──────────────┘ │ (self-hosted wiki)│    │
                         └───────────────────┘    │

Layer Responsibilities

Layer Module Role
Config config/ Pydantic settings, .env loading
Scraper — Kernel scraper/kernel/ Raw async HTTP, no browser
Scraper — Session scraper/kernel/session_manager.py Cookie jar, auth tokens, idle recycling
Scraper — Time scraper/kernel/time_manager.py Rate limiting, politeness delays
Scraper — Parser scraper/parsers/calendar_parser.py BS4 kernel parsing (JSON-LD → Microdata → data-* → ICS)
DocMost Client integrations/docmost/client.py REST API client for DocMost wiki
DocMost Models integrations/docmost/models.py Page, Space, SearchResult dataclasses
DocMost Content integrations/docmost/content.py ProseMirror JSON → Markdown converter
MCP Server mcp_server/ Tool & resource registration, MCP protocol
MCP Client mcp_client/ Server connection, tool invocation, schema conversion
LLM llm/ Abstract BaseLLM + Anthropic implementation
Agent mcp_host/agent.py ReAct loop; DocMost-first system prompt
Host mcp_host/host.py Lifecycle, REPL, programmatic API
Use Case use_cases/calendar_tasks/ Demo workflow, entry point

DocMost — Source of Truth

DocMost is the team wiki. The agent is instructed to treat it as the authoritative source of truth for all factual questions. The integration has two modes:

Mode 1 — REST API (default, any DocMost version)

DOCMOST_BASE_URL=https://docs.yourcompany.com
DOCMOST_API_KEY=<personal API key from Settings > API keys>
DOCMOST_DEFAULT_SPACE_ID=<optional space UUID>

The REST layer (integrations/docmost/) handles:

  • Full-text search → POST /api/search
  • Page read (ProseMirror JSON → Markdown) → POST /api/pages/info
  • Page create/update (Markdown input) → POST /api/pages/create, /api/pages/update
  • List spaces and pages → GET /api/spaces, POST /api/pages

Mode 2 — Native MCP (DocMost enterprise)

DocMost exposes its own MCP endpoint at {BASE_URL}/mcp. If you have an enterprise license and MCP enabled (Settings > AI & MCP > MCP tab), set:

DOCMOST_USE_NATIVE_MCP=true

Then add to claude_desktop_config.json:

{
  "mcpServers": {
    "docmost": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://docs.yourcompany.com/mcp",
               "--header", "Authorization: Bearer YOUR_API_KEY"]
    }
  }
}

DocMost tools exposed via MCP

Tool Description
docmost_search Primary source-of-truth lookup — call before answering factual questions
docmost_get_page Retrieve full page content as Markdown
docmost_list_spaces Discover available knowledge spaces
docmost_list_pages Browse pages in a space (paginated)
docmost_create_page Write new wiki page (meeting notes, summaries)
docmost_update_page Append or replace content on existing page
docmost_delete_page Remove a page

Agent source-of-truth flow

User asks a question
        │
        ▼
 docmost_search("keywords from question")
        │
        ├─ Results found → docmost_get_page(page_id) → ground answer in wiki
        │
        └─ No results → fall back to calendar/task data + flag as inferred
        │
        ▼
 Produce response citing wiki page title + URL
        │
        ▼
 (Optional) docmost_create_page / docmost_update_page to persist findings


Kernel Scraping vs Layout Scraping

This project deliberately uses kernel-level scraping — we operate at the semantic/structural layer of HTML, not the visual/CSS layer.

Approach Targets Stability
Layout scraping CSS classes, visual position ❌ Breaks on every redesign
Kernel scraping JSON-LD, Microdata, data-*, ICS, ARIA ✅ Survives redesigns

Parser strategy (priority order)

1. JSON-LD        <script type="application/ld+json"> Event schema
2. Microdata      itemtype="https://schema.org/Event"
3. data-* attrs   data-event-id, data-start-time, data-event-title …
4. ICS/iCal       Raw text; no external library needed

Tools exposed by the MCP Server

Tool Description
list_events Upcoming events within N days
get_event_by_uid Single event by UID
search_events Full-text search across title + description
get_todays_schedule Today's events
create_task Create a task (optionally linked to an event)
list_tasks List tasks with status/priority filters
update_task Update any task field
delete_task Delete a task

Quick Start

# 1. Install
bash scripts/install.sh

# 2. Configure
#    Edit .env — set ANTHROPIC_API_KEY and CALENDAR_FEED_URL

# 3. Run interactive agent
source .venv/bin/activate
mcp-agent

# 4. Or run the demo sequence
mcp-agent --demo

# 5. Or run just the MCP server (for use with Claude Desktop etc.)
mcp-server

Project Structure

mcp-agent/
├── config/                     # Pydantic settings
│   └── settings.py
│
├── integrations/               # ← NEW: third-party integrations
│   └── docmost/
│       ├── client.py           # DocMost REST API async client
│       ├── models.py           # Page, Space, SearchResult dataclasses
│       └── content.py          # ProseMirror JSON → Markdown converter
│
├── scraper/                    # Kernel scraper layer
│   ├── kernel/
│   │   ├── http_client.py
│   │   ├── session_manager.py
│   │   └── time_manager.py
│   └── parsers/
│       └── calendar_parser.py
│
├── mcp_server/                 # MCP Server
│   ├── server.py
│   ├── tools/
│   │   ├── calendar.py
│   │   ├── tasks.py
│   │   └── docmost.py          # ← NEW: DocMost tool handlers
│   └── resources/
│       └── calendar_resource.py
│
├── mcp_client/
│   └── client.py
│
├── llm/
│   ├── base.py
│   └── anthropic_llm.py
│
├── mcp_host/
│   ├── agent.py                # DocMost-first system prompt
│   └── host.py
│
├── use_cases/
│   └── calendar_tasks/
│       └── workflow.py
│
├── tests/
│   ├── test_scraper.py
│   ├── test_session_time.py
│   ├── test_tasks.py
│   └── test_docmost.py         # ← NEW
│
├── scripts/install.sh
├── pyproject.toml
└── .env.example

Running Tests

pytest tests/ -v

All tests are offline — no network or API key required.


Claude Desktop Integration

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "calendar-agent": {
      "command": "python",
      "args": ["/path/to/mcp-agent/mcp_server/server.py"],
      "env": {
        "ANTHROPIC_API_KEY": "sk-ant-...",
        "CALENDAR_FEED_URL": "https://your-calendar.example.com/feed.ics"
      }
    }
  }
}

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选