Building from Source

Complete guide to building an IETF vCon-compliant MCP Server from scratch

📋 Table of Contents


Prerequisites

Required Knowledge

  • ✅ TypeScript/JavaScript programming

  • ✅ Node.js and npm/yarn

  • ✅ PostgreSQL basics

  • ✅ REST APIs and JSON

  • ✅ Git version control

Required Software

Time Estimate

  • Total: 4-6 hours for first-time implementation

  • Experienced developers: 2-3 hours


Project Overview

What We're Building

An MCP (Model Context Protocol) Server that:

  • Stores and manages IETF vCon (Virtual Conversation) data

  • Provides tools for AI assistants to interact with vCons

  • Ensures full compliance with draft-ietf-vcon-vcon-core-00

  • Uses Supabase (PostgreSQL) as the database backend

Key Features

  • ✅ Create, read, update, delete vCons

  • ✅ Add dialog, analysis, and attachments

  • ✅ Search and query vCon data

  • ✅ Privacy and consent management

  • ✅ Spec-compliant data validation

  • ✅ MCP tools for AI integration

Architecture


Phase 1: Environment Setup

Step 1.1: Create Project Directory

Step 1.2: Initialize Node.js Project

Step 1.3: Install Dependencies

What each package does:

  • @modelcontextprotocol/sdk - MCP server framework

  • @supabase/supabase-js - Supabase client library

  • zod - Schema validation library

  • typescript - TypeScript compiler

  • tsx - TypeScript execution for development

  • vitest - Testing framework

Step 1.4: Configure TypeScript

Create tsconfig.json:

Step 1.5: Update package.json Scripts

Add these scripts to your package.json:

Step 1.6: Create .env.example

Create .env.example:

Step 1.7: Create .gitignore

Create .gitignore:

✅ Phase 1 Checkpoint

Verify your setup:


Phase 2: Database Setup

Step 2.1: Create Supabase Project

  1. Click "New Project"

  2. Fill in:

    • Name: vcon-mcp-server

    • Database Password: (Generate strong password)

    • Region: (Choose closest to you)

  3. Click "Create new project"

  4. Wait 2-3 minutes for provisioning

Step 2.2: Get Supabase Credentials

  1. Go to Project Settings → API

  2. Copy:

    • Project URL → SUPABASE_URL

    • anon/public key → SUPABASE_ANON_KEY

Create .env file:

Step 2.3: Run Database Schema

  1. Go to SQL Editor in Supabase dashboard

  2. Copy the entire schema from CORRECTED_SCHEMA.md

  3. Paste into SQL Editor

  4. Click "Run" to execute

Key tables created:

  • vcons - Main vCon records

  • parties - Conversation participants

  • dialog - Conversation content (recordings, text, etc.)

  • analysis - AI/ML analysis results

  • attachments - File attachments

  • party_history - Party event timeline

Step 2.4: Verify Database Schema

Run these verification queries in SQL Editor:

Expected results:

  • ✅ 8+ tables created

  • analysis.schema exists (NOT schema_version)

  • analysis.vendor is NOT NULL

  • analysis.body is TEXT type

  • ✅ No DEFAULT values on encoding fields

  • ✅ Dialog type constraint exists

Step 2.5: Set Up Row Level Security (Optional)

For multi-tenant applications, enable RLS:

✅ Phase 2 Checkpoint

Verify database setup:


Phase 3: Project Structure

Step 3.1: Create Directory Structure

Step 3.2: Verify Structure

Your project should now look like this:

✅ Phase 3 Checkpoint


Phase 4: Core Implementation

Step 4.1: Create vCon Types

Create src/types/vcon.ts:

💡 Key Points:

  • ✅ Uses schema not schema_version in Analysis

  • vendor is required (no ?) in Analysis

  • body is string type (not object)

  • ✅ Includes uuid field in Party

  • ✅ Includes new fields: session_id, application, message_id

Step 4.2: Create Database Client

Create src/db/client.ts:

