Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4d8ac17
Moved API server to an apps sub-folder in preparation of working on w…
mike-parkhill Feb 12, 2026
6d76877
updated package-lock
mike-parkhill Feb 12, 2026
6977a56
refactor common components to allow for starting to build wallet server
mike-parkhill Feb 16, 2026
3f7aed6
more refactoring for shared bootstrapping
mike-parkhill Feb 16, 2026
bebdd6f
Initial placeholder server for the wallet
mike-parkhill Feb 17, 2026
24362f3
CI fixes after refactoring
mike-parkhill Feb 17, 2026
1966cfa
wallet server now supports did-create, list-dids and get-default-did
mike-parkhill Feb 18, 2026
6f94b68
added list_credentials tool
mike-parkhill Feb 18, 2026
7574744
continued work on the import credential flow
mike-parkhill Mar 3, 2026
394b7c6
improved docker building for the API container and added GH action fo…
mike-parkhill Mar 3, 2026
e52a4ef
fix some dependencies
mike-parkhill Mar 3, 2026
c5953b4
Adding AP2 support to the truvera-api-mcp server
mike-parkhill Mar 4, 2026
715d2d8
added AP2 end to end tests
mike-parkhill Mar 5, 2026
4a48883
clean up test objects in database
mike-parkhill Mar 5, 2026
9be6077
updated copilot-instructions
mike-parkhill Mar 5, 2026
1586aef
support both credential offers and direct issuance for AP2
mike-parkhill Mar 12, 2026
e6ffb12
added tool for fetching proof request results
mike-parkhill Mar 17, 2026
87597c5
fix payment mandate tool field/schema mismatch
mike-parkhill Mar 19, 2026
0b5ac22
add architecture diagram
mike-parkhill Mar 20, 2026
94df9a6
tweak some tests
mike-parkhill Mar 25, 2026
bccb459
fixed e2e tests for the api
mike-parkhill Mar 25, 2026
407b934
fix merge issue
mike-parkhill Mar 25, 2026
5fbe5df
exclude test files from build
mike-parkhill Mar 25, 2026
def0e7d
Updated the README files to make things cleaner - hopefully
mike-parkhill Mar 25, 2026
16d8d22
Update .github/copilot-instructions.md
esplinr Mar 31, 2026
f33150e
trigger checks
mike-parkhill Apr 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 37 additions & 10 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,37 @@
.node_modules/
dist/
node_modules/
*.log
.env
.env.local
.DS_Store
*.swp
*.swo
*~
# Ignore node_modules everywhere
**/node_modules
**/dist

# Ignore git
**/.git
**/.gitignore

# Ignore environment files
**/.env
**/.env.local
**/.env.*.local

# Ignore IDE
**/.vscode
**/.idea
**/*.swp
**/*.swo

# Ignore test files
**/*.test.ts
**/*.test.js
**/tests
**/__tests__

# Ignore docs
**/README.md
**/*.md
!apps/truvera-api/README.md

# Ignore CI/CD
**/.github

# Keep only what we need for services and shared packages
!packages/mcp-shared
!apps/truvera-api
!apps/wallet-server
14 changes: 6 additions & 8 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# Example environment variables for local development
# Copy this file to .env and update with your actual values

# Truvera API Configuration
TRUVERA_API_KEY=your-api-key-here
TRUVERA_API_ENDPOINT=https://api-testnet.truvera.io

# Node environment
NODE_ENV=development
# Each MCP server has its own .env file with service-specific configuration:
#
# - apps/truvera-api/.env.example - Truvera REST API service
# - apps/wallet-server/.env.example - Truvera Wallet SDK service
#
# Copy the relevant .env.example to .env in each app directory and update with your values
8 changes: 0 additions & 8 deletions .env.tests

This file was deleted.

118 changes: 99 additions & 19 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,142 @@
# Truvera MCP Service - Copilot Instructions
# Truvera MCP Servers - Copilot Instructions

This is a Model Context Protocol (MCP) server built with TypeScript/Node.js for integrating with the Truvera REST API.
This is a monorepo containing multiple Model Context Protocol (MCP) servers built with TypeScript/Node.js for integrating with various APIs.

