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
- Distinctive: line 115
Use Scala 3 syntax (no Scala 2 compatibility)
- Distinctive: line 116
Follow functional programming principles
- Distinctive: line 117
Use for-comprehensions for async operations
- Distinctive: line 121
Use Slick for database queries
- Distinctive: line 122
Keep business logic separate from infrastructure concerns
- Distinctive: line 125
Use TypeScript strict mode
- Distinctive: line 128
Follow React best practices for state management
- Distinctive: line 129
Use proper typing for all props and state
- Distinctive: line 133
Keep code DRY (Don't Repeat Yourself)
- Distinctive: line 134
Write self-documenting code with clear variable/function names
- Distinctive: line 135
Add comments only when necessary to explain "why", not "what"
- Distinctive: line 136
Follow the existing code style in each file
- Distinctive: line 137
Ensure proper error handling and logging
- Distinctive: line 180
JWT Validation: All API requests require valid JWT tokens
- Distinctive: line 186
Never commit secrets, credentials, or tokens to source code
- Distinctive: line 187
Use environment variables for sensitive configuration
- Distinctive: line 189
Follow principle of least privilege
- Distinctive: line 190
Keep dependencies up to date
- Distinctive: line 205
When adding new features:
- Distinctive: line 206
Add corresponding tests in the appropriate test directory
- Distinctive: line 207
Follow existing test patterns and naming conventions
- Distinctive: line 208
Ensure tests are independent and can run in any order
- Very specific: line 220
Build: Use make build or direct sbt/npm commands
- Very specific: line 221
Test: Run tests with sbt test or npm test
- Distinctive: line 222
Verify: Test changes locally with running instances
- Distinctive: line 223
Commit: Use semantic commit messages
- Distinctive: line 232
All code is released under the Apache License 2.0.
- Distinctive: line 239
Reactive Principles: Follow the Reactive Manifesto principles
- Distinctive: line 240
Asynchronous: Prefer asynchronous, non-blocking operations
≈ “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.
Files
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 previewGenerate Protobuf stubs
cd js/console
make protoc-jsCoding 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 definitionsAuthentication 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 testfromscala/turnstile/directory
When adding new features:
- Add corresponding tests in the appropriate test directory
- Follow existing test patterns and naming conventions
- Ensure tests are independent and can run in any order
- 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
- Make Changes: Edit code in appropriate directory
- Build: Use
make buildor direct sbt/npm commands - Test: Run tests with
sbt testornpm test - Verify: Test changes locally with running instances
- 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
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
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.

