Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
493f765
Initial plan
Copilot Jan 6, 2026
c2a2e1f
Add MCP configuration, dev environment, and enhance Copilot instructions
Copilot Jan 6, 2026
ed3b35f
Add DEVELOPMENT.md guide and MCP verification script
Copilot Jan 6, 2026
2d5dde2
Add comprehensive MCP and dev environment documentation
Copilot Jan 6, 2026
23438e1
Fix code review issues: correct URLs, improve error handling, update …
Copilot Jan 6, 2026
551a550
Merge branch 'main' into copilot/configure-model-context-protocol-ser…
d-morrison Jan 7, 2026
71e2e67
Merge remote-tracking branch 'origin/copilot/configure-model-context-…
d-morrison Jan 7, 2026
c46866f
Initial plan
Copilot Jan 7, 2026
e1d7822
Initial plan
Copilot Jan 7, 2026
8c4bec5
Fix pkgdown workflow: correct file paths and update deprecated actions
Copilot Jan 7, 2026
6ff113f
Optimize JAGS dependencies: remove unused platform steps from test-co…
Copilot Jan 7, 2026
d62b98d
Update pkgdown.yaml
d-morrison Jan 7, 2026
7d022a1
ignore pdfs
d-morrison Jan 7, 2026
969b20a
Fix getting-started.qmd: correct data variable references and remove …
Copilot Jan 8, 2026
e79c669
Remove Rplots.pdf and add to .gitignore
Copilot Jan 8, 2026
a6c08a0
Update pkgdown.yaml
d-morrison Jan 8, 2026
e485f0c
Merge branch 'test-mcp' into copilot/sub-pr-163-again
d-morrison Jan 8, 2026
ddfc3d4
Merge pull request #164 from UCD-SERG/copilot/sub-pr-163
d-morrison Jan 8, 2026
432dbac
Merge pull request #165 from UCD-SERG/copilot/sub-pr-163-again
d-morrison Jan 8, 2026
ffd2370
Merge branch 'main' into test-mcp
d-morrison Jan 8, 2026
0914ed2
Merge branch 'main' into test-mcp
d-morrison Jan 8, 2026
fe57e7d
Initial plan
Copilot Jan 8, 2026
0b13d9f
Address PR review comments: fix indentation, update paths, use offici…
Copilot Jan 8, 2026
3c7d7a0
Merge pull request #169 from UCD-SERG/copilot/sub-pr-163-again
d-morrison Jan 8, 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
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@

^_quarto\.yml$
^\.quarto$
^\.vscode$
^\.devcontainer$
^DEVELOPMENT\.md$
60 changes: 38 additions & 22 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,55 @@
{
"name": "serodynamics R Development",
"build": {
"dockerfile": "Dockerfile"
},
"name": "serodynamics R Package Development",
"image": "rocker/tidyverse:latest",

// Features to add to the dev container
"features": {
"ghcr.io/devcontainers/features/git:1": {}
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
}
},

// Configure tool-specific properties

"customizations": {
"vscode": {
"extensions": [
"REditorSupport.r",
"GitHub.copilot"
],
"settings": {
"r.rterm.linux": "/usr/local/bin/R",
"r.rpath.linux": "/usr/local/bin/R"
}
"r.rpath.linux": "/usr/local/bin/R",
"terminal.integrated.defaultProfile.linux": "bash"
},
"extensions": [
"rdebugger.r-debugger",
"reditorsupport.r",
"github.copilot",
"github.copilot-chat",
"quarto.quarto",
"redhat.vscode-yaml",
"yzhang.markdown-all-in-one",
"streetsidesoftware.code-spell-checker",
"eamodio.gitlens"
]
}
},

// Use 'postCreateCommand' to run commands after the container is created

"postCreateCommand": "bash .devcontainer/setup.sh",

// Set the default shell

"remoteUser": "rstudio",

// Forward ports for RStudio Server (optional)
"forwardPorts": [8787],

// Persist command history across container rebuilds
"portsAttributes": {
"8787": {
"label": "RStudio Server",
"onAutoForward": "notify"
}
},

"mounts": [
"source=serodynamics-bashhistory,target=/commandhistory,type=volume"
]
"source=${localWorkspaceFolder}/.Rprofile,target=/home/rstudio/.Rprofile,type=bind,consistency=cached"
],

"containerEnv": {
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}",
"TZ": "UTC"
}
}
72 changes: 57 additions & 15 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,63 @@
#!/bin/bash
# Post-creation setup script for the serodynamics dev container

set -e # Exit on error
set -e

echo "Setting up serodynamics development environment..."

# Set up persistent bash history
echo "Configuring bash history persistence..."
mkdir -p /commandhistory
touch /commandhistory/.bash_history
ln -sf /commandhistory/.bash_history /home/rstudio/.bash_history
# Update package list
echo "Updating package list..."
apt-get update

# Install JAGS (required for serodynamics)
echo "Installing JAGS..."
apt-get install -y jags

