(by Rajesh Vijay) An MCP server that connects to Microsoft OneNote using the Microsoft Graph API. Reading notebooks, sections, and pages from OneNote,Creating new notebooks, sections, and pages in OneNote.
Documentation
OneNote MCP Server
A Model Context Protocol (MCP) server that provides AI assistants with access to Microsoft OneNote. This server enables AI models to read from and write to OneNote notebooks, sections, and pages.
Project Overview
This project implements an MCP server that connects to Microsoft OneNote using the Microsoft Graph API. It provides tools for:
Reading notebooks, sections, and pages from OneNote
Creating new notebooks, sections, and pages in OneNote
Converting HTML content to text for better RAG processing
Project Structure
onenote/
├── dist/ # Compiled JavaScript files (generated)
├── src/ # TypeScript source files
│ ├── index.ts # Main entry point and server implementation
│ └── types/ # Custom TypeScript type definitions
├── .vscode/ # VS Code configuration
│ ├── launch.json # Debug configurations
│ └── tasks.json # Build tasks
├── package.json # Project dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── Dockerfile # Docker configuration
├── .env.local.example # Example environment variables
└── README.md # This file
Authentication
The server uses Microsoft Authentication Library (MSAL) with device code flow for authentication:
When first run, the server generates a device code and URL
The code is saved to device-code.txt in the project directory
You must visit the URL and enter the code to authenticate
After authentication, tokens are cached in token-cache.json for future use
Getting Started## Prerequisites
Node.js (v14 or higher)
npm (v6 or higher)
Microsoft Azure account with a registered application
OneNote account (Microsoft 365 subscription)
Installation
Clone the repository
Install dependencies:
npm install
Create a .env.local file with your Azure client ID:
CLIENT_ID=your-client-id-from-azure
Running
To run the compiled application:
npm start
Docker Support
You can build and run the application using Docker:
mkdir -p data
# Build the Docker image
docker build -t onenote-mcp-server .
# Run the container
docker run -d \
- -name onenote-mcp-server \
- e CLIENT_ID=your-client-id \
- v $(pwd)/data:/app/dist \
onenote-mcp-server