A containerized MCP server for Microsoft 365, featuring OAuth authentication and OpenTelemetry instrumentation for monitoring.
A containerized MS-365 Model Context Protocol (MCP) server with comprehensive OpenTelemetry instrumentation for monitoring and observability. This setup allows Claude Desktop to securely access Microsoft 365 services while providing detailed telemetry data for all operations.
āāāāāāāāāāāāāāāāāāā SSH (Port 2222) āāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Claude Desktop āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā Docker Container ā
ā (macOS) ā ā āāāāāāāāāāāāāāāāāāāāā ā
āāāāāāāāāāāāāāāāāāā ā ā MCP Container ā ā
ā ā āāāāāāāāāāāāāāā ā ā
ā ā ā MCP Server ā ā ā
ā ā ā(Instrumented)ā ā ā
ā ā āāāāāāāā¬āāāāāāā ā ā
ā ā ā ā ā
ā ā OpenTelemetry ā ā
ā ā ā ā ā
ā āāāāāāāāāāā¼āāāāāāāāāā ā
āāāāāāāāāāāāāā¼āāāāāāāāāāāā
ā
OTLP Export
ā
ā¼
External OTEL Collector
(Your monitoring stack)
sshpass
installed: brew install hudochenkov/sshpass/sshpass
git clone <your-repo>
cd office365-mcp-server
# Edit environment variables
cp .env.example .env
vim .env
Update .env
file:
# MS-365 Configuration
MCP_SSH_PASSWORD=YourSecurePassword123!
# OpenTelemetry Configuration (optional)
OTEL_EXPORTER_OTLP_ENDPOINT=http://your-otel-collector:4318
TELEMETRY_ENABLED=true
TELEMETRY_SAMPLE_RATE=1.0
TELEMETRY_LOG_OPERATIONS=true
OTEL_LOG_LEVEL=info
# Service identification
HOSTNAME=your-hostname
# Build and start the container
docker-compose up -d
# Check container status
docker-compose logs -f ms365-mcp
The setup automatically configures your Claude Desktop. Verify the configuration in:
~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"ms365": {
"command": "sshpass",
"args": [
"-p", "YourSecurePassword123!",
"ssh",
"-p", "2222",
"-o", "StrictHostKeyChecking=no",
"-o", "UserKnownHostsFile=/dev/null",
"mcp@localhost",
"/usr/local/bin/mcp-wrapper.sh"
],
"env": {}
}
}
}
Please authenticate with Microsoft 365 by visiting: https://login.microsoftonline.com/...
Once connected, you can ask Claude Desktop to:
mcp.operations.total
- Counter of operations by type/categorymcp.operation.duration
- Histogram of operation durationsmcp.errors.total
- Counter of errors by type# Search traces by service
service:ms365-mcp-server
# Filter by operation type
mcp.operation:mail
# Find errors
error:true
# Operation rate
rate(mcp_operations_total[5m])
# Error rate
rate(mcp_errors_total[5m])
# 95th percentile latency
histogram_quantile(0.95, mcp_operation_duration)
Search by:
office365-mcp-server/
āāā Dockerfile # Container definition with dependencies
āāā docker-compose.yml # Container orchestration
āāā supervisord.conf # Process management inside container
āāā entrypoint.sh # Container startup script
āāā mcp-wrapper.sh # MCP server wrapper with telemetry
āāā .env # Environment configuration
āāā .gitignore # Git ignore patterns
āāā telemetry/ # OpenTelemetry instrumentation
ā āāā package.json # Telemetry dependencies
ā āāā instrumentation.js # OTEL SDK configuration
ā āāā mcp-proxy.js # Instrumented MCP proxy
āāā config/ # Persistent configuration (created at runtime)
āāā tokens/ # OAuth token storage (created at runtime)
āāā ssh_keys/ # SSH keys for authentication (optional)
āāā logs/ # Application logs (created at runtime)
# Check container logs
docker-compose logs ms365-mcp
# Common issues:
# 1. Port 2222 already in use
# 2. Permission issues with volumes
# 3. Missing dependencies
# Test SSH connection manually
ssh -p 2222 mcp@localhost -o StrictHostKeyChecking=no
# Check if sshpass is installed
which sshpass
# Verify container is listening
docker exec ms365-mcp-server netstat -tlnp | grep 2222
# Check MCP server directly
docker exec -it ms365-mcp-server npx @softeria/ms-365-mcp-server --help
# Test authentication
docker exec -it ms365-mcp-server npx @softeria/ms-365-mcp-server --login
# Check for missing dependencies
docker exec -it ms365-mcp-server ldd /usr/local/lib/node_modules/@softeria/ms-365-mcp-server/node_modules/keytar/build/Release/keytar.node
# Check OTEL configuration
docker exec ms365-mcp-server env | grep OTEL
# Test OTEL collector connectivity
docker exec ms365-mcp-server curl -v $OTEL_EXPORTER_OTLP_ENDPOINT/v1/traces
# Check telemetry logs
docker exec ms365-mcp-server tail -f /logs/mcp-operations.log
# Verify configuration file
cat ~/Library/Application\ Support/Claude/claude_desktop_config.json
# Check Claude Desktop logs (if available)
# Restart Claude Desktop after configuration changes
For enhanced security, replace password authentication with SSH keys:
Generate SSH key pair:
ssh-keygen -t rsa -b 4096 -f ./ssh_keys/mcp_key
Update docker-compose.yml to mount the key:
volumes:
- ./ssh_keys:/home/mcp/.ssh:ro
Update Claude Desktop config:
{
"mcpServers": {
"ms365": {
"command": "ssh",
"args": [
"-i", "/path/to/ssh_keys/mcp_key",
"-p", "2222",
"-o", "StrictHostKeyChecking=no",
"mcp@localhost",
"/usr/local/bin/mcp-wrapper.sh"
]
}
}
}
# Sample 10% of operations for high-volume environments
TELEMETRY_SAMPLE_RATE=0.1
# For authenticated OTEL collectors
OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer your-token,X-Custom-Header=value"
# Additional resource attributes for better identification
OTEL_RESOURCE_ATTRIBUTES="deployment.environment=production,host.name=raspberrypi,service.instance.id=mcp-001"
Add resource limits to docker-compose.yml
:
services:
ms365-mcp:
# ... other configuration
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.25'
memory: 256M
# Reduce telemetry overhead for high-volume scenarios
TELEMETRY_SAMPLE_RATE=0.1 # Sample 10% of operations
OTEL_LOG_LEVEL=warn # Reduce telemetry logging
TELEMETRY_LOG_OPERATIONS=false # Disable operation logging
[Your License Here]
For issues and questions:
docker-compose logs ms365-mcp
Note: This setup provides comprehensive monitoring and observability for MS-365 MCP operations. The telemetry data helps with debugging, performance optimization, and understanding usage patterns.
Integrate the SpotDraft API into agentic workflows. Requires SpotDraft API credentials.
Interact with your Tmux sessions, windows and pane, execute commands in tmux panes and retrieve result.
Perform basic video editing operations using natural language commands. Requires ffmpeg to be installed.
Provides access to a specific user's memories from the Omi app.
An MCP server for integrating with the Planfix project management and CRM platform.
A server for managing local prompt files, allowing AI models to create, retrieve, update, and delete them.
Manage events, reporting, and analytics on Eventbrite.
Automate your local browser
Provides current date and time with configurable formats and timezones.
Manage your Todoist tasks and projects using the Todoist Python API.