Skip to content

kacase/mcp-onenote

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OneNote MCP (Model Context Protocol) Server

A Model Context Protocol server that integrates with Microsoft OneNote through Microsoft Graph API, allowing Claude and other LLMs to create, manage, and interact with OneNote notebooks, sections, and pages.

Features

  • 📓 Notebook Management: Create, list, get, and delete OneNote notebooks
  • 📑 Section Management: Create, list, get, and delete sections within notebooks
  • 📄 Page Management: Create, list, get, update, and delete OneNote pages
  • 🔍 Content Search: Search for pages containing specific text across notebooks
  • 📋 Page Operations: Copy pages between sections and retrieve page content
  • 🔧 Environment Defaults: Support for default notebook and section configuration
  • 🔁 Model Context Protocol: Follows MCP standards for LLM tool integration
  • 🛡️ Type Safety: Full TypeScript implementation with Zod validation

Prerequisites

  • Node.js 18+
  • Microsoft 365 account with appropriate permissions
  • Microsoft Azure App Registration with Graph API permissions (OneNote)

Setup

  1. Register an application in Azure Active Directory:

    • Go to Azure Portal

    • Navigate to "App registrations"

    • Create a new registration with a redirect URI of type "Public client/native (mobile & desktop)"

      • Register http://localhost as the redirect URI
    • Configure API permissions:

      • Choose Microsoft Graph and type delegated, as we will act on the users behalf
      • For OneNote: "Notes.ReadWrite" and "Notes.Read"
      • For User Profile: "User.Read"
  2. Note the values from your Azure app registration (Overview) to use for the MCP config as environment variables:

  • Client ID (Application (client) ID)
  • Authority ID (Directory (tenant) ID)
  1. Register the MCP server For Claude Desktop, create or update your configuration in ~/.claude/config.json:
{
  "mcpServers": {
    "onenote": {
      "command": "npx",
      "args": [
        "mcp_onenote"
      ],
      "env": {
        "AUTHORITY": "your-authority-id",
        "CLIENT_ID": "your-client-id",
        "MCP_SERVER_NAME": "onenote-mcp",
        "MCP_SERVER_VERSION": "1.0.0",
        "ONENOTE_DEFAULT_NOTEBOOK": "My Notebook",
        "ONENOTE_DEFAULT_SECTION": "Quick Notes"
      }
    }
  }
}

Make sure to replace the path and environment variables with your actual values.

Environment Variables

  • AUTHORITY: Azure tenant ID
  • CLIENT_ID: Azure application (client) ID
  • ONENOTE_DEFAULT_NOTEBOOK: Default notebook name or ID (optional)
  • ONENOTE_DEFAULT_SECTION: Default section name or ID (optional)

Available Tools

Notebook Tools

  • listNotebooks: Lists all notebooks accessible to the user
  • createNotebook: Creates a new notebook
  • getNotebook: Gets details of a specific notebook
  • deleteNotebook: Deletes a notebook

Section Tools

  • listSections: Lists sections in a notebook
  • createSection: Creates a new section in a notebook
  • getSection: Gets details of a specific section
  • deleteSection: Deletes a section

Page Tools

  • listPages: Lists pages in a section
  • createPage: Creates a new page in a section
  • getPage: Gets details of a specific page
  • getPageContent: Gets the HTML content of a page
  • updatePage: Updates the content of a page
  • deletePage: Deletes a page
  • copyPage: Copies a page to another section
  • searchPages: Searches for pages containing specific text

Resources

  • notebooks: Resource containing all notebooks data
  • sections: Resource containing all sections data
  • pages: Resource containing all pages data
  • default-notebook: Resource containing the default notebook information
  • default-section: Resource containing the default section information

The default resources provide easy access to the configured default notebook and section. If environment variables ONENOTE_DEFAULT_NOTEBOOK and ONENOTE_DEFAULT_SECTION are set, these will be used. Otherwise, the system will attempt to find the default notebook (marked as default in OneNote) and the first section within it.

Development

Run in development mode with live reloading:

npm run dev

Run linting:

npm run lint

Build the project:

npm run build

Configure your MCP locally for development:

{
  "mcpServers": {
    "onenote": {
      "command": "node",
      "args": [
        "/ABSOLUTE/PATH/TO/onenote_mcp/build/index.js"
      ],
      "env": {
        "AUTHORITY": "your-authority-id",
        "CLIENT_ID": "your-client-id",
        "MCP_SERVER_NAME": "onenote-mcp",
        "MCP_SERVER_VERSION": "1.0.0",
        "ONENOTE_DEFAULT_NOTEBOOK": "My Notebook",
        "ONENOTE_DEFAULT_SECTION": "Quick Notes"
      }
    }
  }
}

Usage Examples

Creating a new page

// Create a page in the default section
await createPage({
  title: "Meeting Notes",
  content: "<h1>Meeting Notes</h1><p>Discussion points...</p>"
});

// Create a page in a specific section
await createPage({
  title: "Project Plan",
  content: "<h1>Project Plan</h1><ul><li>Task 1</li><li>Task 2</li></ul>",
  sectionId: "0-A1B2C3D4E5F6G7H8I9J0K1L2M3N4O5P6Q7R8S9T0"
});

Searching for pages

// Search across all notebooks
await searchPages({
  searchTerm: "project timeline"
});

// Search within a specific notebook
await searchPages({
  searchTerm: "meeting",
  notebookId: "0-A1B2C3D4E5F6G7H8I9J0K1L2M3N4O5P6Q7R8S9T0"
});

Microsoft Graph API Endpoints

This server uses the following Microsoft Graph API endpoints:

  • /me/onenote/notebooks - Notebook operations
  • /me/onenote/sections - Section operations
  • /me/onenote/pages - Page operations
  • /me/onenote/pages/{id}/content - Page content operations

License

ISC

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors