Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@TrustLayer MCP Servershow me the latest documents for project ABC-123"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Unofficial TrustLayer MCP Server
Unofficial community Model Context Protocol (MCP) server for the Public TrustLayer API - read-only access.
Overview
This MCP server provides read-only access to the Public TrustLayer API data, allowing integration with:
API Documentation: This server implements the Public TrustLayer Platform API v1.0 and follows the public API documentation available at https://developers.trustlayer.io/.
Cursor IDE
n8n workflows
Claude Desktop
Other MCP-compatible tools
Features
Read-Only Access: Only GET operations are supported (no create, update, or delete)
Resources: List all TrustLayer entities (Parties, Documents, Projects, etc.)
Tools: Query specific entities by ID or list with filters
JSON Responses: All data returned as structured JSON
HTTP Transport: Deploy as HTTP server for remote access
Token Authentication: Support for per-request token via Authorization header
Prerequisites
Python 3.11+
TrustLayer API token
Installation
Navigate to the mcp-server directory:
cd mcp-serverCreate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activateInstall dependencies:
pip install -r requirements.txtCreate a
.envfile:
cp env.example .envEdit
.envand configure:
TRUSTLAYER_API_BASE_URL=https://api.trustlayer.io
TRUSTLAYER_API_VERSION=v1
# TRUSTLAYER_API_TOKEN is optional for HTTP mode (token from Authorization header)
# Required only for stdio mode
TRUSTLAYER_API_TOKEN=your_api_token_hereConfiguration Options:
TRUSTLAYER_API_BASE_URL- Base URL for TrustLayer API (default:https://api.trustlayer.io)TRUSTLAYER_API_VERSION- API version (default:v1)TRUSTLAYER_API_TOKEN- API token (required for stdio mode, optional for HTTP mode)
Usage
Running the MCP Server
The MCP server can run in two modes:
1. Stdio Mode (for local MCP clients)
The MCP server runs via stdio and is typically started by MCP clients. To test manually:
Option 1: Using the wrapper script (recommended):
# Make sure the script is executable
chmod +x run_server.sh
# Run the server
./run_server.shOption 2: Direct Python execution:
# Activate virtual environment
source venv/bin/activate # On Windows: venv\Scripts\activate
# Run the server
python -m src.server2. HTTP Mode (for remote access)
To run the MCP server as an HTTP service:
# Activate virtual environment
source venv/bin/activate # On Windows: venv\Scripts\activate
# Run the HTTP server
python run_http_server.pyThe server will be available at http://localhost:8000 with the following endpoints:
http://localhost:8000/- Health check and server infohttp://localhost:8000/health- Health check endpointhttp://localhost:8000/mcp- MCP protocol endpoint
Note:
For HTTP mode: Token can be provided via
Authorizationheader (recommended) or viaTRUSTLAYER_API_TOKENenv varFor stdio mode: Token must be set in
TRUSTLAYER_API_TOKENenv var
3. Docker Mode
To run the MCP server using Docker:
# Create .env file if it doesn't exist
cp env.example .env
# Edit .env and set TRUSTLAYER_API_TOKEN (optional for HTTP mode)
# Build and start the container
docker-compose up -d
# View logs
docker-compose logs -f
# Stop the container
docker-compose downRebuilding the Docker image:
If you've made changes to the code and need to rebuild the image:
# Stop and remove containers
docker-compose down
# Rebuild without cache (recommended after code changes)
docker-compose build --no-cache
# Start the container
docker-compose up -d
# Or do it all in one command
docker-compose down && docker-compose build --no-cache && docker-compose up -dQuick rebuild and restart:
# Rebuild and restart in one command
docker-compose up -d --buildChecking if the server is running:
# Check container status
docker-compose ps
# Check health endpoint
curl http://localhost:8000/health
# View logs
docker-compose logs --tail=50The server will be available at http://localhost:8000 with the same endpoints as HTTP mode.
Production Deployment
Systemd Service Setup
For production deployment on Linux servers, you can create a systemd service:
Create service file:
sudo nano /etc/systemd/system/trustlayer-mcp.serviceAdd the following content:
[Unit]
Description=TrustLayer MCP Server
After=network.target
[Service]
Type=simple
User=your-user
WorkingDirectory=/path/to/mcp-server
Environment="PATH=/path/to/mcp-server/venv/bin"
EnvironmentFile=/path/to/mcp-server/.env
ExecStart=/path/to/mcp-server/venv/bin/python run_http_server.py
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.targetActivate the service:
# Reload systemd
sudo systemctl daemon-reload
# Enable auto-start
sudo systemctl enable trustlayer-mcp
# Start the service
sudo systemctl start trustlayer-mcp
# Check status
sudo systemctl status trustlayer-mcp
# View logs
sudo journalctl -u trustlayer-mcp -fNginx Reverse Proxy
For production, it's recommended to use Nginx as a reverse proxy:
Create Nginx configuration:
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://localhost:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
# For SSE/streaming
proxy_buffering off;
proxy_cache off;
}
}Enable SSL with Let's Encrypt:
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d your-domain.comIntegration with Cursor
Option 1: Stdio Mode (Local)
Add to your Cursor settings (.cursor/mcp.json):
Option A: Using the wrapper script (recommended):
{
"mcpServers": {
"trustlayer": {
"command": "/path/to/mcp-server/run_server.sh",
"cwd": "/path/to/mcp-server",
"env": {
"TRUSTLAYER_API_TOKEN": "your_api_token_here",
"TRUSTLAYER_API_BASE_URL": "https://api.trustlayer.io",
"TRUSTLAYER_API_VERSION": "v1"
}
}
}
}Option B: Direct Python execution:
{
"mcpServers": {
"trustlayer": {
"command": "/path/to/mcp-server/venv/bin/python3",
"args": ["-m", "src.server"],
"cwd": "/path/to/mcp-server",
"env": {
"PYTHONPATH": "/path/to/mcp-server",
"TRUSTLAYER_API_TOKEN": "your_api_token_here",
"TRUSTLAYER_API_BASE_URL": "https://api.trustlayer.io",
"TRUSTLAYER_API_VERSION": "v1"
}
}
}
}Example with absolute paths (using wrapper script):
{
"mcpServers": {
"trustlayer": {
"command": "/path/to/mcp-server/run_server.sh",
"cwd": "/path/to/mcp-server",
"env": {
"TRUSTLAYER_API_TOKEN": "your_api_token_here",
"TRUSTLAYER_API_BASE_URL": "https://api.trustlayer.io",
"TRUSTLAYER_API_VERSION": "v1"
}
}
}
}Important:
When using the wrapper script (
run_server.sh): Just provide the full path to the script and setcwdWhen using direct Python execution: Use the full path to your Python executable in the virtual environment and set
PYTHONPATHAlways set
cwdto the mcp-server directory
Option 2: HTTP Mode (Remote)
If you're running the HTTP server separately, connect via HTTP:
Basic connection (uses token from server config):
{
"mcpServers": {
"trustlayer": {
"url": "http://localhost:8000/mcp",
"transport": "streamable-http"
}
}
}With Authorization header (recommended - token per client):
{
"mcpServers": {
"trustlayer": {
"url": "http://localhost:8000/mcp",
"transport": "streamable-http",
"headers": {
"Authorization": "Bearer your_api_token_here"
}
}
}
}For remote servers, replace localhost:8000 with your server's address.
Note: When using Authorization header, the token is passed with each request, allowing different clients to use different tokens. This is more secure than storing tokens in server configuration.
Integration with Claude Desktop
Add to Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
Stdio Mode:
{
"mcpServers": {
"trustlayer": {
"command": "python",
"args": ["-m", "src.server"],
"cwd": "/path/to/mcp-server",
"env": {
"TRUSTLAYER_API_TOKEN": "your_token_here",
"TRUSTLAYER_API_BASE_URL": "https://api.trustlayer.io",
"TRUSTLAYER_API_VERSION": "v1"
}
}
}
}HTTP Mode:
{
"mcpServers": {
"trustlayer": {
"url": "http://your-server:8000/mcp",
"transport": "streamable-http",
"headers": {
"Authorization": "Bearer your_api_token_here"
}
}
}
}Integration with n8n
Use the MCP server as a custom node or via HTTP interface. Start the HTTP server and connect to http://your-server:8000/mcp.
Configuration example:
{
"url": "http://your-server:8000/mcp",
"transport": "streamable-http",
"headers": {
"Authorization": "Bearer your_api_token_here"
}
}Note: Replace your-server:8000 with your actual server address and your_api_token_here with your TrustLayer API token.
Available Resources
The MCP server provides resources for:
trustlayer://parties/{id}- Individual partiestrustlayer://documents/{id}- Individual documentstrustlayer://projects/{id}- Individual projectstrustlayer://tags/{id}- Individual tagstrustlayer://compliance-profiles/{id}- Compliance profilestrustlayer://party-types/{id}- Party typestrustlayer://custom-fields/{id}- Custom fieldstrustlayer://reports/{id}- Reportstrustlayer://webhooks/{id}- Webhookstrustlayer://branding/{id}- Branding configurations
Available Tools
Get Operations
get_party- Get a party by IDget_document- Get a document by IDget_project- Get a project by IDget_contact- Get a contact by IDget_party_contacts- Get all contacts for a partyget_party_compliance_profile- Get compliance profile for a partyget_party_compliance_certificate- Get compliance certificate for a partyget_party_document_request- Get document request for a partyget_compliance_profile- Get a compliance profile by IDget_report- Get a report by ID
List Operations
list_parties- List all parties (with optional limit/offset)list_documents- List all documents (with optional limit/offset)list_projects- List all projects (with optional limit/offset)list_tags- List all tagslist_compliance_profiles- List all compliance profileslist_party_types- List all party typeslist_custom_fields- List all custom fieldslist_reports- List all reportslist_webhooks- List all webhooks
Project Structure
mcp-server/
├── src/
│ ├── __init__.py
│ ├── server.py # Main MCP server (stdio mode)
│ ├── http_server.py # HTTP MCP server
│ ├── trustlayer_client.py # TrustLayer API client
│ ├── config.py # Configuration
│ ├── resources.py # MCP resources
│ └── tools.py # MCP tools
├── run_server.sh # Stdio server launcher script
├── run_http_server.py # HTTP server launcher
├── test_server.py # Test script to verify server setup
├── test_tools.py # Test script to verify tools registration
├── pyproject.toml
├── requirements.txt
├── Dockerfile # Docker configuration
├── docker-compose.yml # Docker Compose configuration
├── env.example # Environment variables example
└── README.mdExample Usage
In Cursor/Claude
You can ask questions like:
"List all parties in TrustLayer"
"Get details for party ID 12345"
"Show me all documents for party 12345"
"What compliance profile does party 12345 have?"
The MCP server will fetch the data from TrustLayer API and return it in a structured format.
Security
Read-Only: The MCP server only supports GET operations
Token Security: Store API tokens securely in environment variables or use Authorization headers
No Data Modification: No create, update, or delete operations are exposed
HTTPS Recommended: Use HTTPS in production environments
Firewall: Restrict access through firewall to only necessary IPs
Monitoring
Health Check
The server provides a health check endpoint:
curl http://localhost:8000/healthExpected response:
{"status": "healthy"}Logs
Docker:
docker-compose logs -fSystemd:
sudo journalctl -u trustlayer-mcp -fLocal: Logs are output to stdout/stderr when running directly.
Troubleshooting
Token Issues
Ensure TRUSTLAYER_API_TOKEN is set correctly in your environment or .env file. For HTTP mode, you can also provide the token via Authorization header.
Connection Issues
Verify
TRUSTLAYER_API_BASE_URLis correctCheck network connectivity
Review server logs for error messages
For HTTP mode, ensure the server is running:
curl http://localhost:8000/health
Port Already in Use
# Check what's using port 8000
sudo lsof -i :8000
# Or change the port in run_http_server.pyMCP Client Issues
Ensure Python is in your PATH
Verify the MCP server can be started manually
Check MCP client logs for connection errors
For stdio mode, verify paths in configuration are correct
Docker Issues
Ensure Docker and Docker Compose are installed
Check container logs:
docker-compose logsVerify
.envfile exists and is properly configuredRebuild image if code changes:
docker-compose build --no-cache
Development
Testing
Quick Verification Scripts
Test server setup and imports:
python test_server.pyThis script verifies that:
Configuration loads correctly
Server can be imported
Tools are available
Test tools registration:
python test_tools.pyThis script verifies that tools are properly registered and can be listed.
Test Stdio Server
Option 1: Using the wrapper script:
./run_server.shOption 2: Direct Python execution:
source venv/bin/activate
python -m src.serverTest HTTP Server
# Start the HTTP server
python run_http_server.py
# In another terminal, test the endpoints
curl http://localhost:8000/health
curl http://localhost:8000/Code Formatting
black src/
ruff check src/License
Apache 2.0