Alfresco MCP服务器

一个为Alfresco提供模型上下文协议(MCP)服务的服务器,支持多种传输模式和Docker容器化部署。

  • by AlfrescoLabs
  • Python
  • 本地部署
  • 6 星标
  • 更新于
在 GitHub 查看 AlfrescoLabs/alfresco-mcp-server

使用说明

Alfresco MCP服务器

用于Alfresco的最小模型上下文协议(MCP)服务器,通过AlfrescoREST API提供工具

特性

  • 基于票证的身份验证:使用Alfresco身份验证票证
  • 多种运输方式:支持stdio、SSE和HTTP
  • Docker支持:适用于所有运输方式的可配置集装箱

先决条件

  • Python 3.11+
  • Alfresco实例(可访问REST API)
  • Alfresco身份验证票

安装

本地设置

  1. 克隆或创建包含所有文件的项目目录

  2. 安装依赖项:

python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
  1. 设置环境变量:
export ALFRESCO_HOST=http://your-alfresco-host:8080

使用MCP检查员进行本地测试

1.安装MCP检查器(仅一次)

npm install -g @modelcontextprotocol/inspector

2.使用Inspector运行服务器

使用启动服务器 streamable-http 运输方式

python alfresco_mcp_server.py --transport http --host 127.0.0.1 --port 8003

启动MCP检查器

mcp-inspector --config ./mcp.json

购买Alfresco门票

您需要先通过Alfresco的身份验证才能获得门票。您可以通过以下方式完成此操作:

curl -X POST "http://localhost:8080/alfresco/api/-default-/public/authentication/versions/1/tickets" \
  -H "Content-Type: application/json" \
  -d '{"userId":"admin","password":"admin"}'

这将返回一个JSON响应,其中包含 id 包含您的票的字段。

直接使用FastMCP运行

STDIO模式(默认)

python alfresco_mcp_server.py

HTTP模式

fastmcp dev alfresco_mcp_server.py --transport http --port 8003

SSE模式

fastmcp dev alfresco_mcp_server.py --transport sse --port 8003

Docker使用

塑造形象

docker build -t alfresco-mcp-server .

以不同模式运行

STDIO模式(默认)

docker run -it --rm \
  -e ALFRESCO_HOST=http://your-alfresco-host:8080 \
  alfresco-mcp-server

HTTP模式

docker run -d --rm \
  -e ALFRESCO_HOST=http://your-alfresco-host:8080 \
  -e TRANSPORT_MODE=http \
  -e HTTP=8003 \
  -p 8003:8003 \
  alfresco-mcp-server

SSE模式

docker run -d --rm \
  -e ALFRESCO_HOST=http://your-alfresco-host:8080 \
  -e TRANSPORT_MODE=sse \
  -e HTTP=8003 \
  -p 8003:8003 \
  alfresco-mcp-server

Docker编写示例

services:
  alfresco-mcp:
    build: .
    environment:
      - ALFRESCO_HOST=http://alfresco:8080
      - TRANSPORT_MODE=http  # or sse, stdio
      - HTTP=8003
    ports:
      - "8003:8003"  # Only needed for http/sse modes

环境变量

变量 描述 默认值
ALFRESCO_HOST Alfresco实例的基本URL http://localhost:8080
TRANSPORT_MODE 传输模式(stdio/http/sse) stdio
HTTP HTTP/SSE模式端口 8003

在Docker Hub中发布

创建/使用构建器

docker buildx create --name mcp-builder --use
docker buildx inspect --bootstrap

使用SBOM+来源+OCI注释构建和推送(多拱形)

docker buildx build \
  --platform linux/amd64,linux/arm64 \
  --pull \
  --provenance=mode=max \
  --sbom=true \
  --annotation "index:org.opencontainers.image.source=https://github.com/angelborroy/alfresco-mcp-server" \
  --annotation "index:org.opencontainers.image.description=Alfresco MCP Server" \
  -t angelborroy/alfresco-mcp-server:1.0.0 \
  -t angelborroy/alfresco-mcp-server:latest \
  --metadata-file build-metadata.json \
  --push .

清理

docker buildx rm mcp-builder