企业知识搜索协议

Enterprise MCP是一个标准化的、可扩展的接口,用于大型语言模型(LLM)搜索和访问企业知识源,如Confluence wiki、SharePoint文档、内部文档和其他知识库。

  • by aponcedeleonch
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 aponcedeleonch/enterprise-mcp

使用说明

企业MCP

模型上下文协议(MCP)服务器,用于访问企业知识并使其可用于大型语言模型(LLM)。

概述

Enterprise MCP为LLM提供了一个标准化、可扩展的界面,用于搜索和访问企业知识源,如Confluence wiki、SharePoint文档、内部文档和其他知识库。使用官方 MCP Python SDK 随着 FastMCP 和 可流式HTTP传输,它提供高性能异步处理、全面的搜索功能和生产级可靠性。

主要亮点:

  • 🎯 LLM优化:用于AI代理集成的全面工具文档
  • 🧪 测试良好:27个测试,覆盖率超过84%,包括集成测试
  • 🔧 现代工具:Python 3.13+,uv,Ruff,Ty,pytest,任务自动化

特性

  • 🌐 可流式HTTP传输:基于HTTP的现代传输,可实现更好的可扩展性和多客户端支持
  • 🔍 企业知识搜索:同时搜索多个知识源
  • ⚡ 异步处理:内置async/await以实现高性能
  • 🎯 语义和关键字搜索:具有评分功能的智能搜索算法
  • 📊 源滤波:搜索特定的知识源或一次搜索所有知识源
  • 🏷️ 元数据支持:丰富的元数据,包括作者、日期、标签和来源
  • 🔧 可配置的结果:可定制的结果限制和元数据包含
  • 🧪 综合测试:全面测试覆盖,包括集成测试

支持的知识来源

  • 汇流:Wiki页面和文档
  • SharePoint:文档库和网站
  • 内部维基:技术文件和程序
  • 数据库:结构化企业数据(即将推出)
  • 文件系统:文档存储库(即将推出)

需求

  • Python 3.13+ (必填)
  • 紫外线 包管理器(取代pip/poetry)
  • 任务 用于命令执行(推荐)

快速开始

# Clone and setup
git clone <repository-url>
cd enterprise-mcp

# Install dependencies
uv sync --dev

# Run quality checks (always run after changes)
task format && task typecheck && task test

# Start the server
uv run enterprise-mcp --port 8000
# Server available at: http://127.0.0.1:8000/mcp

安装与开发

生产装置

uv sync                 # Install runtime dependencies only

开发环境设置

uv sync --dev          # Install with development tools
task install-dev       # Alternative using Task

用法

运行MCP服务器

服务器现在使用 可流式HTTP传输 以获得更好的可扩展性和多客户端支持。

# Start the HTTP server (default port 8000)
uv run enterprise-mcp

# Use a custom port
uv run enterprise-mcp --port 8080

# Enable debug logging
uv run enterprise-mcp --log-level DEBUG

# Using task (recommended)
task dev

服务器将在以下时间可用 http://127.0.0.1:8000/mcp (或您的自定义港口)。客户端可以使用MCP Streamable HTTP协议进行连接。

企业知识搜索工具

服务器提供了一个名为 handle_search 针对LLM集成进行了优化:

参数:

  • query (必填):搜索查询字符串-描述性和特定性
  • sources (可选):特定来源列表 ["confluence", "sharepoint", "wiki"]
  • max_results (可选):最大结果(1-50,默认值:10)
  • include_metadata (可选):包括详细的元数据(默认值:true)

退货: 带有排名结果、元数据和URL的格式化字符串。

项目结构

enterprise-mcp/
├── src/enterprise_mcp/
│   ├── server.py        # FastMCP server + streamable HTTP
│   └── knowledge.py     # Enterprise knowledge manager
├── tests/
│   ├── test_integration.py  # End-to-end server tests
│   └── test_knowledge.py    # Knowledge manager unit tests
├── pyproject.toml       # Central configuration (dependencies, tools)
├── Taskfile.yml         # Task automation
├── AGENTS.md           # Coding agent best practices
└── README.md           # This documentation

自定义知识源

扩展知识管理器 src/enterprise_mcp/knowledge.py:

class EnterpriseKnowledgeManager:
    async def _initialize_mock_sources(self) -> None:
        # Add your enterprise systems
        self.knowledge_sources["jira"] = {
            "name": "JIRA Issues",
            "type": "issue_tracker", 
            "documents": await self._fetch_jira_data()
        }
        
        self.knowledge_sources["notion"] = {
            "name": "Notion Workspace",
            "type": "documentation",
            "documents": await self._fetch_notion_pages()
        }

测试和质量保证

质量门

# All must pass before merging
task format     # Ruff: Code formatting
task typecheck  # Ty: Strict type checking  
task test       # Pytest with coverage reporting

支持

对于问题、议题或贡献:

  1. GitHub 问题:报告错误或请求功能
  2. 讨论:提问或分享想法
  3. 文档:查看此README和代码注释

🚀 使用现代Python工具和 模型上下文协议 实现无缝LLM集成。