├── .env.example ├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── package.json ├── src ├── index.ts └── tools │ ├── aggregateLogs.ts │ ├── getDashboard.ts │ ├── getDashboards.ts │ ├── getEvents.ts │ ├── getIncidents.ts │ ├── getMetricMetadata.ts │ ├── getMetrics.ts │ ├── getMonitor.ts │ ├── getMonitors.ts │ └── searchLogs.ts └── tsconfig.json /.env.example: -------------------------------------------------------------------------------- 1 | DD_API_KEY=your_api_key_here 2 | DD_APP_KEY=your_app_key_here 3 | DD_SITE=us5.datadoghq.com -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | node_modules/ 3 | npm-debug.log* 4 | yarn-debug.log* 5 | yarn-error.log* 6 | package-lock.json 7 | yarn.lock 8 | 9 | # Build output 10 | dist/ 11 | build/ 12 | *.tsbuildinfo 13 | 14 | # Environment variables 15 | .env 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | # IDE and editor files 22 | .idea/ 23 | .vscode/ 24 | *.sublime-project 25 | *.sublime-workspace 26 | .project 27 | .classpath 28 | .c9/ 29 | *.launch 30 | .settings/ 31 | *.suo 32 | *.ntvs* 33 | *.njsproj 34 | *.sln 35 | *.sw? 36 | 37 | # OS files 38 | .DS_Store 39 | Thumbs.db 40 | ehthumbs.db 41 | Desktop.ini 42 | $RECYCLE.BIN/ 43 | 44 | # Debug logs 45 | logs/ 46 | *.log 47 | 48 | # Misc 49 | .tmp/ 50 | temp/ 51 | coverage/ -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # Source files 2 | src/ 3 | tsconfig.json 4 | 5 | # Development files 6 | .env 7 | .env.example 8 | node_modules/ 9 | .git/ 10 | .gitignore 11 | 12 | # IDE files 13 | .vscode/ 14 | .idea/ 15 | 16 | # Logs 17 | logs/ 18 | *.log 19 | npm-debug.log* 20 | 21 | # Test files 22 | test/ 23 | coverage/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 datadog-mcp-server 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Datadog MCP Server 2 | 3 | A Model Context Protocol (MCP) server for interacting with the Datadog API. 4 | 5 | 6 | Datadog MCP server 7 | 8 | 9 | ## Features 10 | 11 | - **Monitoring**: Access monitor data and configurations 12 | - **Dashboards**: Retrieve and view dashboard definitions 13 | - **Metrics**: Query available metrics and their metadata 14 | - **Events**: Search and retrieve events within timeframes 15 | - **Logs**: Search logs with advanced filtering and sorting options 16 | - **Incidents**: Access incident management data 17 | - **API Integration**: Direct integration with Datadog's v1 and v2 APIs 18 | - **Comprehensive Error Handling**: Clear error messages for API and authentication issues 19 | - **Service-Specific Endpoints**: Support for different endpoints for logs and metrics 20 | 21 | ## Prerequisites 22 | 23 | 1. Node.js (version 16 or higher) 24 | 2. Datadog account with: 25 | - API key - Found in Organization Settings > API Keys 26 | - Application key - Found in Organization Settings > Application Keys 27 | 28 | ## Installation 29 | 30 | ### Via npm (recommended) 31 | 32 | ```bash 33 | npm install -g datadog-mcp-server 34 | ``` 35 | 36 | ### From Source 37 | 38 | 1. Clone this repository 39 | 2. Install dependencies: 40 | ```bash 41 | npm install 42 | ``` 43 | 3. Build the project: 44 | ```bash 45 | npm run build 46 | ``` 47 | 48 | ## Configuration 49 | 50 | You can configure the Datadog MCP server using either environment variables or command-line arguments. 51 | 52 | ### Environment Variables 53 | 54 | Create a `.env` file with your Datadog credentials: 55 | 56 | ``` 57 | DD_API_KEY=your_api_key_here 58 | DD_APP_KEY=your_app_key_here 59 | DD_SITE=datadoghq.com 60 | DD_LOGS_SITE=datadoghq.com 61 | DD_METRICS_SITE=datadoghq.com 62 | ``` 63 | 64 | **Note**: `DD_LOGS_SITE` and `DD_METRICS_SITE` are optional and will default to the value of `DD_SITE` if not specified. 65 | 66 | ### Command-line Arguments 67 | 68 | Basic usage with global site setting: 69 | 70 | ```bash 71 | datadog-mcp-server --apiKey=your_api_key --appKey=your_app_key --site=datadoghq.eu 72 | ``` 73 | 74 | Advanced usage with service-specific endpoints: 75 | 76 | ```bash 77 | datadog-mcp-server --apiKey=your_api_key --appKey=your_app_key --site=datadoghq.com --logsSite=logs.datadoghq.com --metricsSite=metrics.datadoghq.com 78 | ``` 79 | 80 | Note: Site arguments don't need `https://` - it will be added automatically. 81 | 82 | ### Regional Endpoints 83 | 84 | Different Datadog regions have different endpoints: 85 | 86 | - US (Default): `datadoghq.com` 87 | - EU: `datadoghq.eu` 88 | - US3 (GovCloud): `ddog-gov.com` 89 | - US5: `us5.datadoghq.com` 90 | - AP1: `ap1.datadoghq.com` 91 | 92 | ### Usage with Claude Desktop 93 | 94 | Add this to your `claude_desktop_config.json`: 95 | 96 | ```json 97 | { 98 | "mcpServers": { 99 | "datadog": { 100 | "command": "npx", 101 | "args": [ 102 | "datadog-mcp-server", 103 | "--apiKey", 104 | "", 105 | "--appKey", 106 | "", 107 | "--site", 108 | "(e.g us5.datadoghq.com)" 109 | ] 110 | } 111 | } 112 | } 113 | ``` 114 | 115 | For more advanced configurations with separate endpoints for logs and metrics: 116 | 117 | ```json 118 | { 119 | "mcpServers": { 120 | "datadog": { 121 | "command": "npx", 122 | "args": [ 123 | "datadog-mcp-server", 124 | "--apiKey", 125 | "", 126 | "--appKey", 127 | "", 128 | "--site", 129 | "", 130 | "--logsSite", 131 | "", 132 | "--metricsSite", 133 | "" 134 | ] 135 | } 136 | } 137 | } 138 | ``` 139 | 140 | Locations for the Claude Desktop config file: 141 | 142 | - MacOS: `~/Library/Application Support/Claude/claude_desktop_config.json` 143 | - Windows: `%APPDATA%/Claude/claude_desktop_config.json` 144 | 145 | ## Usage with MCP Inspector 146 | 147 | To use with the MCP Inspector tool: 148 | 149 | ```bash 150 | npx @modelcontextprotocol/inspector datadog-mcp-server --apiKey=your_api_key --appKey=your_app_key 151 | ``` 152 | 153 | ## Available Tools 154 | 155 | The server provides these MCP tools: 156 | 157 | - **get-monitors**: Fetch monitors with optional filtering 158 | - **get-monitor**: Get details of a specific monitor by ID 159 | - **get-dashboards**: List all dashboards 160 | - **get-dashboard**: Get a specific dashboard by ID 161 | - **get-metrics**: List available metrics 162 | - **get-metric-metadata**: Get metadata for a specific metric 163 | - **get-events**: Fetch events within a time range 164 | - **get-incidents**: List incidents with optional filtering 165 | - **search-logs**: Search logs with advanced query filtering 166 | - **aggregate-logs**: Perform analytics and aggregations on log data 167 | 168 | ## Examples 169 | 170 | ### Example: Get Monitors 171 | 172 | ```javascript 173 | { 174 | "method": "tools/call", 175 | "params": { 176 | "name": "get-monitors", 177 | "arguments": { 178 | "groupStates": ["alert", "warn"], 179 | "limit": 5 180 | } 181 | } 182 | } 183 | ``` 184 | 185 | ### Example: Get a Dashboard 186 | 187 | ```javascript 188 | { 189 | "method": "tools/call", 190 | "params": { 191 | "name": "get-dashboard", 192 | "arguments": { 193 | "dashboardId": "abc-def-123" 194 | } 195 | } 196 | } 197 | ``` 198 | 199 | ### Example: Search Logs 200 | 201 | ```javascript 202 | { 203 | "method": "tools/call", 204 | "params": { 205 | "name": "search-logs", 206 | "arguments": { 207 | "filter": { 208 | "query": "service:web-app status:error", 209 | "from": "now-15m", 210 | "to": "now" 211 | }, 212 | "sort": "-timestamp", 213 | "limit": 20 214 | } 215 | } 216 | } 217 | ``` 218 | 219 | ### Example: Aggregate Logs 220 | 221 | ```javascript 222 | { 223 | "method": "tools/call", 224 | "params": { 225 | "name": "aggregate-logs", 226 | "arguments": { 227 | "filter": { 228 | "query": "service:web-app", 229 | "from": "now-1h", 230 | "to": "now" 231 | }, 232 | "compute": [ 233 | { 234 | "aggregation": "count" 235 | } 236 | ], 237 | "groupBy": [ 238 | { 239 | "facet": "status", 240 | "limit": 10, 241 | "sort": { 242 | "aggregation": "count", 243 | "order": "desc" 244 | } 245 | } 246 | ] 247 | } 248 | } 249 | } 250 | ``` 251 | 252 | ### Example: Get Incidents 253 | 254 | ```javascript 255 | { 256 | "method": "tools/call", 257 | "params": { 258 | "name": "get-incidents", 259 | "arguments": { 260 | "includeArchived": false, 261 | "query": "state:active", 262 | "pageSize": 10 263 | } 264 | } 265 | } 266 | ``` 267 | 268 | ## Troubleshooting 269 | 270 | If you encounter a 403 Forbidden error, verify that: 271 | 272 | 1. Your API key and Application key are correct 273 | 2. The keys have the necessary permissions to access the requested resources 274 | 3. Your account has access to the requested data 275 | 4. You're using the correct endpoint for your region (e.g., `datadoghq.eu` for EU customers) 276 | 277 | ## Debugging 278 | 279 | If you encounter issues, check Claude Desktop's MCP logs: 280 | 281 | ```bash 282 | # On macOS 283 | tail -n 20 -f ~/Library/Logs/Claude/mcp*.log 284 | 285 | # On Windows 286 | Get-Content -Path "$env:APPDATA\Claude\Logs\mcp*.log" -Tail 20 -Wait 287 | ``` 288 | 289 | Common issues: 290 | 291 | - 403 Forbidden: Authentication issue with Datadog API keys 292 | - API key or App key format invalid: Ensure you're using the full key strings 293 | - Site configuration errors: Make sure you're using the correct Datadog domain 294 | - Endpoint mismatches: Verify that service-specific endpoints are correctly set if you're using separate domains for logs and metrics 295 | 296 | ## License 297 | 298 | MIT 299 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "datadog-mcp-server", 3 | "version": "1.0.8", 4 | "description": "MCP Server for Datadog API", 5 | "main": "dist/index.js", 6 | "type": "commonjs", 7 | "bin": { 8 | "datadog-mcp-server": "./dist/index.js" 9 | }, 10 | "scripts": { 11 | "build": "tsc", 12 | "start": "node dist/index.js", 13 | "dev": "tsc && node dist/index.js", 14 | "test": "echo \"Error: no test specified\" && exit 1", 15 | "prepublishOnly": "npm run build", 16 | "publish:dry-run": "npm pack --dry-run" 17 | }, 18 | "keywords": [ 19 | "datadog", 20 | "mcp", 21 | "model-context-protocol", 22 | "observability", 23 | "api" 24 | ], 25 | "author": "GeLi2001", 26 | "license": "MIT", 27 | "dependencies": { 28 | "@datadog/datadog-api-client": "^1.33.1", 29 | "@modelcontextprotocol/sdk": "^1.8.0", 30 | "dotenv": "^16.4.7", 31 | "minimist": "^1.2.8", 32 | "typescript": "^5.8.2", 33 | "zod": "^3.24.2" 34 | }, 35 | "devDependencies": { 36 | "@types/minimist": "^1.2.5" 37 | }, 38 | "files": [ 39 | "dist", 40 | "README.md", 41 | "LICENSE" 42 | ], 43 | "repository": { 44 | "type": "git", 45 | "url": "git+https://github.com/GeLi2001/datadog-mcp-server.git" 46 | }, 47 | "bugs": { 48 | "url": "https://github.com/GeLi2001/datadog-mcp-server/issues" 49 | }, 50 | "homepage": "https://github.com/GeLi2001/datadog-mcp-server#readme" 51 | } 52 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; 4 | import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; 5 | import dotenv from "dotenv"; 6 | import minimist from "minimist"; 7 | import { z } from "zod"; 8 | 9 | // Import tools 10 | import { aggregateLogs } from "./tools/aggregateLogs.js"; 11 | import { getDashboard } from "./tools/getDashboard.js"; 12 | import { getDashboards } from "./tools/getDashboards.js"; 13 | import { getEvents } from "./tools/getEvents.js"; 14 | import { getIncidents } from "./tools/getIncidents.js"; 15 | import { getMetricMetadata } from "./tools/getMetricMetadata.js"; 16 | import { getMetrics } from "./tools/getMetrics.js"; 17 | import { getMonitor } from "./tools/getMonitor.js"; 18 | import { getMonitors } from "./tools/getMonitors.js"; 19 | import { searchLogs } from "./tools/searchLogs.js"; 20 | 21 | // Parse command line arguments 22 | const argv = minimist(process.argv.slice(2)); 23 | 24 | // Load environment variables from .env file (if it exists) 25 | dotenv.config(); 26 | 27 | // Define environment variables - from command line or .env file 28 | const DD_API_KEY = argv.apiKey || process.env.DD_API_KEY; 29 | const DD_APP_KEY = argv.appKey || process.env.DD_APP_KEY; 30 | 31 | // Get site configuration - defines the base domain for Datadog APIs 32 | const DD_SITE = argv.site || process.env.DD_SITE || "datadoghq.com"; 33 | 34 | // Define service-specific endpoints for different Datadog services 35 | // This follows Datadog's recommended approach for configuring regional endpoints 36 | const DD_LOGS_SITE = argv.logsSite || process.env.DD_LOGS_SITE || DD_SITE; 37 | const DD_METRICS_SITE = 38 | argv.metricsSite || process.env.DD_METRICS_SITE || DD_SITE; 39 | 40 | // Remove https:// prefix if it exists to prevent double prefix issues 41 | const cleanupUrl = (url: string) => 42 | url.startsWith("https://") ? url.substring(8) : url; 43 | 44 | // Store clean values in process.env for backwards compatibility 45 | process.env.DD_API_KEY = DD_API_KEY; 46 | process.env.DD_APP_KEY = DD_APP_KEY; 47 | process.env.DD_SITE = cleanupUrl(DD_SITE); 48 | process.env.DD_LOGS_SITE = cleanupUrl(DD_LOGS_SITE); 49 | process.env.DD_METRICS_SITE = cleanupUrl(DD_METRICS_SITE); 50 | 51 | // Validate required environment variables 52 | if (!DD_API_KEY) { 53 | console.error("Error: DD_API_KEY is required."); 54 | console.error("Please provide it via command line argument or .env file."); 55 | console.error(" Command line: --apiKey=your_api_key"); 56 | process.exit(1); 57 | } 58 | 59 | if (!DD_APP_KEY) { 60 | console.error("Error: DD_APP_KEY is required."); 61 | console.error("Please provide it via command line argument or .env file."); 62 | console.error(" Command line: --appKey=your_app_key"); 63 | process.exit(1); 64 | } 65 | 66 | // Initialize Datadog client tools 67 | // We initialize each tool which will use the appropriate site configuration 68 | getMonitors.initialize(); 69 | getMonitor.initialize(); 70 | getDashboards.initialize(); 71 | getDashboard.initialize(); 72 | getMetrics.initialize(); 73 | getMetricMetadata.initialize(); 74 | getEvents.initialize(); 75 | getIncidents.initialize(); 76 | searchLogs.initialize(); 77 | aggregateLogs.initialize(); 78 | 79 | // Set up MCP server 80 | const server = new McpServer({ 81 | name: "datadog", 82 | version: "1.0.0", 83 | description: 84 | "MCP Server for Datadog API, enabling interaction with Datadog resources" 85 | }); 86 | 87 | // Add tools individually, using their schemas directly 88 | server.tool( 89 | "get-monitors", 90 | "Fetch monitors from Datadog with optional filtering. Use groupStates to filter by monitor status (e.g., 'alert', 'warn', 'no data'), tags or monitorTags to filter by tag criteria, and limit to control result size.", 91 | { 92 | groupStates: z.array(z.string()).optional(), 93 | tags: z.string().optional(), 94 | monitorTags: z.string().optional(), 95 | limit: z.number().default(100) 96 | }, 97 | async (args) => { 98 | const result = await getMonitors.execute(args); 99 | return { 100 | content: [{ type: "text", text: JSON.stringify(result) }] 101 | }; 102 | } 103 | ); 104 | 105 | server.tool( 106 | "get-monitor", 107 | "Get detailed information about a specific Datadog monitor by its ID. Use this to retrieve the complete configuration, status, and other details of a single monitor.", 108 | { 109 | monitorId: z.number() 110 | }, 111 | async (args) => { 112 | const result = await getMonitor.execute(args); 113 | return { 114 | content: [{ type: "text", text: JSON.stringify(result) }] 115 | }; 116 | } 117 | ); 118 | 119 | server.tool( 120 | "get-dashboards", 121 | "Retrieve a list of all dashboards from Datadog. Useful for discovering available dashboards and their IDs for further exploration.", 122 | { 123 | filterConfigured: z.boolean().optional(), 124 | limit: z.number().default(100) 125 | }, 126 | async (args) => { 127 | const result = await getDashboards.execute(args); 128 | return { 129 | content: [{ type: "text", text: JSON.stringify(result) }] 130 | }; 131 | } 132 | ); 133 | 134 | server.tool( 135 | "get-dashboard", 136 | "Get the complete definition of a specific Datadog dashboard by its ID. Returns all widgets, layout, and configuration details.", 137 | { 138 | dashboardId: z.string() 139 | }, 140 | async (args) => { 141 | const result = await getDashboard.execute(args); 142 | return { 143 | content: [{ type: "text", text: JSON.stringify(result) }] 144 | }; 145 | } 146 | ); 147 | 148 | server.tool( 149 | "get-metrics", 150 | "List available metrics from Datadog. Optionally use the q parameter to search for specific metrics matching a pattern. Helpful for discovering metrics to use in monitors or dashboards.", 151 | { 152 | q: z.string().optional() 153 | }, 154 | async (args) => { 155 | const result = await getMetrics.execute(args); 156 | return { 157 | content: [{ type: "text", text: JSON.stringify(result) }] 158 | }; 159 | } 160 | ); 161 | 162 | server.tool( 163 | "get-metric-metadata", 164 | "Retrieve detailed metadata about a specific metric, including its type, description, unit, and other attributes. Use this to understand a metric's meaning and proper usage.", 165 | { 166 | metricName: z.string() 167 | }, 168 | async (args) => { 169 | const result = await getMetricMetadata.execute(args); 170 | return { 171 | content: [{ type: "text", text: JSON.stringify(result) }] 172 | }; 173 | } 174 | ); 175 | 176 | server.tool( 177 | "get-events", 178 | "Search for events in Datadog within a specified time range. Events include deployments, alerts, comments, and other activities. Useful for correlating system behaviors with specific events.", 179 | { 180 | start: z.number(), 181 | end: z.number(), 182 | priority: z.enum(["normal", "low"]).optional(), 183 | sources: z.string().optional(), 184 | tags: z.string().optional(), 185 | unaggregated: z.boolean().optional(), 186 | excludeAggregation: z.boolean().optional(), 187 | limit: z.number().default(100) 188 | }, 189 | async (args) => { 190 | const result = await getEvents.execute(args); 191 | return { 192 | content: [{ type: "text", text: JSON.stringify(result) }] 193 | }; 194 | } 195 | ); 196 | 197 | server.tool( 198 | "get-incidents", 199 | "List incidents from Datadog's incident management system. Can filter by active/archived status and use query strings to find specific incidents. Helpful for reviewing current or past incidents.", 200 | { 201 | includeArchived: z.boolean().optional(), 202 | pageSize: z.number().optional(), 203 | pageOffset: z.number().optional(), 204 | query: z.string().optional(), 205 | limit: z.number().default(100) 206 | }, 207 | async (args) => { 208 | const result = await getIncidents.execute(args); 209 | return { 210 | content: [{ type: "text", text: JSON.stringify(result) }] 211 | }; 212 | } 213 | ); 214 | 215 | server.tool( 216 | "search-logs", 217 | "Search logs in Datadog with advanced filtering options. Use filter.query for search terms (e.g., 'service:web-app status:error'), from/to for time ranges (e.g., 'now-15m', 'now'), and sort to order results. Essential for investigating application issues.", 218 | { 219 | filter: z 220 | .object({ 221 | query: z.string().optional(), 222 | from: z.string().optional(), 223 | to: z.string().optional(), 224 | indexes: z.array(z.string()).optional() 225 | }) 226 | .optional(), 227 | sort: z.string().optional(), 228 | page: z 229 | .object({ 230 | limit: z.number().optional(), 231 | cursor: z.string().optional() 232 | }) 233 | .optional(), 234 | limit: z.number().default(100) 235 | }, 236 | async (args) => { 237 | const result = await searchLogs.execute(args); 238 | return { 239 | content: [{ type: "text", text: JSON.stringify(result) }] 240 | }; 241 | } 242 | ); 243 | 244 | server.tool( 245 | "aggregate-logs", 246 | "Perform analytical queries and aggregations on log data. Essential for calculating metrics (count, avg, sum, etc.), grouping data by fields, and creating statistical summaries from logs. Use this when you need to analyze patterns or extract metrics from log data.", 247 | { 248 | filter: z 249 | .object({ 250 | query: z.string().optional(), 251 | from: z.string().optional(), 252 | to: z.string().optional(), 253 | indexes: z.array(z.string()).optional() 254 | }) 255 | .optional(), 256 | compute: z 257 | .array( 258 | z.object({ 259 | aggregation: z.string(), 260 | metric: z.string().optional(), 261 | type: z.string().optional() 262 | }) 263 | ) 264 | .optional(), 265 | groupBy: z 266 | .array( 267 | z.object({ 268 | facet: z.string(), 269 | limit: z.number().optional(), 270 | sort: z 271 | .object({ 272 | aggregation: z.string(), 273 | order: z.string() 274 | }) 275 | .optional() 276 | }) 277 | ) 278 | .optional(), 279 | options: z 280 | .object({ 281 | timezone: z.string().optional() 282 | }) 283 | .optional() 284 | }, 285 | async (args) => { 286 | const result = await aggregateLogs.execute(args); 287 | return { 288 | content: [{ type: "text", text: JSON.stringify(result) }] 289 | }; 290 | } 291 | ); 292 | 293 | // Start the server 294 | const transport = new StdioServerTransport(); 295 | server 296 | .connect(transport) 297 | .then(() => {}) 298 | .catch((error: unknown) => { 299 | console.error("Failed to start Datadog MCP Server:", error); 300 | }); 301 | -------------------------------------------------------------------------------- /src/tools/aggregateLogs.ts: -------------------------------------------------------------------------------- 1 | import { client } from "@datadog/datadog-api-client"; 2 | 3 | type AggregateLogsParams = { 4 | filter?: { 5 | query?: string; 6 | from?: string; 7 | to?: string; 8 | indexes?: string[]; 9 | }; 10 | compute?: Array<{ 11 | aggregation: string; 12 | metric?: string; 13 | type?: string; 14 | }>; 15 | groupBy?: Array<{ 16 | facet: string; 17 | limit?: number; 18 | sort?: { 19 | aggregation: string; 20 | order: string; 21 | }; 22 | }>; 23 | options?: { 24 | timezone?: string; 25 | }; 26 | }; 27 | 28 | let configuration: client.Configuration; 29 | 30 | export const aggregateLogs = { 31 | initialize: () => { 32 | const configOpts = { 33 | authMethods: { 34 | apiKeyAuth: process.env.DD_API_KEY, 35 | appKeyAuth: process.env.DD_APP_KEY 36 | } 37 | }; 38 | 39 | configuration = client.createConfiguration(configOpts); 40 | 41 | if (process.env.DD_LOGS_SITE) { 42 | configuration.setServerVariables({ 43 | site: process.env.DD_LOGS_SITE 44 | }); 45 | } 46 | 47 | // Enable any unstable operations 48 | configuration.unstableOperations["v2.aggregateLogs"] = true; 49 | }, 50 | 51 | execute: async (params: AggregateLogsParams) => { 52 | try { 53 | const { filter, compute, groupBy, options } = params; 54 | 55 | // Directly call with fetch to use the documented aggregation endpoint 56 | const apiUrl = `https://${ 57 | process.env.DD_LOGS_SITE || "datadoghq.com" 58 | }/api/v2/logs/analytics/aggregate`; 59 | 60 | const headers = { 61 | "Content-Type": "application/json", 62 | "DD-API-KEY": process.env.DD_API_KEY || "", 63 | "DD-APPLICATION-KEY": process.env.DD_APP_KEY || "" 64 | }; 65 | 66 | const body = { 67 | filter: filter, 68 | compute: compute, 69 | group_by: groupBy, 70 | options: options 71 | }; 72 | 73 | const response = await fetch(apiUrl, { 74 | method: "POST", 75 | headers: headers, 76 | body: JSON.stringify(body) 77 | }); 78 | 79 | if (!response.ok) { 80 | throw { 81 | status: response.status, 82 | message: await response.text() 83 | }; 84 | } 85 | 86 | const data = await response.json(); 87 | return data; 88 | } catch (error: any) { 89 | if (error.status === 403) { 90 | console.error( 91 | "Authorization failed (403 Forbidden): Check that your API key and Application key are valid and have sufficient permissions to access log analytics." 92 | ); 93 | throw new Error( 94 | "Datadog API authorization failed. Please verify your API and Application keys have the correct permissions." 95 | ); 96 | } else { 97 | console.error("Error aggregating logs:", error); 98 | throw error; 99 | } 100 | } 101 | } 102 | }; 103 | -------------------------------------------------------------------------------- /src/tools/getDashboard.ts: -------------------------------------------------------------------------------- 1 | import { client, v1 } from "@datadog/datadog-api-client"; 2 | 3 | type GetDashboardParams = { 4 | dashboardId: string; 5 | }; 6 | 7 | let configuration: client.Configuration; 8 | 9 | export const getDashboard = { 10 | initialize: () => { 11 | const configOpts = { 12 | authMethods: { 13 | apiKeyAuth: process.env.DD_API_KEY, 14 | appKeyAuth: process.env.DD_APP_KEY 15 | } 16 | }; 17 | 18 | configuration = client.createConfiguration(configOpts); 19 | 20 | if (process.env.DD_SITE) { 21 | configuration.setServerVariables({ 22 | site: process.env.DD_SITE 23 | }); 24 | } 25 | }, 26 | 27 | execute: async (params: GetDashboardParams) => { 28 | try { 29 | const { dashboardId } = params; 30 | 31 | const apiInstance = new v1.DashboardsApi(configuration); 32 | 33 | const apiParams: v1.DashboardsApiGetDashboardRequest = { 34 | dashboardId: dashboardId 35 | }; 36 | 37 | const response = await apiInstance.getDashboard(apiParams); 38 | return response; 39 | } catch (error) { 40 | console.error(`Error fetching dashboard ${params.dashboardId}:`, error); 41 | throw error; 42 | } 43 | } 44 | }; 45 | -------------------------------------------------------------------------------- /src/tools/getDashboards.ts: -------------------------------------------------------------------------------- 1 | import { client, v1 } from "@datadog/datadog-api-client"; 2 | 3 | type GetDashboardsParams = { 4 | filterConfigured?: boolean; 5 | limit?: number; 6 | }; 7 | 8 | let configuration: client.Configuration; 9 | 10 | export const getDashboards = { 11 | initialize: () => { 12 | const configOpts = { 13 | authMethods: { 14 | apiKeyAuth: process.env.DD_API_KEY, 15 | appKeyAuth: process.env.DD_APP_KEY 16 | } 17 | }; 18 | 19 | configuration = client.createConfiguration(configOpts); 20 | 21 | if (process.env.DD_SITE) { 22 | configuration.setServerVariables({ 23 | site: process.env.DD_SITE 24 | }); 25 | } 26 | }, 27 | 28 | execute: async (params: GetDashboardsParams) => { 29 | try { 30 | const { filterConfigured, limit } = params; 31 | 32 | const apiInstance = new v1.DashboardsApi(configuration); 33 | 34 | // No parameters needed for listDashboards 35 | const response = await apiInstance.listDashboards(); 36 | 37 | // Apply client-side filtering if specified 38 | let filteredDashboards = response.dashboards || []; 39 | 40 | // Apply client-side limit if specified 41 | if (limit && filteredDashboards.length > limit) { 42 | filteredDashboards = filteredDashboards.slice(0, limit); 43 | } 44 | 45 | return { 46 | ...response, 47 | dashboards: filteredDashboards 48 | }; 49 | } catch (error) { 50 | console.error("Error fetching dashboards:", error); 51 | throw error; 52 | } 53 | } 54 | }; 55 | -------------------------------------------------------------------------------- /src/tools/getEvents.ts: -------------------------------------------------------------------------------- 1 | import { client, v1 } from "@datadog/datadog-api-client"; 2 | 3 | type GetEventsParams = { 4 | start: number; 5 | end: number; 6 | priority?: "normal" | "low"; 7 | sources?: string; 8 | tags?: string; 9 | unaggregated?: boolean; 10 | excludeAggregation?: boolean; 11 | limit?: number; 12 | }; 13 | 14 | let configuration: client.Configuration; 15 | 16 | export const getEvents = { 17 | initialize: () => { 18 | const configOpts = { 19 | authMethods: { 20 | apiKeyAuth: process.env.DD_API_KEY, 21 | appKeyAuth: process.env.DD_APP_KEY 22 | } 23 | }; 24 | 25 | configuration = client.createConfiguration(configOpts); 26 | 27 | if (process.env.DD_SITE) { 28 | configuration.setServerVariables({ 29 | site: process.env.DD_SITE 30 | }); 31 | } 32 | }, 33 | 34 | execute: async (params: GetEventsParams) => { 35 | try { 36 | const { 37 | start, 38 | end, 39 | priority, 40 | sources, 41 | tags, 42 | unaggregated, 43 | excludeAggregation, 44 | limit 45 | } = params; 46 | 47 | const apiInstance = new v1.EventsApi(configuration); 48 | 49 | const apiParams: v1.EventsApiListEventsRequest = { 50 | start: start, 51 | end: end, 52 | priority: priority, 53 | sources: sources, 54 | tags: tags, 55 | unaggregated: unaggregated, 56 | excludeAggregate: excludeAggregation 57 | }; 58 | 59 | const response = await apiInstance.listEvents(apiParams); 60 | 61 | // Apply client-side limit if specified 62 | if (limit && response.events && response.events.length > limit) { 63 | response.events = response.events.slice(0, limit); 64 | } 65 | 66 | return response; 67 | } catch (error) { 68 | console.error("Error fetching events:", error); 69 | throw error; 70 | } 71 | } 72 | }; 73 | -------------------------------------------------------------------------------- /src/tools/getIncidents.ts: -------------------------------------------------------------------------------- 1 | import { client, v2 } from "@datadog/datadog-api-client"; 2 | 3 | type GetIncidentsParams = { 4 | includeArchived?: boolean; 5 | pageSize?: number; 6 | pageOffset?: number; 7 | query?: string; 8 | limit?: number; 9 | }; 10 | 11 | let configuration: client.Configuration; 12 | 13 | export const getIncidents = { 14 | initialize: () => { 15 | const configOpts = { 16 | authMethods: { 17 | apiKeyAuth: process.env.DD_API_KEY, 18 | appKeyAuth: process.env.DD_APP_KEY 19 | } 20 | }; 21 | 22 | configuration = client.createConfiguration(configOpts); 23 | 24 | if (process.env.DD_SITE) { 25 | configuration.setServerVariables({ 26 | site: process.env.DD_SITE 27 | }); 28 | } 29 | 30 | // Enable the unstable operation 31 | configuration.unstableOperations["v2.listIncidents"] = true; 32 | }, 33 | 34 | execute: async (params: GetIncidentsParams) => { 35 | try { 36 | const { includeArchived, pageSize, pageOffset, query, limit } = params; 37 | 38 | const apiInstance = new v2.IncidentsApi(configuration); 39 | 40 | const apiParams: any = {}; 41 | 42 | if (includeArchived !== undefined) { 43 | apiParams.include_archived = includeArchived; 44 | } 45 | 46 | if (pageSize !== undefined) { 47 | apiParams.page_size = pageSize; 48 | } 49 | 50 | if (pageOffset !== undefined) { 51 | apiParams.page_offset = pageOffset; 52 | } 53 | 54 | if (query !== undefined) { 55 | apiParams.query = query; 56 | } 57 | 58 | const response = await apiInstance.listIncidents(apiParams); 59 | 60 | // Apply client-side limit if specified 61 | if (limit && response.data && response.data.length > limit) { 62 | response.data = response.data.slice(0, limit); 63 | } 64 | 65 | return response; 66 | } catch (error: any) { 67 | if (error.status === 403) { 68 | console.error( 69 | "Authorization failed (403 Forbidden): Check that your API key and Application key are valid and have sufficient permissions to access incidents." 70 | ); 71 | throw new Error( 72 | "Datadog API authorization failed. Please verify your API and Application keys have the correct permissions." 73 | ); 74 | } else { 75 | console.error("Error fetching incidents:", error); 76 | throw error; 77 | } 78 | } 79 | } 80 | }; 81 | -------------------------------------------------------------------------------- /src/tools/getMetricMetadata.ts: -------------------------------------------------------------------------------- 1 | import { client, v1 } from "@datadog/datadog-api-client"; 2 | 3 | type GetMetricMetadataParams = { 4 | metricName: string; 5 | }; 6 | 7 | let configuration: client.Configuration; 8 | 9 | export const getMetricMetadata = { 10 | initialize: () => { 11 | const configOpts = { 12 | authMethods: { 13 | apiKeyAuth: process.env.DD_API_KEY, 14 | appKeyAuth: process.env.DD_APP_KEY 15 | } 16 | }; 17 | 18 | configuration = client.createConfiguration(configOpts); 19 | 20 | if (process.env.DD_METRICS_SITE) { 21 | configuration.setServerVariables({ 22 | site: process.env.DD_METRICS_SITE 23 | }); 24 | } 25 | }, 26 | 27 | execute: async (params: GetMetricMetadataParams) => { 28 | try { 29 | const { metricName } = params; 30 | 31 | const apiInstance = new v1.MetricsApi(configuration); 32 | 33 | const apiParams: v1.MetricsApiGetMetricMetadataRequest = { 34 | metricName: metricName 35 | }; 36 | 37 | const response = await apiInstance.getMetricMetadata(apiParams); 38 | return response; 39 | } catch (error) { 40 | console.error( 41 | `Error fetching metadata for metric ${params.metricName}:`, 42 | error 43 | ); 44 | throw error; 45 | } 46 | } 47 | }; 48 | -------------------------------------------------------------------------------- /src/tools/getMetrics.ts: -------------------------------------------------------------------------------- 1 | import { client, v1 } from "@datadog/datadog-api-client"; 2 | 3 | type GetMetricsParams = { 4 | q?: string; 5 | }; 6 | 7 | let configuration: client.Configuration; 8 | 9 | export const getMetrics = { 10 | initialize: () => { 11 | const configOpts = { 12 | authMethods: { 13 | apiKeyAuth: process.env.DD_API_KEY, 14 | appKeyAuth: process.env.DD_APP_KEY 15 | } 16 | }; 17 | 18 | configuration = client.createConfiguration(configOpts); 19 | 20 | if (process.env.DD_METRICS_SITE) { 21 | configuration.setServerVariables({ 22 | site: process.env.DD_METRICS_SITE 23 | }); 24 | } 25 | }, 26 | 27 | execute: async (params: GetMetricsParams) => { 28 | try { 29 | const { q } = params; 30 | 31 | const apiInstance = new v1.MetricsApi(configuration); 32 | 33 | const queryStr = q || "*"; 34 | 35 | const apiParams: v1.MetricsApiListMetricsRequest = { 36 | q: queryStr 37 | }; 38 | 39 | const response = await apiInstance.listMetrics(apiParams); 40 | return response; 41 | } catch (error) { 42 | console.error("Error fetching metrics:", error); 43 | throw error; 44 | } 45 | } 46 | }; 47 | -------------------------------------------------------------------------------- /src/tools/getMonitor.ts: -------------------------------------------------------------------------------- 1 | import { client, v1 } from "@datadog/datadog-api-client"; 2 | 3 | type GetMonitorParams = { 4 | monitorId: number; 5 | }; 6 | 7 | let configuration: client.Configuration; 8 | 9 | export const getMonitor = { 10 | initialize: () => { 11 | const configOpts = { 12 | authMethods: { 13 | apiKeyAuth: process.env.DD_API_KEY, 14 | appKeyAuth: process.env.DD_APP_KEY 15 | } 16 | }; 17 | 18 | configuration = client.createConfiguration(configOpts); 19 | 20 | if (process.env.DD_METRICS_SITE) { 21 | configuration.setServerVariables({ 22 | site: process.env.DD_METRICS_SITE 23 | }); 24 | } 25 | }, 26 | 27 | execute: async (params: GetMonitorParams) => { 28 | try { 29 | const { monitorId } = params; 30 | 31 | const apiInstance = new v1.MonitorsApi(configuration); 32 | 33 | const apiParams: v1.MonitorsApiGetMonitorRequest = { 34 | monitorId: monitorId 35 | }; 36 | 37 | const response = await apiInstance.getMonitor(apiParams); 38 | return response; 39 | } catch (error) { 40 | console.error(`Error fetching monitor ${params.monitorId}:`, error); 41 | throw error; 42 | } 43 | } 44 | }; 45 | -------------------------------------------------------------------------------- /src/tools/getMonitors.ts: -------------------------------------------------------------------------------- 1 | import { client, v1 } from "@datadog/datadog-api-client"; 2 | 3 | type GetMonitorsParams = { 4 | groupStates?: string[]; 5 | tags?: string; 6 | monitorTags?: string; 7 | limit?: number; 8 | }; 9 | 10 | let configuration: client.Configuration; 11 | 12 | export const getMonitors = { 13 | initialize: () => { 14 | const configOpts = { 15 | authMethods: { 16 | apiKeyAuth: process.env.DD_API_KEY, 17 | appKeyAuth: process.env.DD_APP_KEY 18 | } 19 | }; 20 | 21 | configuration = client.createConfiguration(configOpts); 22 | 23 | if (process.env.DD_METRICS_SITE) { 24 | configuration.setServerVariables({ 25 | site: process.env.DD_METRICS_SITE 26 | }); 27 | } 28 | }, 29 | 30 | execute: async (params: GetMonitorsParams) => { 31 | try { 32 | const { groupStates, tags, monitorTags, limit } = params; 33 | 34 | const apiInstance = new v1.MonitorsApi(configuration); 35 | 36 | const groupStatesStr = groupStates ? groupStates.join(",") : undefined; 37 | 38 | const apiParams: v1.MonitorsApiListMonitorsRequest = { 39 | groupStates: groupStatesStr, 40 | tags: tags, 41 | monitorTags: monitorTags 42 | }; 43 | 44 | const response = await apiInstance.listMonitors(apiParams); 45 | 46 | if (limit && response.length > limit) { 47 | return response.slice(0, limit); 48 | } 49 | 50 | return response; 51 | } catch (error: any) { 52 | if (error.status === 403) { 53 | console.error( 54 | "Authorization failed (403 Forbidden): Check that your API key and Application key are valid and have sufficient permissions to access monitors." 55 | ); 56 | throw new Error( 57 | "Datadog API authorization failed. Please verify your API and Application keys have the correct permissions." 58 | ); 59 | } else { 60 | console.error("Error fetching monitors:", error); 61 | throw error; 62 | } 63 | } 64 | } 65 | }; 66 | -------------------------------------------------------------------------------- /src/tools/searchLogs.ts: -------------------------------------------------------------------------------- 1 | import { client, v2 } from "@datadog/datadog-api-client"; 2 | 3 | type SearchLogsParams = { 4 | filter?: { 5 | query?: string; 6 | from?: string; 7 | to?: string; 8 | indexes?: string[]; 9 | }; 10 | sort?: string; 11 | page?: { 12 | limit?: number; 13 | cursor?: string; 14 | }; 15 | limit?: number; 16 | apiKey?: string; 17 | appKey?: string; 18 | }; 19 | 20 | let configuration: client.Configuration; 21 | 22 | export const searchLogs = { 23 | initialize: () => { 24 | const configOpts = { 25 | authMethods: { 26 | apiKeyAuth: process.env.DD_API_KEY, 27 | appKeyAuth: process.env.DD_APP_KEY 28 | } 29 | }; 30 | 31 | configuration = client.createConfiguration(configOpts); 32 | 33 | if (process.env.DD_LOGS_SITE) { 34 | configuration.setServerVariables({ 35 | site: process.env.DD_LOGS_SITE 36 | }); 37 | } 38 | 39 | // Enable any unstable operations 40 | configuration.unstableOperations["v2.listLogsGet"] = true; 41 | }, 42 | 43 | execute: async (params: SearchLogsParams) => { 44 | try { 45 | const { 46 | apiKey = process.env.DD_API_KEY, 47 | appKey = process.env.DD_APP_KEY, 48 | filter, 49 | sort, 50 | page, 51 | limit 52 | } = params; 53 | 54 | if (!apiKey || !appKey) { 55 | throw new Error("API Key and App Key are required"); 56 | } 57 | 58 | const apiInstance = new v2.LogsApi(configuration); 59 | 60 | // Use a more flexible approach with POST 61 | // Create the search request based on API docs 62 | const body = { 63 | filter: filter, 64 | sort: sort, 65 | page: page 66 | }; 67 | 68 | // Use DD_LOGS_SITE environment variable instead of DD_SITE 69 | const apiUrl = `https://${ 70 | process.env.DD_LOGS_SITE || "datadoghq.com" 71 | }/api/v2/logs/events/search`; 72 | 73 | const headers = { 74 | "Content-Type": "application/json", 75 | "DD-API-KEY": apiKey, 76 | "DD-APPLICATION-KEY": appKey 77 | }; 78 | 79 | const response = await fetch(apiUrl, { 80 | method: "POST", 81 | headers: headers, 82 | body: JSON.stringify(body) 83 | }); 84 | 85 | if (!response.ok) { 86 | throw { 87 | status: response.status, 88 | message: await response.text() 89 | }; 90 | } 91 | 92 | const data = await response.json(); 93 | 94 | // Apply client-side limit if specified 95 | if (limit && data.data && data.data.length > limit) { 96 | data.data = data.data.slice(0, limit); 97 | } 98 | 99 | return data; 100 | } catch (error: any) { 101 | if (error.status === 403) { 102 | console.error( 103 | "Authorization failed (403 Forbidden): Check that your API key and Application key are valid and have sufficient permissions to access logs." 104 | ); 105 | throw new Error( 106 | "Datadog API authorization failed. Please verify your API and Application keys have the correct permissions." 107 | ); 108 | } else { 109 | console.error("Error searching logs:", error); 110 | throw error; 111 | } 112 | } 113 | } 114 | }; 115 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig to read more about this file */ 4 | 5 | /* Projects */ 6 | // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ 7 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ 8 | // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ 9 | // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ 10 | // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ 11 | // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ 12 | 13 | /* Language and Environment */ 14 | "target": "es2020" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, 15 | // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ 16 | // "jsx": "preserve", /* Specify what JSX code is generated. */ 17 | // "libReplacement": true, /* Enable lib replacement. */ 18 | // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ 19 | // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ 20 | // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ 21 | // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ 22 | // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ 23 | // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ 24 | // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ 25 | // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ 26 | // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ 27 | 28 | /* Modules */ 29 | "module": "NodeNext" /* Specify what module code is generated. */, 30 | "moduleResolution": "NodeNext" /* Specify how TypeScript looks up a file from a given module specifier. */, 31 | "rootDir": "./src", 32 | // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ 33 | // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ 34 | // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ 35 | // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ 36 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */ 37 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 38 | // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ 39 | // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ 40 | // "rewriteRelativeImportExtensions": true, /* Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files. */ 41 | // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ 42 | // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ 43 | // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ 44 | // "noUncheckedSideEffectImports": true, /* Check side effect imports. */ 45 | "resolveJsonModule": true /* Enable importing .json files. */, 46 | // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ 47 | // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ 48 | 49 | /* JavaScript Support */ 50 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ 51 | // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ 52 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ 53 | 54 | /* Emit */ 55 | // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ 56 | // "declarationMap": true, /* Create sourcemaps for d.ts files. */ 57 | // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ 58 | // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ 59 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ 60 | // "noEmit": true, /* Disable emitting files from a compilation. */ 61 | // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ 62 | "outDir": "./dist" /* Specify an output folder for all emitted files. */, 63 | // "removeComments": true, /* Disable emitting comments. */ 64 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ 65 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ 66 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ 67 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 68 | // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ 69 | // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ 70 | // "newLine": "crlf", /* Set the newline character for emitting files. */ 71 | // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ 72 | // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ 73 | // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ 74 | // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ 75 | // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ 76 | 77 | /* Interop Constraints */ 78 | // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ 79 | // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ 80 | // "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */ 81 | // "erasableSyntaxOnly": true, /* Do not allow runtime constructs that are not part of ECMAScript. */ 82 | // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ 83 | "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, 84 | // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ 85 | "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, 86 | 87 | /* Type Checking */ 88 | "strict": true /* Enable all strict type-checking options. */, 89 | // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ 90 | // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ 91 | // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ 92 | // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ 93 | // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ 94 | // "strictBuiltinIteratorReturn": true, /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */ 95 | // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ 96 | // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ 97 | // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ 98 | // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ 99 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ 100 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ 101 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ 102 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ 103 | // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ 104 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ 105 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ 106 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ 107 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ 108 | 109 | /* Completeness */ 110 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ 111 | "skipLibCheck": true /* Skip type checking all .d.ts files. */ 112 | }, 113 | "include": ["src/**/*"], 114 | "exclude": ["node_modules", "dist"] 115 | } 116 | --------------------------------------------------------------------------------