## Project Overview
## Repository Structure

- **Type**: MCP Server (Model Context Protocol)
- **Type**: Monorepo with multiple MCP Servers
- **Language**: TypeScript/JavaScript
- **Runtime**: Node.js 18+
- **Deployment**: Docker & Docker Compose
- **Primary Purpose**: Enable Claude to make authenticated REST API calls to Truvera
- **Primary Purpose**: Enable Claude to make authenticated REST API calls to various Truvera services

## Key Features
## Apps Structure

This repository uses an `apps/` directory to organize multiple MCP servers:

- `apps/truvera-api/` - Main Truvera MCP Server for verifiable credentials and DIDs

Each app is a self-contained MCP server with its own:
- `package.json` - Dependencies and scripts
- `tsconfig.json` - TypeScript configuration
- `src/` - Source code
- `tests/` - Test suites
- `Dockerfile` - Container build configuration
- `README.md` - App-specific documentation

## Truvera MCP Server (apps/truvera-api)

### Key Features

- Configurable API endpoint via `TRUVERA_API_ENDPOINT` environment variable
- Secure API key management via `TRUVERA_API_KEY` environment variable
- Built-in tool: `call_truvera_api` for making HTTP requests to Truvera API
- Feature-based architecture: each API area in `src/features/<feature>/`
- Built-in tools for credentials, DIDs, presentations, schemas, profiles, and verification
- Multi-stage Docker build for optimized production images
- Development and debugging support via VS Code

## Environment Variables
### Environment Variables

- **TRUVERA_API_KEY** (required): Authentication key for Truvera API
- **TRUVERA_API_ENDPOINT** (optional): Base URL for Truvera API (defaults to `https://api.truvera.com`)

## Documentation
### Documentation

- See `README.md` for comprehensive setup and usage instructions
- See `Dockerfile` for production container build configuration
- See `docker-compose.yml` for local deployment
- See `.vscode/mcp.json` for MCP server configuration
- See `apps/truvera-api/README.md` for comprehensive setup and usage instructions
- **See `apps/truvera-api/copilot-instructions.md` for detailed development guidelines**
- See `apps/truvera-api/Dockerfile` for production container build configuration
- See `docker-compose.yml` for multi-service deployment
- See `.vscode/tasks.json` for VS Code task configuration
- See `.vscode/launch.json` for VS Code debugging setup

## Development Commands

### Root Level (All Apps)

```bash
npm install # Install dependencies for all workspaces
npm run build # Build all apps
npm run test # Run tests for all apps
npm run typecheck # Type check all apps
npm run lint # Lint all apps
```

### Truvera Server Specific

```bash
cd apps/truvera-api
npm install # Install dependencies
npm run dev # Development mode with hot reload
npm run build # Build TypeScript to JavaScript
npm start # Run production build
npm run typecheck # Run TypeScript type checking
```

Or from root:

```bash
npm run build:truvera
npm run dev:truvera
npm run test:truvera
```

## Docker Commands

```bash
docker build -t truvera-mcp-service:latest . # Build image
docker-compose up -d # Start service with Docker Compose
docker-compose up -d # Start all services
docker-compose logs -f # View logs
docker-compose down # Stop service
docker-compose down # Stop all services

# Build specific service
docker build -t truvera-mcp-service:latest ./apps/truvera-api
```

## MCP Configuration
## VS Code Configuration

The MCP server is configured in `.vscode/mcp.json` to run as a stdio-based server. It can be debugged locally in VS Code using the configuration in `.vscode/launch.json`.
VS Code tasks and launch configurations are set up at the workspace root level:
- Tasks reference `apps/truvera-api` directory
- Launch configurations use correct paths to each app's build output
- Each app can be debugged independently

## Adding New MCP Servers

1. Create new directory: `apps/<new-server>/`
2. Add package.json with appropriate dependencies
3. Set up TypeScript configuration
4. Create src/, tests/, and scripts/ structure
5. Add Dockerfile for containerization
6. Update `docker-compose.yml` to include new service
7. Add build tasks to `.vscode/tasks.json`
8. Add CI steps to `.github/workflows/ci.yml`
9. Create README.md with server-specific documentation

