Model Context Protocol (MCP) server for querying TRUF.NETWORK data through AI Clients like Claude Desktop.
- Claude Desktop
Please inquire for support for other clients.
- Local Kwil Node - Running TRUF.NETWORK node
- Python 3.12+ - Required for MCP server
- pipx - For isolated installation
- Claude Desktop - For AI integration
macOS:
# Install Python 3.12+
brew install python@3.12
# Install pipx
brew install pipx
pipx ensurepathLinux (Ubuntu/Debian):
# Install Python 3.12+
sudo apt update && sudo apt install python3.12
# Install pipx
python3 -m pip install --user pipx
python3 -m pipx ensurepathWindows:
# Install Python 3.12+ from https://www.python.org/downloads/
# or use winget:
winget install Python.Python.3.12
# Install pipx
python -m pip install --user pipx
python -m pipx ensurepathClaude Desktop: Download from https://claude.ai/download
- Clone and install:
git clone https://github.com/trufnetwork/postgres-mcp.git
cd postgres-mcp
./install.sh-
Follow the prompts to configure:
- Database connection details (default: localhost:5432/kwild), just use the default if you didn't customize anything.
-
Restart Claude Desktop
-
Easily explore TRUF.NETWORK data with AI! Ask about specific stream IDs, data providers, and more—then let the AI help you run complex calculations or generate tailored suggestions before deciding how to use the data.
list_schemas- List database schemaslist_objects- List tables, views, etc.get_object_details- Get table structureexecute_sql- Run basic SQL queries, including getting records, checking stream type, taxonomies, etc.get_index- Get stream index dataget_index_change- Calculate percentage changes
The TRUF.NETWORK MCP server supports two transport modes:
Used by Claude Desktop and other local MCP clients that launch processes directly.
For remote connections, multi-client support, and production deployments. Requires additional configuration when deployed behind reverse proxies.
Starting with SSE Transport:
# Using Docker (matches TRUF.NETWORK PostgreSQL setup)
docker run -p 8000:8000 \
-e DATABASE_URI=postgresql://kwild@localhost:5432/kwild \
trufnetwork/postgres-mcp \
--access-mode=restricted \
--transport=sse \
--sse-host=0.0.0.0MCP Client Configuration for SSE:
Note: Claude Desktop doesn't support direct SSE. Use mcp-remote proxy:
{
"mcpServers": {
"truf-postgres": {
"command": "npx",
"args": ["mcp-remote", "http://localhost:8000/sse"]
}
}
}Other MCP clients (Cursor, Cline, Windsurf) with direct SSE support:
{
"mcpServers": {
"truf-postgres": {
"type": "sse",
"url": "http://localhost:8000/sse"
}
}
}When deploying the MCP server behind a reverse proxy (nginx, Caddy, Traefik, etc.), special configuration is required for SSE transport to work correctly.
📋 See the complete reverse proxy setup guide: MCP Server Reverse Proxy Configuration
The guide covers:
- Nginx, Caddy, Traefik, HAProxy, and Apache configurations
- Essential SSE streaming requirements
- Security considerations
- Testing and troubleshooting
- Production deployment examples
Connection issues:
- Verify your Kwil node is running
- Check database credentials
- Ensure PostgreSQL port 5432 is accessible from local
Claude integration:
- Restart Claude Desktop after installation
- Check config file locations:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
- Windows:
Windows-specific issues:
- IPv4/IPv6 addressing: Use
127.0.0.1instead oflocalhostfor SSH tunnels$env:DATABASE_URI = "postgresql://kwild@127.0.0.1:5432/kwild"
pipx uninstall postgres-mcp