Contributing to AT Protocol MCP Server
Thank you for your interest in contributing to the AT Protocol MCP Server! This document provides guidelines and information for contributors.
About This Project
The AT Protocol MCP Server is an MCP (Model Context Protocol) server that enables LLM clients to interact with the AT Protocol ecosystem. Contributions to this project help improve how LLMs access and use AT Protocol functionality.
What we're building:
- MCP tools that LLMs can call to interact with AT Protocol
- MCP resources that provide context data to LLMs
- MCP prompts that help LLMs perform common tasks
- Infrastructure for deploying and scaling the MCP server
What this is NOT:
- A direct-use API or SDK for application developers
- A JavaScript/TypeScript library for importing into apps
- An end-user application
If you're looking to build applications with AT Protocol, consider using the official @atproto/api package directly instead.
Getting Started
Prerequisites
- Node.js 20+
- pnpm (recommended) or npm
- Git
- Basic knowledge of TypeScript, AT Protocol, and MCP
Development Setup
- Fork the repository on GitHub
- Clone your fork locally:bash
git clone https://github.com/YOUR_USERNAME/atproto-mcp.git cd atproto-mcp - Install dependencies:bash
pnpm install # or: npm install - Start the development server:bash
pnpm dev # or: npm run dev
Cross-Platform Development
This project supports development on Windows, macOS, and Linux. All build commands are cross-platform compatible.
Using npm Scripts
All development tasks are available as npm scripts that work on any platform:
# Show all available commands
npm run help
# Common development tasks
npm run dev # Start development server
npm run build # Build for production
npm test # Run tests
npm run lint # Run linter
npm run format # Format code
npm run check # Run all quality checks
npm run clean # Clean build artifacts
npm run status # Show project statusCross-Platform Best Practices
When contributing code, please follow these guidelines to ensure cross-platform compatibility:
- Use npm scripts for all build tasks instead of shell commands
- Avoid Unix-specific commands like
rm,chmod,grep,awk,sed - Use Node.js APIs for file operations (fs, path modules)
- Use cross-platform packages:
rimraffor deleting files/directorieschalkfor colored terminal outputcommand-existsfor checking if commands are available
- Test on multiple platforms when possible (Windows, macOS, Linux)
- Use forward slashes in paths (Node.js normalizes them automatically)
- Avoid hardcoded paths - use
path.join()orpath.resolve() - Don't assume shell availability - use Node.js scripts instead of shell scripts
Example: Cross-Platform File Deletion
Don't do this (Unix-only):
{
"scripts": {
"clean": "rm -rf dist"
}
}Do this instead (cross-platform):
{
"scripts": {
"clean": "rimraf dist"
}
}Example: Cross-Platform Executable
Don't do this (Unix-only):
{
"scripts": {
"build": "tsc && chmod +x dist/cli.js"
}
}Do this instead (cross-platform):
{
"scripts": {
"build": "tsc && node scripts/make-executable.js"
}
}Where scripts/make-executable.js checks the platform and only runs chmod on Unix systems.
Development Workflow
Branch Strategy
main- Production-ready codedevelop- Integration branch for featuresfeature/feature-name- Individual featuresfix/bug-description- Bug fixesdocs/documentation-update- Documentation changes
Making Changes
Create a new branch from
develop:bashgit checkout develop git pull origin develop git checkout -b feature/your-feature-nameMake your changes following our coding standards
Write or update tests for your changes
Run the test suite:
bashpnpm test pnpm run lint pnpm run type-checkCommit your changes using conventional commits:
bashgit commit -m "feat: add new AT Protocol tool for user search"Push to your fork and create a pull request
Commit Message Format
We use Conventional Commits:
feat:- New featuresfix:- Bug fixesdocs:- Documentation changesstyle:- Code style changes (formatting, etc.)refactor:- Code refactoringtest:- Adding or updating testschore:- Maintenance tasks
Testing
Running Tests
# Run all tests
pnpm test
# Run tests in watch mode
pnpm test --watch
# Run tests with coverage
pnpm run test:coverage
# Run tests with UI
pnpm run test:uiWriting Tests
- Write unit tests for all new functions and classes
- Write integration tests for MCP tools and AT Protocol operations
- Mock external dependencies (AT Protocol API calls)
- Use descriptive test names that explain the scenario
- Follow the AAA pattern (Arrange, Act, Assert)
Example test structure:
describe('createPost tool', () => {
it('should create a post with text content successfully', async () => {
// Arrange
const mockAgent = createMockAtpAgent();
const tool = new CreatePostTool(mockAgent);
// Act
const result = await tool.execute({ text: 'Hello world!' });
// Assert
expect(result.success).toBe(true);
expect(result.data.uri).toBeDefined();
});
});Code Style
TypeScript Guidelines
- Use strict TypeScript configuration
- Provide explicit return types for public functions
- Use branded types for domain-specific identifiers
- Prefer
constassertions for immutable data - Use proper error handling with custom error classes
Code Organization
- Organize code by feature/domain
- Use barrel exports for clean module interfaces
- Keep functions pure and side-effect free where possible
- Implement proper separation of concerns
Naming Conventions
- Use PascalCase for interfaces (prefixed with
I) - Use PascalCase for types and enums
- Use camelCase for variables and functions
- Use UPPER_CASE for enum members
- Use descriptive names that explain purpose
Adding New Features
MCP Tools
When adding new MCP tools that LLMs can call:
- Create the tool in
src/tools/ - Define clear schemas - Use Zod for parameter validation
- Write descriptive metadata - LLMs use descriptions to understand what tools do
- Add error handling - Return clear error messages that LLMs can explain to users
- Write tests - Unit and integration tests for the tool
- Update documentation - Add examples showing how LLMs use the tool
- Add usage examples - Show natural language requests that would trigger the tool
Example: When adding a search_users tool, document it like:
- What it does: "Allows LLMs to search for AT Protocol users by name or handle"
- Example user request: "Find users named John on Bluesky"
- What the LLM does: Calls
search_users({ query: "John" })
AT Protocol Integration
When adding AT Protocol features to MCP tools:
- Use official SDK - Use the
@atproto/apipackage - Handle authentication - Support both authenticated and unauthenticated modes
- Respect rate limits - Implement backoff and return clear rate limit errors
- Error handling - Translate AT Protocol errors into LLM-friendly messages
- Validate responses - Ensure data matches expected schemas before returning to LLM
Documentation
Code Documentation
- Use JSDoc comments for all public APIs
- Include parameter descriptions and examples
- Document error conditions and return types
- Keep documentation up-to-date with code changes
User Documentation
- Update README.md for new features
- Add examples to the docs site
- Update API reference documentation
- Include troubleshooting information
Bug Reports
When reporting bugs:
- Use the bug report template
- Provide clear reproduction steps
- Include environment information
- Add relevant logs (remove sensitive data)
- Describe expected vs actual behavior
Feature Requests
When requesting features:
- Use the feature request template
- Explain the use case and problem
- Provide implementation ideas if possible
- Consider AT Protocol compatibility
- Indicate priority and impact
Code Review Process
For Contributors
- Ensure all tests pass
- Follow the coding standards
- Write clear commit messages
- Respond to review feedback promptly
- Keep pull requests focused and small
For Reviewers
- Review for correctness and style
- Test the changes locally
- Provide constructive feedback
- Approve when ready for merge
License
By contributing to this project, you agree that your contributions will be licensed under the MIT License.
Community
- Be respectful and inclusive
- Help others learn and grow
- Share knowledge and best practices
Getting Help
- Check existing issues and discussions
- Ask questions in GitHub Discussions
- Review the documentation
- Reach out to maintainers if needed
Thank you for contributing to the AT Protocol MCP Server!