-
Notifications
You must be signed in to change notification settings - Fork 1
Features/wallet server #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 24 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…
m-parkhill 6d76877
updated package-lock
m-parkhill 6977a56
refactor common components to allow for starting to build wallet server
m-parkhill 3f7aed6
more refactoring for shared bootstrapping
m-parkhill bebdd6f
Initial placeholder server for the wallet
m-parkhill 24362f3
CI fixes after refactoring
m-parkhill 1966cfa
wallet server now supports did-create, list-dids and get-default-did
m-parkhill 6f94b68
added list_credentials tool
m-parkhill 7574744
continued work on the import credential flow
m-parkhill 394b7c6
improved docker building for the API container and added GH action fo…
m-parkhill e52a4ef
fix some dependencies
m-parkhill c5953b4
Adding AP2 support to the truvera-api-mcp server
m-parkhill 715d2d8
added AP2 end to end tests
m-parkhill 4a48883
clean up test objects in database
m-parkhill 9be6077
updated copilot-instructions
m-parkhill 1586aef
support both credential offers and direct issuance for AP2
m-parkhill e6ffb12
added tool for fetching proof request results
m-parkhill 87597c5
fix payment mandate tool field/schema mismatch
m-parkhill 0b5ac22
add architecture diagram
m-parkhill 94df9a6
tweak some tests
m-parkhill bccb459
fixed e2e tests for the api
m-parkhill 407b934
fix merge issue
m-parkhill 5fbe5df
exclude test files from build
m-parkhill def0e7d
Updated the README files to make things cleaner - hopefully
m-parkhill 16d8d22
Update .github/copilot-instructions.md
esplinr f33150e
trigger checks
m-parkhill File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 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 | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,4 +7,5 @@ npm-debug.log* | |
| .DS_Store | ||
| truvera/ | ||
| .buildnumber | ||
| src/build-info.ts | ||
| src/build-info.ts | ||
| apps/truvera-api/.env.test | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.