npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sharepoint-mcp-server

v1.0.3

Published

A Model Context Protocol (MCP) server for SharePoint Online content

Readme

SharePoint MCP Server and AI Chatbot

This project provides a Model Context Protocol (MCP) server for SharePoint Online and an AI-powered chatbot that can interact with SharePoint content.

Features

  • List available SharePoint documents and pages
  • Fetch and read document content from SharePoint
  • Query SharePoint pages (ASPX)
  • Search SharePoint content
  • Summarize document paragraphs
  • Convert Office documents to text
  • Interactive AI chatbot interface

Prerequisites

  • Node.js 16+ or Bun runtime
  • SharePoint Online site
  • Microsoft Graph API credentials
  • OpenAI API key (for AI chatbot)

Setup

  1. Install dependencies:

    bun install
  2. Configure environment variables:

    # SharePoint/Microsoft Graph credentials
    export TENANT_ID="your-tenant-id"
    export CLIENT_ID="your-client-id"
    export CLIENT_SECRET="your-client-secret"
    export SITE_ID="your-sharepoint-site-id"
       
    # For AI Chatbot
    export OPENAI_API_KEY="your-openai-api-key"

Running the Application

IMPORTANT: Two-Step Process

The AI chatbot connects to the MCP server over HTTP, so you need to run them as separate processes:

Step 1: Start the HTTP server first:

bun run http

Step 2: In a separate terminal, start the AI chatbot:

bun run ai

Other Run Options

  • Command-line chatbot (no AI):

    bun run cli
  • Run MCP server with stdio transport (for direct integration):

    bun run stdio

Available Commands in AI Chatbot

  • list documents - Show all available SharePoint documents
  • list pages - Show all SharePoint pages
  • search [query] - Search for content in SharePoint
  • document [id] - Get content of a specific document
  • page [id] - Get content of a specific SharePoint page
  • summarize [id] - Get a summary of document content
  • exit or quit - Exit the chatbot

Troubleshooting

  • "No valid session ID provided" error: Make sure you're running the HTTP server (Step 1) before starting the AI chatbot (Step 2).
  • OpenAI API errors: Check that your OPENAI_API_KEY is set correctly.
  • SharePoint connection issues: Verify your Microsoft Graph credentials and site ID.

License

MIT

Available Resources

| Resource URI | Description | |--------------|-------------| | sharepoint://documents | Lists all documents in the root folder | | sharepoint://document/{documentId} | Retrieves a specific document's content | | sharepoint://pages | Lists all SharePoint pages | | sharepoint://page/{pageId} | Retrieves a specific page's content |

Available Tools

| Tool Name | Parameters | Description | |-----------|------------|-------------| | search-sharepoint | { query: string } | Searches SharePoint content | | summarize-content | { documentId: string, paragraphIndex?: number } | Summarizes document content or specific paragraphs | | document-to-text | { documentId: string } | Converts Office documents to text |

Azure App Registration

  1. Register a new application in the Azure Portal
  2. Add the following API permissions:
    • Microsoft Graph > Application permissions:
      • Files.Read.All
      • Sites.Read.All
    • SharePoint > Application permissions:
      • Sites.Read.All
  3. Generate a client secret
  4. Grant admin consent for the permissions

Finding Your SharePoint Site ID

You can find your SharePoint site ID using the Microsoft Graph Explorer:

  1. Go to https://developer.microsoft.com/graph/graph-explorer
  2. Sign in with your Microsoft 365 account
  3. Make a GET request to: /sites/{domain}:/sites/{site-name} Example: /sites/contoso.sharepoint.com:/sites/marketing
  4. The response will include your site ID

Usage with AI Models

Example: Using with a model like Claude or GPT

  1. Connect your AI client to this MCP server
  2. List available documents:
    • Request the sharepoint://documents resource
  3. Read a specific document:
    • Request the sharepoint://document/{documentId} resource
  4. Search for content:
    • Call the search-sharepoint tool with a query parameter
  5. Summarize a document:
    • Call the summarize-content tool with a documentId parameter

Example: Flow for Document Summarization

1. AI: "I need to find documents about marketing strategy"
2. User: "Let me help you search SharePoint" 
3. [AI calls search-sharepoint tool with query="marketing strategy"]
4. AI: "I found a marketing plan document. Let me get its content"
5. [AI requests the sharepoint://document/{documentId} resource]
6. AI: "Here's a summary of the marketing plan..."
7. User: "Can you focus on the first quarter strategy?"
8. [AI calls summarize-content tool with documentId and paragraphIndex parameters]

Architecture

This MCP server uses:

  • Microsoft Graph API: To interact with SharePoint Online
  • Azure Identity: For authentication with Microsoft services
  • MCP SDK: To implement the Model Context Protocol
  • Two transport options:
    • StdioServerTransport: For direct integration with AI clients
    • StreamableHTTPServerTransport: For remote access over HTTP

Extending the Server

You can extend this server by:

  1. Adding more resources in index.ts or http-server.ts
  2. Implementing additional tools for specific SharePoint operations
  3. Supporting more document types and extraction methods