Labsco
purpleslurple logo

OneNote

โ˜… 39

from purpleslurple

Access your entire OneNote knowledge base through AI using the Microsoft Graph API.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeNeeds API keys

OneNote MCP Server

A complete, robust Model Context Protocol (MCP) server for Microsoft OneNote integration with Claude Desktop. Access your entire OneNote knowledge base through natural language queries.

๐ŸŽฏ What This Does

Transform your OneNote notebooks into an AI-accessible knowledge base:

  • List all your notebooks, sections, and pages
  • Read page content for analysis and search
  • Natural language queries like "Show me my DevOps notes" or "Find pages about project planning"
  • Secure OAuth authentication with Microsoft Graph API
  • Bulletproof error handling with detailed debugging

โœจ Why This Implementation

Unlike other OneNote MCP servers, this one:

  • โœ… Actually works - tested extensively with real OneNote data
  • โœ… Complete functionality - all core OneNote operations implemented
  • โœ… Robust authentication - two-step device flow that handles edge cases
  • โœ… Production ready - proper error handling and logging
  • โœ… Easy setup - detailed instructions for non-technical users

๐Ÿ” First Time Authentication

  1. In Claude Desktop, say: "Start OneNote authentication"
  2. Claude will give you a URL and code
  3. Visit the URL in your browser, enter the code, and sign in
  4. Browser compatibility:
    • โœ… Firefox (tested with 139.0.4) - works perfectly
    • โŒ Safari - may have issues with Microsoft OAuth redirect
    • โœ… Chrome/Edge - should work (Microsoft's browsers)
  5. Come back to Claude and say: "Complete OneNote authentication"
  6. You're ready to go!

Token Persistence

By default, authentication tokens are cached securely on your local machine so you only need to authenticate once every few weeks/months.

To disable token caching (for security-sensitive environments):

{
  "mcpServers": {
    "onenote": {
      "command": "uv",
      "args": [
        "--directory", "/FULL/PATH/TO/onenote-mcp-server",
        "run", "python", "onenote_mcp_server.py"
      ],
      "env": {
        "AZURE_CLIENT_ID": "YOUR_CLIENT_ID_HERE",
        "ONENOTE_CACHE_TOKENS": "false"
      }
    }
  }
}

Token caching options:

  • ONENOTE_CACHE_TOKENS=true (default) - Tokens persist across sessions
  • ONENOTE_CACHE_TOKENS=false - Authenticate every session (more secure)

๐Ÿ— Development

Project Structure

onenote-mcp-server/
โ”œโ”€โ”€ onenote_mcp_server.py      # Main server implementation
โ”œโ”€โ”€ pyproject.toml             # Dependencies and metadata  
โ”œโ”€โ”€ README.md                  # This file
โ”œโ”€โ”€ LICENSE                    # MIT License
โ””โ”€โ”€ .gitignore                 # Git ignore rules

Key Features

  • Two-step authentication: Handles device code flow properly
  • Complete Graph API integration: All OneNote operations supported
  • Robust error handling: Detailed logging and graceful failures
  • FastMCP framework: Clean, maintainable code structure
  • Environment variable configuration: Secure credential handling

Adding New Features

The server is built with FastMCP, making it easy to add new tools:

@mcp.tool()
async def your_new_tool(param: str) -> str:
    """Description of what your tool does."""
    # Your implementation here
    return result

๐Ÿค Contributing

Contributions welcome! Please:

  1. Fork the repo
  2. Create a feature branch
  3. Add tests for new functionality
  4. Submit a pull request

๐Ÿ“„ License

MIT License - see LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Built with FastMCP framework
  • Uses Microsoft Graph API for OneNote access
  • Inspired by the amazing potential of AI + personal knowledge bases

โš ๏ธ Important Notes

  • This server only reads/writes data you already have access to
  • Your Azure app credentials stay on your machine
  • All authentication happens directly between you and Microsoft
  • No data is sent to third parties

Built with โค๏ธ for the Claude + OneNote community

Turn your OneNote into an AI-accessible knowledge base!