# Install system dependencies for R packages
echo "Installing system dependencies..."
apt-get install -y \
libcurl4-openssl-dev \
libssl-dev \
libxml2-dev \
libfontconfig1-dev \
libharfbuzz-dev \
libfribidi-dev \
libfreetype6-dev \
libpng-dev \
libtiff5-dev \
libjpeg-dev \
libgit2-dev

# Install Quarto
echo "Installing Quarto..."
QUARTO_VERSION="1.6.40" # Updated to latest stable version (January 2026)
wget -q https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-amd64.deb
dpkg -i quarto-${QUARTO_VERSION}-linux-amd64.deb
rm quarto-${QUARTO_VERSION}-linux-amd64.deb

# Install R packages needed for development
echo "Installing R development packages..."
Rscript -e "install.packages(c('devtools', 'roxygen2', 'testthat', 'lintr', 'spelling', 'covr', 'rcmdcheck', 'pak'), repos = 'https://cloud.r-project.org')"

# Install rjags from source (required for JAGS interface)
echo "Installing rjags..."
Rscript -e "install.packages('rjags', repos = 'https://cloud.r-project.org', type = 'source')"

# Install package dependencies
echo "Installing package dependencies..."
Rscript -e "pak::local_install_dev_deps(dependencies = TRUE)"

# Verify JAGS installation
echo "Verifying JAGS installation..."
Rscript -e "library(rjags); library(runjags); runjags::testjags()"