## Security Notes

- API keys should be stored securely (never commit `.env` files)
- Always use HTTPS endpoints in production
- Docker container runs as non-root user for security
- Docker containers run as non-root user for security
- Input validation is performed on API requests

## Best Practices

### Testing
- Write E2E tests for all API integrations (they catch real bugs!)
- Always clean up resources (credentials, DIDs) in `afterAll` hooks
- Use TDD: write tests first, let them reveal API requirements
- Load `.env` first, then `.env.test` for test-specific overrides

### API Integration
- Follow W3C Verifiable Credentials format for all credentials
- Always wrap credentials in `{ credential: { ... } }` for POST /credentials
- Use `encodeURIComponent()` for all URL parameters
- Pass full VC documents to verification, not metadata

### Code Quality
- Enable TypeScript strict mode
- Use feature-based architecture in `src/features/<feature>/`
- Share common types in `src/features/shared/`
- Document with inline JSDoc comments
- Follow SOLID, DRY, and KISS principles for maintainable code
- Follow TDD practices


27 changes: 15 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,24 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: 'package-lock.json'

- name: Install dependencies
run: npm ci
- name: Install dependencies (monorepo)
run: npm ci --workspaces

- name: Build (TypeScript)
run: npm run build
- name: Build shared package
run: npm run build:shared

- name: Unit tests
run: npm run test -- --run --testNamePattern "^unit:"
- name: Build truvera-api
run: npm run build:api

- name: Integration tests
run: npm run test -- --run --testNamePattern "^integration:"
- name: Build wallet-server
run: npm run build --workspace=apps/wallet-server

- name: E2E tests
run: npm run test -- --run --testNamePattern "^e2e:"
- name: Run tests (truvera-api)
run: npm run test -- --run
working-directory: apps/truvera-api

- name: Smoke tests
run: npm run smoke
- name: Run tests (mcp-shared)
run: npm run test -- --run
working-directory: packages/mcp-shared
79 changes: 79 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build and Push Docker Images

on:
push:
branches:
- main
paths:
- 'apps/truvera-api/**'
- 'packages/mcp-shared/**'
- '.github/workflows/docker-publish.yml'
release:
types: [published]

workflow_dispatch:
inputs:
push:
description: 'Push images to DockerHub'
required: false
default: true
type: boolean

jobs:
build-and-push:
name: Build and Push truvera-api-mcp
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Read build number
id: build_number
run: |
BUILD_NUM=$(cat apps/truvera-api/.buildnumber)
echo "build_number=$BUILD_NUM" >> $GITHUB_OUTPUT
echo "Build number: $BUILD_NUM"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKER_HUB_USERNAME }}/truvera-api-mcp
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=${{ steps.build_number.outputs.build_number }}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix={{branch}}-

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./apps/truvera-api/Dockerfile
push: ${{ github.event_name != 'pull_request' && (github.event.inputs.push == 'true' || github.event.inputs.push == null) }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILD_NUMBER=${{ steps.build_number.outputs.build_number }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64

- name: Image digest
run: echo "Image pushed with digest ${{ steps.docker_build.outputs.digest }}"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ npm-debug.log*
.DS_Store
truvera/
.buildnumber
src/build-info.ts
src/build-info.ts
apps/truvera-api/.env.test
9 changes: 5 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
{
"type": "node",
"request": "launch",
"name": "Debug MCP Service",
"program": "${workspaceFolder}/dist/index.js",
"preLaunchTask": "build",
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"name": "Debug MCP Service (Truvera)",
"program": "${workspaceFolder}/apps/truvera-api/dist/index.js",
"preLaunchTask": "build:truvera",
"outFiles": ["${workspaceFolder}/apps/truvera-api/dist/**/*.js"],
"cwd": "${workspaceFolder}/apps/truvera-api",
"env": {
"TRUVERA_API_KEY": "${config:truvera.apiKey}",
"TRUVERA_API_ENDPOINT": "${config:truvera.apiEndpoint}"
Expand Down
Loading
Loading