Railway

Deploy apap-sample

Accord Project Agreement Protocol (APAP) & MCP Server

Deploy apap-sample

Just deployed

/var/lib/postgresql/data

Deploy and Host the Accord Project APAP Reference Server on Railway

The Accord Project Agreement Protocol (APAP) is an open standard that defines how agreement tools — including AI agents — communicate with a smart contract template server over REST and MCP (Model Context Protocol). This deployment runs the official reference implementation: a ready-to-use server for template management, document generation, and format conversion.

About Hosting the APAP Reference Server

The APAP Reference Implementation is a Node.js/Express server backed by Postgres. It exposes the full APAP REST API for managing contract templates and agreements, and an MCP interface that lets AI assistants and LLM-powered tools interact with agreements directly using natural language. This Railway template provisions the server and a managed Postgres instance, runs schema migrations automatically on each deploy, and exposes the API on a public Railway domain. No additional infrastructure setup is required.

Common Use Cases

  • Connect AI assistants and LLM agents to contract template workflows via the built-in MCP server
  • Rapidly prototype agreement automation by deploying a compliant APAP server without writing infrastructure code
  • Integrate document generation and format conversion (HTML, PDF) into agreement tooling via the standardised REST API and the Accord Project open-source ecosystem

Dependencies for APAP Reference Server Hosting

  • Node.js ≥ 20
  • PostgreSQL 18

Deployment Dependencies

Implementation Details

The REST API exposes the following resources:

  • GET /capabilities — advertises supported protocol features
  • /templates — CRUD for contract templates (.cta archives)
  • /agreements — CRUD for agreements, plus POST /agreements/:id/trigger and POST /agreements/:id/convert/:format for document generation and format conversion (HTML, PDF, etc.)

The server also exposes two MCP transports on the same port as the REST API:

  • GET /sse — legacy SSE transport (for Claude custom integrations)
  • POST /mcp — Streamable HTTP transport (session-stateful)

Schema migrations run automatically via npm run db:migrateprod before each deploy. The HOST environment variable must be set to 0.0.0.0 for Railway's networking — this is pre-configured in the template.

Why Deploy the APAP Reference Server on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying the APAP Reference Server on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


Template Content

More templates in this category

View Template
NEW
Paperless-ngx
Document management with OCR on Railway with PostgreSQL and Redis

INAPP
1
View Template
open-excalidraw
Self-hostable collaborative drawing built on Excalidraw

Prateek Mohanty
1
View Template
caring-vibrancy
Deploy and Host caring-vibrancy with Railway

5