OneNote MCP Server
Connects to OneNote via Microsoft Graph and exposes tools to list notebooks, sections, pages, and read page content.
README
OneNote MCP Server
MCP server (SSE & Streamable HTTP) that connects to OneNote via Microsoft Graph and exposes tools to list your notes and read each note’s content. Built with the official Model Context Protocol (MCP) Python SDK and a clean, layered architecture.
Features
- Transports: Streamable HTTP (default) and SSE (Server-Sent Events)
- Tools:
list_notes— list all OneNote notebookslist_note_sections— list sections in a notebooklist_note_pages— list pages (in a section or all)read_note_content— get the HTML content of a page
- Auth: Microsoft Graph via Azure Identity (delegated or application)
Architecture
src/onenote_mcp/
├── domain/ # Models and ports (interfaces)
│ ├── models.py # Notebook, Section, Page
│ └── ports.py # OneNoteGateway
├── application/ # Use cases
│ └── use_cases.py # list_notebooks, list_sections, list_pages, get_note_content
├── infrastructure/ # Microsoft Graph
│ └── graph_client.py # GraphOneNoteGateway
├── server.py # MCP FastMCP app + tools
└── main.py # Entrypoint (SSE / Streamable HTTP)
- Domain: entities and gateway interface; no framework or Graph details.
- Application: use cases that call the gateway.
- Infrastructure: Graph API implementation of the gateway.
- Server: MCP (FastMCP) tools that use the use cases and lifespan-injected gateway.
Requirements
- Python ≥ 3.10
- Azure app registration with Notes.Read (delegated) or Notes.Read.All (application)
Setup
1. Clone and install
cd onenote
python3 -m venv .venv
source .venv/bin/activate # or .venv\Scripts\activate on Windows
pip install -e .
This installs the package in editable mode so onenote_mcp is on your path. Alternatively:
pip install -r requirements.txt
pip install -e .
Or with uv:
uv sync
2. Azure app registration
- In Azure Portal → App registrations → New registration (name e.g. "OneNote MCP").
- API permissions → Add permission → Microsoft Graph → Delegated:
Notes.Read(orNotes.ReadWrite)User.Read
- Authentication → Add a platform → Mobile and desktop applications → add a redirect URI (e.g.
http://localhost:8400; must matchAZURE_REDIRECT_URIin.env) → Save. Then set Allow public client flows = Yes. - In
.env: setAZURE_CLIENT_ID; optionallyAZURE_TENANT_IDandAZURE_REDIRECT_URI(defaulthttp://localhost:8400). - For application (app-only) auth instead: add Application permission
Notes.Read.All, create a client secret, and setONENOTE_USER_ID.
Enterprise: admin consent
In work or school (organization) tenants, your IT admin may need to grant consent for the app before you can access OneNote. If you see an error like "Need admin approval" or "Need permission to access resources in your organization that only an admin can grant":
- Ask your admin to grant consent for the app (your app’s Application (client) ID from Azure).
- Admin steps (Azure Portal): App registrations → select the app → API permissions → click Grant admin consent for <Your org>.
- Alternatively, the admin can use Enterprise applications → select the app → Permissions → Grant admin consent.
After admin consent is granted, sign in again (or run the MCP server again); the app will then have permission to access OneNote on behalf of users in your organization.
3. Environment
cp .env.example .env
- Delegated (browser login): set
AZURE_CLIENT_ID(and optionallyAZURE_TENANT_ID) to your app registration from step 2. First run will open the browser to sign in. - Application (app-only): set
AZURE_TENANT_ID,AZURE_CLIENT_ID,AZURE_CLIENT_SECRET, andONENOTE_USER_ID.
Running the server
If you get ModuleNotFoundError: No module named 'onenote_mcp', install the package first: pip install -e .
Both SSE and Streamable HTTP run on the same server (no config to choose):
python -m onenote_mcp.main
# or after pip install -e .
onenote-mcp
Custom host/port:
PORT=3000 python -m onenote_mcp.main
HOST=0.0.0.0 PORT=8000 python -m onenote_mcp.main
Connecting a client
Both transports are available on the same server. Use whichever your client supports.
Streamable HTTP — single URL:
http://localhost:8000/mcp(or yourHOST/PORT)
{
"mcpServers": {
"onenote": {
"type": "streamable-http",
"url": "http://localhost:8000/mcp"
}
}
}
SSE — connect to the SSE endpoint; the server will tell the client where to POST messages:
- SSE:
GET http://localhost:8000/sse - Messages:
POST http://localhost:8000/messages/(with?session_id=...from the first SSE event)
{
"mcpServers": {
"onenote": {
"type": "sse",
"url": "http://localhost:8000/sse"
}
}
}
Tools reference
| Tool | Description |
|---|---|
list_notes |
List all OneNote notebooks. Optional: user_id (for app-only). |
list_note_sections |
List sections in a notebook. Required: notebook_id. Optional: user_id. |
list_note_pages |
List pages; optional section_id to limit to one section. Optional: user_id. |
read_note_content |
Get HTML content of a page. Required: page_id. Optional: user_id. |
Use IDs from list_notes / list_note_sections / list_note_pages as inputs to the next tool.
Testing
Install dev dependencies and run tests (mock OneNote gateway, no Azure credentials):
pip install -e ".[dev]"
# or
pip install -r requirements-dev.txt
pytest tests/ -v
Tests use a mock gateway and run offline. They cover:
- Use cases:
list_notebooks,list_sections,list_pages,get_note_contentwith mock data - Tool output format: markdown/HTML shape of tool responses
- App structure: combined app mounts
/sseand/mcproutes
License
MIT.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。