Thank you for your interest in contributing! This document provides guidelines and instructions for contributing to this project.
- Code of Conduct
- Getting Started
- Development Setup
- How to Contribute
- Pull Request Process
- Coding Standards
- Adding New Tools
- Testing
- Documentation
This project follows the Contributor Covenant Code of Conduct. By participating, you agree to uphold this code.
- Node.js 18.0.0 or higher
- npm 9.0.0 or higher
- TypeScript 5.6 or higher
- Git for version control
- Access to a Dynatrace Managed environment for testing
# Fork the repository on GitHub, then clone your fork
git clone https://github.com/YOUR_USERNAME/Dynatrace-Managed-MCP.git
cd Dynatrace-Managed-MCP
# Add upstream remote
git remote add upstream https://github.com/theharithsa/Dynatrace-Managed-MCP.gitnpm installcp .env.example .envEdit .env with your Dynatrace Managed credentials:
DYNATRACE_MANAGED_URL=https://your-cluster.dynatrace.com
DYNATRACE_ENVIRONMENT_ID=your-env-id
DYNATRACE_API_TOKEN=your-api-token# Build the project
npm run build
# Run tests
npm test
# Run in development mode
npm run dev| Type | Description |
|---|---|
| π Bug Fixes | Fix issues and improve stability |
| β¨ New Features | Add new tools or capabilities |
| π Documentation | Improve docs, examples, and guides |
| π§ͺ Tests | Add or improve test coverage |
| π§ Refactoring | Improve code quality without changing behavior |
Before creating an issue:
- Search existing issues to avoid duplicates
- Use the issue templates when available
- Provide detailed reproduction steps
- Include environment information
- Open a GitHub Discussion first for major features
- Describe the use case and expected behavior
- Consider backward compatibility
# Sync with upstream
git fetch upstream
git checkout main
git merge upstream/main
# Create feature branch
git checkout -b feat/your-feature-name- Follow the coding standards
- Write tests for new functionality
- Update documentation as needed
We follow Conventional Commits:
# Format: type(scope): description
git commit -m "feat(problems): add problem correlation tool"
git commit -m "fix(metrics): resolve pagination issue"
git commit -m "docs(readme): update installation guide"Types:
| Type | Description |
|---|---|
feat |
New feature |
fix |
Bug fix |
docs |
Documentation only |
style |
Code style (formatting, etc.) |
refactor |
Code refactoring |
test |
Adding or updating tests |
chore |
Maintenance tasks |
git push origin feat/your-feature-nameThen create a Pull Request on GitHub with:
- Clear title following conventional commit format
- Description of changes
- Link to related issues
- Screenshots if applicable
// β
Good: Use explicit types
function getEntity(entityId: string): Promise<Entity> {
// ...
}
// β
Good: Use Zod for validation
const Schema = z.object({
entityId: z.string().describe('The entity ID'),
fields: z.string().optional().describe('Fields to include'),
});
// β
Good: Handle errors properly
const parsed = Schema.safeParse(args);
if (!parsed.success) {
throw new Error(`Invalid arguments: ${parsed.error.message}`);
}- Use kebab-case for files:
list-problems.ts - Use PascalCase for types/interfaces:
DynatraceEnv - Use camelCase for variables/functions:
getEntityById
// 1. Imports
import { z } from 'zod';
import axios from 'axios';
import { DynatraceEnv } from '../getDynatraceEnv.js';
// 2. Schema definition
const Schema = z.object({
// ...
});
// 3. Export tool object
export const toolName = {
definition: {
name: 'tool_name',
description: 'Tool description',
inputSchema: zodToJsonSchema(Schema),
},
handler: async (args: unknown, dtEnv: DynatraceEnv) => {
// Implementation
},
};Create src/capabilities/your-tool-name.ts:
import { z } from 'zod';
import { zodToJsonSchema } from 'zod-to-json-schema';
import axios from 'axios';
import { DynatraceEnv } from '../getDynatraceEnv.js';
const Schema = z.object({
param1: z.string().describe('Parameter description'),
param2: z.number().optional().describe('Optional parameter'),
});
export const yourToolName = {
definition: {
name: 'your_tool_name',
description: 'Clear description of what this tool does',
inputSchema: zodToJsonSchema(Schema),
},
handler: async (args: unknown, dtEnv: DynatraceEnv) => {
const parsed = Schema.safeParse(args);
if (!parsed.success) {
throw new Error(`Invalid arguments: ${parsed.error.message}`);
}
const { param1, param2 } = parsed.data;
const response = await axios.get(
`${dtEnv.url}/e/${dtEnv.environmentId}/api/v2/endpoint`,
{
headers: { Authorization: `Api-Token ${dtEnv.token}` },
params: { param1, param2 },
}
);
return {
content: [{
type: 'text',
text: JSON.stringify(response.data, null, 2),
}],
};
},
};Add the import and register the tool in src/index.ts.
Create test/your-tool-name.test.ts.
- Add to README.md tool list
- Create prompt guide in
dynatrace-agent-rules/
# Run all tests
npm test
# Run with coverage
npm run test:coverage
# Run specific test
npm test -- --grep "list_problems"
# Watch mode
npm run test:watchdescribe('list_problems', () => {
it('should list problems with default parameters', async () => {
const result = await listProblems.handler({}, mockDtEnv);
expect(result.content).toBeDefined();
expect(result.content[0].type).toBe('text');
});
it('should handle invalid parameters', async () => {
await expect(
listProblems.handler({ pageSize: -1 }, mockDtEnv)
).rejects.toThrow();
});
});- All public APIs and tools
- Configuration options
- Usage examples
- Error handling
- Use clear, concise language
- Include code examples
- Keep docs up-to-date with code changes
- Open a GitHub Discussion
- Check existing issues and discussions
- Review the README for common questions
Thank you for contributing! π