agentleFS
portolanetworkportolanetwork/dragon/.github/copilot-instructions.md

dragon

Copilot instructions4 starsChanged 13 months agoApache-2.0View on GitHub

Dragon is an open-source, cloud-native, distributed hub for Model Context Protocol (MCP). It's built on Apache Pekko's actor system and provides a foundation for scalable MCP routing and tool aggregation. Dragon uses a multi-language, distributed architecture: - Backend (Scala): Located in scala/turnstile/ - Core MCP gateway and server management - Frontend (TypeScript/React): Located in js/console/ - Web-based console UI - Protocol Definitions: Located in resources/proto/ - gRPC/Protobuf definitions

  • Installs packages

The file

Show its rules and text

We split this copilot-instructions.md into the rules it gives an agent

29 rules. About 0 are common, 27 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈27

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Use Scala 3 syntax (no Scala 2 compatibility)

    line 115
  2. Distinctive:

    Follow functional programming principles

    line 116
  3. Distinctive:

    Use for-comprehensions for async operations

    line 117
  4. Distinctive:

    Use Slick for database queries

    line 121
  5. Distinctive:

    Keep business logic separate from infrastructure concerns

    line 122
  6. Distinctive:

    Use TypeScript strict mode

    line 125
  7. Distinctive:

    Follow React best practices for state management

    line 128
  8. Distinctive:

    Use proper typing for all props and state

    line 129
  9. Distinctive:

    Keep code DRY (Don't Repeat Yourself)

    line 133
  10. Distinctive:

    Write self-documenting code with clear variable/function names

    line 134
  11. Distinctive:

    Add comments only when necessary to explain "why", not "what"

    line 135
  12. Distinctive:

    Follow the existing code style in each file

    line 136
  13. Distinctive:

    Ensure proper error handling and logging

    line 137
  14. Distinctive:

    JWT Validation: All API requests require valid JWT tokens

    line 180
  15. Distinctive:

    Never commit secrets, credentials, or tokens to source code

    line 186
  16. Distinctive:

    Use environment variables for sensitive configuration

    line 187
  17. Distinctive:

    Follow principle of least privilege

    line 189
  18. Distinctive:

    Keep dependencies up to date

    line 190
  19. Distinctive:

    When adding new features:

    line 205
  20. Distinctive:

    Add corresponding tests in the appropriate test directory

    line 206
  21. Distinctive:

    Follow existing test patterns and naming conventions

    line 207
  22. Distinctive:

    Ensure tests are independent and can run in any order

    line 208
  23. Very specific:

    Build: Use make build or direct sbt/npm commands

    line 220
  24. Very specific:

    Test: Run tests with sbt test or npm test

    line 221
  25. Distinctive:

    Verify: Test changes locally with running instances

    line 222
  26. Distinctive:

    Commit: Use semantic commit messages

    line 223
  27. Distinctive:

    All code is released under the Apache License 2.0.

    line 232
  28. Distinctive:

    Reactive Principles: Follow the Reactive Manifesto principles

    line 239
  29. Distinctive:

    Asynchronous: Prefer asynchronous, non-blocking operations

    line 240

≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

Dragon MCP Hub - GitHub Copilot Instructions

Project Overview

Dragon is an open-source, cloud-native, distributed hub for Model Context Protocol (MCP). It's built on Apache Pekko's actor system and provides a foundation for scalable MCP routing and tool aggregation.

Architecture

Dragon uses a multi-language, distributed architecture:

  • Backend (Scala): Located in scala/turnstile/ - Core MCP gateway and server management
  • Frontend (TypeScript/React): Located in js/console/ - Web-based console UI
  • Protocol Definitions: Located in resources/proto/ - gRPC/Protobuf definitions

Key Components

  • MCP Gateway (mcp_gateway): Handles MCP protocol routing and aggregation
  • MCP Server (mcp_server): Manages downstream MCP server connections
  • MCP Client (mcp_client): Client-side MCP interactions
  • MCP Tools (mcp_tools): Tool implementations and management
  • Auth (auth): OAuth2/OIDC authentication with JWT validation
  • Management API (mgmt): gRPC-based server management
  • Database (db): PostgreSQL persistence with Slick and Flyway migrations

Technology Stack

Backend (Scala)

  • Language: Scala 3.7.3 (modern Scala with minimal boilerplate)
  • Build Tool: sbt 1.11+
  • Actor System: Apache Pekko 1.3.0 (Akka fork)
  • HTTP/gRPC: Apache Pekko HTTP and gRPC
  • Database: PostgreSQL with Slick 3.5.2 for database access
  • Migrations: Flyway for database schema management
  • MCP SDK: MCP Java SDK 0.16.0
  • Reactive HTTP: Spring WebFlux (embedded)
  • Auth: JWT/Auth0 for OAuth2/OIDC

Frontend (TypeScript/React)

  • Framework: React (latest) with TypeScript 5.9+
  • Build Tool: Vite (latest)
  • UI Framework: Material-UI (MUI) v7
  • State Management: React hooks
  • Auth: Auth0 React SDK
  • API Communication: gRPC-Web with Protobuf
  • Charts: MUI X-Charts
  • Data Grid: MUI X-Data-Grid and AG Grid Enterprise

Build and Test Instructions

Scala Backend

Prerequisites

  • JDK 17 or later
  • sbt 1.11+
  • PostgreSQL 12+

Build Commands

cd scala/turnstile

# Compile
sbt compile

# Package
sbt package

# Clean and build
make build-clean

# Run tests
sbt test

# Run the server
sbt "runMain app.dragon.turnstile.main.Turnstile"

Environment Variables Required

export DEPLOYMENT_NAME=default
export DATABASE_URL=<db-url>
export DATABASE_USER=<db-user>
export DATABASE_PASSWORD=<db-password>
export AUTH0_DOMAIN=<auth0-domain>
export AUTH0_AUDIENCE=<auth0-audience>
export AUTH0_CLIENT_AUDIENCE=<auth0-client-audience>

Frontend (JavaScript/TypeScript)

Build Commands

cd js/console

# Install dependencies
npm install

# Development server
npm run dev

# Build for production
npm run build

# Preview production build
npm run preview

Generate Protobuf stubs

cd js/console
make protoc-js

Coding Standards and Conventions

Scala

  • Use Scala 3 syntax (no Scala 2 compatibility)
  • Follow functional programming principles
  • Use for-comprehensions for async operations
  • Leverage Scala 3's strong type system
  • Minimize boilerplate using given/using clauses
  • Actor-based patterns with Apache Pekko
  • Use Slick for database queries
  • Keep business logic separate from infrastructure concerns

TypeScript/React

  • Use TypeScript strict mode
  • Functional components with hooks (no class components)
  • Material-UI components for consistency
  • Follow React best practices for state management
  • Use proper typing for all props and state
  • Organize components by feature/domain

General

  • Keep code DRY (Don't Repeat Yourself)
  • Write self-documenting code with clear variable/function names
  • Add comments only when necessary to explain "why", not "what"
  • Follow the existing code style in each file
  • Ensure proper error handling and logging

Project Structure

dragon/
├── .github/                     # GitHub configuration
├── scala/turnstile/             # Scala backend
│   ├── src/
│   │   ├── main/
│   │   │   ├── scala/           # Scala source code
│   │   │   │   └── app/dragon/turnstile/
│   │   │   │       ├── auth/           # Authentication logic
│   │   │   │       ├── config/         # Configuration
│   │   │   │       ├── db/             # Database access
│   │   │   │       ├── mcp_client/     # MCP client
│   │   │   │       ├── mcp_gateway/    # MCP gateway
│   │   │   │       ├── mcp_server/     # MCP server management
│   │   │   │       ├── mcp_tools/      # Tool implementations
│   │   │   │       ├── mgmt/           # Management API
│   │   │   │       ├── main/           # Application entry points
│   │   │   │       └── utils/          # Utilities
│   │   │   └── resources/
│   │   │       ├── application.conf    # Application configuration
│   │   │       └── db/migration/       # Flyway migrations
│   │   └── test/scala/          # Test code
│   ├── build.sbt                # SBT build definition
│   └── Makefile                 # Build automation
├── js/console/                  # TypeScript/React frontend
│   ├── src/
│   │   ├── components/          # React components
│   │   ├── proto/               # Generated protobuf code
│   │   └── ...
│   ├── package.json             # NPM dependencies
│   ├── tsconfig.json            # TypeScript configuration
│   ├── vite.config.ts           # Vite build configuration
│   └── Makefile                 # Build automation
└── resources/proto/             # Shared protobuf definitions

Authentication and Security

  • OAuth2/OIDC: Using Auth0 for authentication
  • JWT Validation: All API requests require valid JWT tokens
  • User Isolation: Tenant/user-level isolation for MCP server instances
  • Authorization: Bearer token authentication for gRPC and HTTP APIs
  • Token Refresh: Automatic token refresh support

Security Best Practices

  • Never commit secrets, credentials, or tokens to source code
  • Use environment variables for sensitive configuration
  • Validate all inputs
  • Follow principle of least privilege
  • Keep dependencies up to date

Database

  • Database: PostgreSQL 12+
  • Migrations: Located in scala/turnstile/src/main/resources/db/migration/
  • Access Layer: Slick for type-safe database queries
  • Migration Tool: Flyway (runs automatically on startup)

Testing

  • Scala Tests: Located in scala/turnstile/src/test/scala/
  • Test Framework: ScalaTest (based on existing test files)
  • Run Tests: sbt test from scala/turnstile/ directory

When adding new features:

  1. Add corresponding tests in the appropriate test directory
  2. Follow existing test patterns and naming conventions
  3. Ensure tests are independent and can run in any order
  4. Mock external dependencies

API Endpoints

  • gRPC API: localhost:8080 (server management)
  • gRPC-Web API: localhost:8081 (server management from UI)
  • MCP Gateway: localhost:8082/mcp (MCP protocol endpoint)

Development Workflow

  1. Make Changes: Edit code in appropriate directory
  2. Build: Use make build or direct sbt/npm commands
  3. Test: Run tests with sbt test or npm test
  4. Verify: Test changes locally with running instances
  5. Commit: Use semantic commit messages

Contributing Guidelines

At this early stage, external code contributions are not yet accepted. Please open issues or start discussions for:

  • Bug reports
  • Feature requests
  • Questions or feedback

All code is released under the Apache License 2.0.

Important Notes

  • Branding: The name "Dragon" and related branding are protected trademarks
  • License: Apache License 2.0
  • Distributed Architecture: Code should be designed for horizontal scalability
  • Reactive Principles: Follow the Reactive Manifesto principles
  • Asynchronous: Prefer asynchronous, non-blocking operations
  • Type Safety: Leverage strong typing to catch errors at compile time

Resources

  • Configuration Reference
  • Database Schema
  • API Documentation
  • Auth0 Setup Guide

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.