MCP-Local-SharePoint-Server-Setup

MCP-Local-SharePoint-Server-Setup

Provides read-only access to local SharePoint/OneDrive synced files, enabling listing, searching, and querying Excel workbooks with filters and aggregations, all within a strict sandbox.

Category
访问服务器

README

Corporate SharePoint MCP — Finance Pilot M005L

This milestone keeps the MCP service local and read-only while using a OneDrive shortcut to expose an approved SharePoint folder under the signed-in Windows user's existing SharePoint access.

Added in M005L

  • sharepoint_list_folder (filters local OneDrive clutter such as desktop.ini)
  • sharepoint_inspect_excel
  • sharepoint_read_excel_range
  • .xlsx only for this milestone
  • 100 MiB (configurable with EXCEL_MAX_FILE_SIZE_MB) workbook cap
  • range requests capped at 100 rows × 30 columns
  • Excel opened using openpyxl read-only mode with cached formula values (data_only=True)
  • all file paths must resolve beneath SHAREPOINT_SYNC_ROOT
  • no create/update/delete/move/rename tools

Install/update dependencies

pip install -r .\requirements.txt

Run tests

$env:PYTHONPATH = "$PWD\src"
pytest -q

Run server

python -m sharepoint_mcp.server

Test the real synced workbook

In a second PowerShell window:

.\.venv\Scripts\Activate.ps1
$env:PYTHONPATH = "$PWD\src"
python .\scripts\test_excel_reader.py

The script expects SalesDelivery Note.xlsx in the configured root. It inspects the workbook, reads A1:J10 from the first worksheet, and confirms ../ remains blocked.

M006L - Safe document discovery

This milestone adds sharepoint_search_files, a recursive metadata-only search inside SHAREPOINT_SYNC_ROOT.

It searches:

  • file names
  • approved-root-relative paths

It deliberately does not open file contents during discovery. This avoids hydrating or parsing large OneDrive-backed workbooks simply to locate them.

Example:

sharepoint_search_files(
    query="sales delivery",
    extension="xlsx",
    max_results=10
)

The tool:

  • remains read-only
  • blocks ../ traversal
  • ignores desktop.ini, Thumbs.db, and temporary ~$ Office files
  • caps a request at 50 returned results
  • caps one scan at 10,000 files
  • returns relative paths rather than exposing the full local Windows path

Run:

pytest -q tests
python .\scripts\test_document_search.py

M007L - Content-aware Excel querying

Adds two read-only tools:

  • sharepoint_get_excel_columns
  • sharepoint_find_excel_rows

The first discovers every named header in a worksheet. The second scans a bounded number of rows and returns matching records using one named business column.

Safety limits:

  • SharePoint sync root sandbox still enforced
  • .xlsx only
  • workbook opened read-only
  • at most 500,000 rows scanned per request
  • at most 100 matching rows returned
  • at most 20 returned columns
  • no edit, rename, move, delete, or upload capability

Example:

sharepoint_find_excel_rows(
    relative_path="SalesDelivery Note.xlsx",
    sheet_name="Data",
    column_name="Packing Slip",
    search_value="GRP0000124",
    match_mode="equals",
    return_columns_csv="Product Id,Packing Slip,Quantity"
)

Live test:

pytest -q tests
python .\scripts\test_excel_content_query.py

M007.1 - Query completeness and continuation

This patch prevents a partial worksheet scan from being mistaken for a complete answer.

sharepoint_find_excel_rows now returns:

  • scan_complete
  • next_start_row
  • worksheet_max_row

The default scan allowance is now 500,000 rows, enough to cover the current 443,759-row Finance workbook in one call. If a future worksheet exceeds the bounded scan or the result cap is reached, Claude can continue with start_row=next_start_row.

The reader also narrows the streamed Excel column window to only the filter column and requested output columns, reducing unnecessary work on wide sheets.

Run:

pytest -q tests
python .\scripts\test_excel_content_query.py

M008L - Multi-condition Finance queries and aggregations

Adds:

  • sharepoint_query_excel
  • sharepoint_aggregate_excel

Multi-condition filters are passed as a bounded JSON array, for example:

[
  {"column":"Business Unit","operator":"equals","value":"Dean"},
  {"column":"Delivery Date","operator":"gte","value":"2026-01-01"},
  {"column":"Delivery Date","operator":"lte","value":"2026-12-31"}
]

Supported filter operators:

  • equals / not_equals
  • contains / starts_with / ends_with
  • gt / gte / lt / lte
  • is_blank / is_not_blank

Aggregations:

  • count
  • sum
  • avg
  • min
  • max
  • optional group_by_column

Guardrails:

  • maximum 8 filter conditions
  • maximum 500,000 scanned rows
  • maximum 100 returned query rows
  • maximum 20 returned columns
  • maximum 100 aggregation groups
  • aggregations refuse partial scans
  • strict SharePoint sync-root sandbox
  • .xlsx only
  • read-only; no write/delete/move/upload tools

Run:

pytest -q tests
python .\scripts\test_finance_multiquery.py

M009L - Claude Desktop local connection

Adds a dedicated local stdio transport entry point:

python -m sharepoint_mcp.desktop

The HTTP development server remains available separately:

python -m sharepoint_mcp.server

Claude Desktop should launch the stdio process itself, so port 8000 is not required for the Desktop connection.

Generate a machine-specific config snippet:

$env:PYTHONPATH = "$PWD\\src"
python .\\scripts\\show_claude_desktop_config.py

The generated JSON contains local executable/folder paths and read-only pilot settings only. It does not include Entra secrets.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选