Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
103 changes: 0 additions & 103 deletions .github/workflows/ci.yml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/claude-code-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Claude Code Review

on:
pull_request:
types: [opened, synchronize]
# Optional: Only run on specific file changes
# paths:
# - "src/**/*.ts"
# - "src/**/*.tsx"
# - "src/**/*.js"
# - "src/**/*.jsx"

jobs:
claude-review:
# Optional: Filter by PR author
# if: |
# github.event.pull_request.user.login == 'external-contributor' ||
# github.event.pull_request.user.login == 'new-developer' ||
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'

runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: |
Please review this pull request and provide feedback on:
- Code quality and best practices
- Potential bugs or issues
- Performance considerations
- Security concerns
- Test coverage

Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.

Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.

# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://docs.anthropic.com/en/docs/claude-code/sdk#command-line for available options
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
53 changes: 53 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Publish to NPM

on:
push:
tags:
- 'v*.*.*'

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org/'

- name: Extract version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT

- name: Check if alpha release
id: check_prerelease
run: |
if [[ ${{ steps.get_version.outputs.VERSION }} == *"-alpha"* ]]; then
echo "IS_PRERELEASE=true" >> $GITHUB_OUTPUT
else
echo "IS_PRERELEASE=false" >> $GITHUB_OUTPUT
fi

- name: Update version in package.json
run: npm version ${{ steps.get_version.outputs.VERSION }} --no-git-tag-version

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Publish to NPM (Alpha)
if: steps.check_prerelease.outputs.IS_PRERELEASE == 'true'
run: npm publish --tag alpha --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish to NPM (Release)
if: steps.check_prerelease.outputs.IS_PRERELEASE == 'false'
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
10 changes: 10 additions & 0 deletions .github/workflows/pr-slack-notify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: PR Review Notifications

on:
pull_request:
types: [review_requested]

jobs:
call-slack-notifier:
uses: anyshift-io/custom_github_actions/.github/workflows/slack-pr-reviewer-notify.yml@main
secrets: inherit
38 changes: 0 additions & 38 deletions .github/workflows/publish.yml

This file was deleted.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,3 +310,5 @@ Contributions are welcome! Feel free to open an issue or a pull request if you h
## License

This project is licensed under the [Apache License, Version 2.0](./LICENSE).

blablabla
8 changes: 8 additions & 0 deletions inspector.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"mcpServers": {
"local": {
"command": "node",
"args": ["./build/index.js"]
}
}
}
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@winor30/mcp-server-datadog",
"version": "1.6.0",
"name": "@anyshift/datadog-mcp-server",
"version": "1.7.4",
"description": "MCP server for interacting with Datadog API",
"repository": {
"type": "git",
"url": "https://github.com/winor30/mcp-server-datadog.git"
"url": "https://github.com:anyshift-engineering/mcp-server-datadog.git"
},
"type": "module",
"bin": {
Expand Down Expand Up @@ -32,7 +32,8 @@
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"test:watch": "vitest",
"lint-staged": "lint-staged"
"lint-staged": "lint-staged",
"inspect-local": "pnpm build && npx @modelcontextprotocol/inspector --config ./inspector.config.json --server local"
},
"dependencies": {
"@datadog/datadog-api-client": "^1.34.1",
Expand Down
10 changes: 8 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,14 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
}
})

if (!process.env.DATADOG_API_KEY || !process.env.DATADOG_APP_KEY) {
throw new Error('DATADOG_API_KEY and DATADOG_APP_KEY must be set')
if (
!process.env.DATADOG_API_KEY ||
!process.env.DATADOG_APP_KEY ||
!process.env.DATADOG_EVAL_TIMESTAMP
) {
throw new Error(
'[MCP Eval Version] DATADOG_API_KEY and DATADOG_APP_KEY and DATADOG_EVAL_TIMESTAMP must be set',
)
}

const datadogConfig = createDatadogConfig({
Expand Down
35 changes: 31 additions & 4 deletions src/tools/logs/tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ExtendedTool, ToolHandlers } from '../../utils/types'
import { v2 } from '@datadog/datadog-api-client'
import { createToolSchema } from '../../utils/tool'
import { GetLogsZodSchema, GetAllServicesZodSchema } from './schema'
import { adjustTimestamps } from '../../utils/adjustTimestamps'

type LogsToolName = 'get_logs' | 'get_all_services'
type LogsTool = ExtendedTool<LogsToolName>
Expand Down Expand Up @@ -29,13 +30,26 @@ export const createLogsToolHandlers = (
request.params.arguments,
)

const adjusted = adjustTimestamps(from, to)

if (!adjusted.ok) {
return {
content: [
{
type: 'text',
text: `Logs data: ${[]}`,
},
],
}
}

const response = await apiInstance.listLogs({
body: {
filter: {
query,
// `from` and `to` are in epoch seconds, but the Datadog API expects milliseconds
from: `${from * 1000}`,
to: `${to * 1000}`,
from: `${adjusted.from * 1000}`,
to: `${adjusted.to * 1000}`,
},
page: {
limit,
Expand Down Expand Up @@ -63,13 +77,26 @@ export const createLogsToolHandlers = (
request.params.arguments,
)

const adjusted = adjustTimestamps(from, to)

if (!adjusted.ok) {
return {
content: [
{
type: 'text',
text: `Services: ${[]}`,
},
],
}
}

const response = await apiInstance.listLogs({
body: {
filter: {
query,
// `from` and `to` are in epoch seconds, but the Datadog API expects milliseconds
from: `${from * 1000}`,
to: `${to * 1000}`,
from: `${adjusted.from * 1000}`,
to: `${adjusted.to * 1000}`,
},
page: {
limit,
Expand Down
Loading