Step 4.3: Create Database Queries

Create src/db/queries.ts:

Step 4.4: Create Validation Utilities

Create src/utils/validation.ts:

✅ Phase 4 Checkpoint

Verify your implementation:


Phase 5: MCP Server

Step 5.1: Create MCP Tool Definitions

Create src/tools/vcon-crud.ts:

Step 5.2: Create MCP Server

Create src/index.ts:

Step 5.3: Test the Server

✅ Phase 5 Checkpoint

The server should:

  • ✅ Start without errors

  • ✅ List 4 tools (create, add_analysis, get, search)

  • ✅ Accept tool calls

  • ✅ Return proper responses


Phase 6: Testing & Validation

Step 6.1: Create Compliance Tests

Create tests/vcon-compliance.test.ts:

Step 6.2: Run Tests

Step 6.3: Verify No Incorrect Field Names

✅ Phase 6 Checkpoint

All tests should pass:

  • ✅ No schema_version in codebase

  • vendor is required in Analysis type

  • body accepts string values

  • ✅ All validation tests pass


Phase 7: Deployment

Step 7.1: Build for Production

Step 7.2: Configure MCP Client

Add to your MCP client configuration (e.g., Claude Desktop):

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

Step 7.3: Test with AI Assistant

Restart your AI assistant and try:

✅ Phase 7 Checkpoint

The AI should:

  • ✅ See the vCon tools

  • ✅ Successfully create vCons

  • ✅ Add analysis with correct field names

  • ✅ Retrieve and search vCons


Troubleshooting

Issue: TypeScript Compilation Errors

Symptom: Errors about missing types or incorrect field names

Solution:

Issue: Database Connection Fails

Symptom: "Missing Supabase credentials" error

Solution:

Issue: "schema_version does not exist" Error

Symptom: Database error about unknown column

Solution:

If incorrect, re-run the corrected schema from CORRECTED_SCHEMA.md.

Issue: Vendor Validation Fails

Symptom: "vendor is required" error

Solution:

  • ✅ Always include vendor in analysis objects

  • ✅ Check that Analysis type doesn't have vendor? (with question mark)

  • ✅ Verify tool schema marks vendor as required

Issue: MCP Server Doesn't Start

Symptom: Server crashes on startup

Solution:


Next Steps

Enhancements to Consider

  1. Add More Tools

    • Update vCon

    • Delete vCon

    • Add dialog

    • Add attachments

    • Export vCon to JWS/JWE

  2. Add Resources

    • vcon://v1/vcons URI scheme

    • List recent vCons

    • vCon templates

  3. Add Prompts

    • Summarize conversation

    • Extract action items

    • Compliance check

  4. Advanced Features

    • Privacy redaction

    • Consent management

    • Group vCons

    • Digital signatures (JWS)

    • Encryption (JWE)

  5. Performance

    • Caching layer

    • Batch operations

    • Pagination

    • Indexes optimization

  6. Security

    • Row Level Security

    • API rate limiting

    • Input sanitization

    • Audit logging

Learning Resources

  • IETF vCon Spec: background_docs/draft-ietf-vcon-vcon-core-00.txt

  • MCP Documentation: https://modelcontextprotocol.io/

  • Supabase Docs: https://supabase.com/docs

  • Implementation Guide: CLAUDE_CODE_INSTRUCTIONS.md

  • Quick Reference: QUICK_REFERENCE.md

Community & Support

  • vCon Working Group: https://datatracker.ietf.org/wg/vcon/

  • MCP Discord: https://discord.gg/modelcontextprotocol

  • Issues: File bugs/questions in your repo issues


Appendix: Command Reference

Development Commands

Git Commands

Database Commands


Success Checklist

Your implementation is complete when:


🎉 Congratulations! You've built a fully spec-compliant IETF vCon MCP Server!


Last Updated: October 7, 2025 Spec Version: draft-ietf-vcon-vcon-core-00 vCon Schema: 0.3.0

Last updated