# Install project-specific R dependencies
echo "Installing R package dependencies..."
if ! Rscript -e 'devtools::install_dev_deps(dependencies = TRUE)'; then
echo "Error: Failed to install R dependencies. Please check the output above for details."
exit 1
fi
# Clean up
echo "Cleaning up..."
apt-get clean
rm -rf /var/lib/apt/lists/*

echo "Setup complete! The environment is ready for development."
echo "Development environment setup complete!"
echo ""
echo "You can now:"
echo " - Run 'devtools::load_all()' to load the package"
echo " - Run 'devtools::test()' to run tests"
echo " - Run 'devtools::check()' to check the package"
echo " - Use VS Code tasks (Ctrl+Shift+P -> Tasks: Run Task)"
64 changes: 63 additions & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,53 @@
- **Key Dependencies**: runjags, rjags, JAGS 4.3.1, serocalculator, ggmcmc, dplyr, ggplot2
- **Lifecycle**: Experimental (under active development)

## Development Environment Options

The repository provides multiple ways to set up your development environment:

### Option 1: Dev Container (Recommended for consistency)

Use the preconfigured development container for a fully automated setup:

1. Install Docker Desktop and VS Code with Dev Containers extension
2. Open the repository in VS Code
3. Click "Reopen in Container" when prompted
4. All dependencies (R, JAGS, system libraries) are installed automatically

See `.devcontainer/README.md` for details.

### Option 2: Local Installation (Traditional)

Install R, JAGS, and dependencies directly on your system (see Critical Setup Requirements below).

### Option 3: GitHub Codespaces

Use the dev container configuration in a cloud environment:
1. Go to the repository on GitHub
2. Click "Code" → "Codespaces" → "Create codespace"
3. Development environment is ready in your browser

## Model Context Protocol (MCP) Integration

The repository includes MCP server configurations in `.github/mcp/mcp-config.json` for enhanced AI-assisted development:

- **Filesystem Server**: Navigate and edit repository files
- **GitHub Server**: Check CI/CD status, review PRs, manage issues
- **Git Server**: Version control operations (status, diff, commit, branch)
- **Brave Search Server**: Look up R documentation and CRAN resources

These servers enhance GitHub Copilot and other AI assistants with context-aware capabilities. See `.github/mcp/README.md` for setup instructions.

## VS Code Configuration

The `.vscode/` directory contains optimized settings for R package development:

- **settings.json**: R-specific editor settings, file associations, and Copilot configuration
- **extensions.json**: Recommended VS Code extensions for R development
- **tasks.json**: Quick tasks for common operations (document, test, check, lint)

Use tasks via `Ctrl+Shift+P` → "Tasks: Run Task" or the Command Palette.

## Critical Setup Requirements

### Copilot Setup Workflow (Automatic Environment Configuration)
Expand Down Expand Up @@ -125,7 +172,7 @@ The package requires R version 4.1.0 or higher. Install R for your platform:
# Add CRAN repository for latest R version
sudo apt-get update
sudo apt-get install -y software-properties-common dirmngr
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/maruti.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
sudo apt-get update
sudo apt-get install -y r-base r-base-dev
Expand Down Expand Up @@ -408,6 +455,21 @@ Team members can trigger actions by commenting on PRs:
- **pkgdown/**: pkgdown website configuration
- `_pkgdown.yml`: Site structure, reference organization

- **.github/**: GitHub configuration and workflows
- `.github/workflows/`: CI/CD workflow definitions
- `.github/mcp/`: Model Context Protocol server configurations
- `.github/copilot-instructions.md`: Custom instructions for GitHub Copilot

- **.vscode/**: VS Code workspace configuration
- `settings.json`: Editor settings for R development
- `extensions.json`: Recommended VS Code extensions
- `tasks.json`: Quick tasks for common R package operations

- **.devcontainer/**: Development container configuration
- `devcontainer.json`: Container specification and VS Code integration
- `setup.sh`: Automated environment setup script
- `README.md`: Dev container usage documentation

### Configuration Files

- **DESCRIPTION**: Package metadata, dependencies, version (0.0.0.9044)
Expand Down
128 changes: 128 additions & 0 deletions .github/mcp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Model Context Protocol (MCP) Configuration

This directory contains the MCP server configuration for the serodynamics R package development environment.

## What is MCP?

Model Context Protocol (MCP) is an open protocol that enables seamless integration between AI assistants and development tools. It allows AI assistants to interact with your development environment through standardized servers.

## Configured MCP Servers

The `mcp-config.json` file configures the following MCP servers:

### 1. Filesystem Server
- **Purpose**: Provides file system access to the repository
- **Use cases**: Reading/writing files, searching code, managing project structure
- **Scope**: `/home/runner/work/serodynamics/serodynamics`

### 2. GitHub Server
- **Purpose**: Integrates with GitHub for repository operations
- **Use cases**: Issue tracking, pull requests, workflow management, CI/CD status
- **Authentication**: Uses `GITHUB_TOKEN` environment variable

### 3. Git Server
- **Purpose**: Provides Git version control operations
- **Use cases**: Status checks, diff viewing, log inspection, commits, branch management
- **Scope**: Repository at `/home/runner/work/serodynamics/serodynamics`

### 4. Brave Search Server
- **Purpose**: Enables web search capabilities
- **Use cases**: Finding R package documentation, CRAN resources, troubleshooting
- **Authentication**: Uses `BRAVE_API_KEY` environment variable (optional)

## Setup Instructions

### Important: Update Repository Paths

**Before using this configuration**, you must update the hardcoded repository paths in `mcp-config.json` to match your local clone location:

1. Open `.github/mcp/mcp-config.json`
2. Find all instances of `/home/runner/work/serodynamics/serodynamics`
3. Replace with your local repository path, for example:
- macOS/Linux: `/Users/yourname/projects/serodynamics` or `/home/yourname/serodynamics`
- Windows: `C:\\Users\\yourname\\projects\\serodynamics`

The default paths are specific to GitHub Actions CI environment and will not work for local development.

### Prerequisites

1. **Node.js**: Required to run the MCP servers via `npx`
```bash
# Check if Node.js is installed
node --version
npm --version
```

2. **Environment Variables**:
- `GITHUB_TOKEN`: GitHub Personal Access Token (required for GitHub server)
- `BRAVE_API_KEY`: Brave Search API key (optional, for web search)

### Using with GitHub Copilot

1. **In VS Code**:
- Install the latest GitHub Copilot extension
- The MCP configuration will be automatically detected from `.github/mcp/mcp-config.json`
- Copilot will use these servers to enhance code suggestions and operations

2. **In JetBrains IDEs**:
- Install GitHub Copilot plugin
- Configure MCP servers through the Copilot settings
- Point to this `mcp-config.json` file

### Using with Claude Desktop

If you want to use these MCP servers with Claude Desktop:

1. Copy the `mcpServers` section from `mcp-config.json`
2. **Update the repository paths** (`/home/runner/work/serodynamics/serodynamics`) to your local clone path
3. Add the modified configuration to your Claude Desktop configuration file:
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
- **Linux**: `~/.config/Claude/claude_desktop_config.json`

## Development Workflow Integration

The MCP servers are particularly useful for:

1. **Code Navigation**: Quickly finding and reading R source files
2. **Testing**: Checking test results and coverage
3. **CI/CD**: Monitoring workflow status and debugging failures
4. **Documentation**: Finding R package documentation and CRAN resources
5. **Version Control**: Managing commits, branches, and reviewing changes

## Best Practices

1. **Always check Git status** before making commits using the Git MCP server
2. **Use the GitHub server** to monitor CI/CD workflows and PR status
3. **Leverage filesystem search** to find similar code patterns in the repository
4. **Search the web** for R package documentation when implementing new features

## Troubleshooting

### MCP servers not starting

1. Ensure Node.js is installed and `npx` is available
2. Check that environment variables are set correctly
3. Verify repository paths are correct for your system

### GitHub authentication issues

1. Ensure `GITHUB_TOKEN` is set with appropriate scopes:
- `repo` (full control of private repositories)
- `workflow` (update GitHub Action workflows)
- `read:org` (read org and team membership)

2. Generate a new token at: https://github.com/settings/tokens

### Permission issues

1. Ensure the filesystem server has read/write access to the repository
2. Check that you have the necessary GitHub repository permissions

## References

- [MCP Specification](https://modelcontextprotocol.io/)
- [MCP Filesystem Server](https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem)
- [MCP GitHub Server](https://github.com/modelcontextprotocol/servers/tree/main/src/github)
- [MCP Git Server](https://github.com/modelcontextprotocol/servers/tree/main/src/git)
- [GitHub Copilot Documentation](https://docs.github.com/en/copilot)
Loading
Loading