{"id":27063741,"url":"https://github.com/ulucaydin/mcp-server-newrelic","last_synced_at":"2026-04-30T10:02:59.020Z","repository":{"id":286153431,"uuid":"960491287","full_name":"ulucaydin/mcp-server-newrelic","owner":"ulucaydin","description":"The Unofficial MCP Server for New Relic","archived":false,"fork":false,"pushed_at":"2025-08-07T16:40:53.000Z","size":33,"stargazers_count":2,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-07T18:28:25.092Z","etag":null,"topics":["agentic-ai","ai","aiops","mcp","mcp-server","newrelic","observability"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ulucaydin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-04T14:24:09.000Z","updated_at":"2025-08-07T16:56:44.000Z","dependencies_parsed_at":"2025-04-04T17:23:10.273Z","dependency_job_id":"58b25fcb-baa5-40e4-9d55-c2db15f75579","html_url":"https://github.com/ulucaydin/mcp-server-newrelic","commit_stats":null,"previous_names":["ulucaydin/mcp-server-newrelic"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ulucaydin/mcp-server-newrelic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ulucaydin%2Fmcp-server-newrelic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ulucaydin%2Fmcp-server-newrelic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ulucaydin%2Fmcp-server-newrelic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ulucaydin%2Fmcp-server-newrelic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ulucaydin","download_url":"https://codeload.github.com/ulucaydin/mcp-server-newrelic/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ulucaydin%2Fmcp-server-newrelic/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32460781,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agentic-ai","ai","aiops","mcp","mcp-server","newrelic","observability"],"created_at":"2025-04-05T16:20:53.989Z","updated_at":"2026-04-30T10:02:59.015Z","avatar_url":"https://github.com/ulucaydin.png","language":"Python","funding_links":[],"categories":["🤖 AI/ML"],"sub_categories":[],"readme":"[![MseeP.ai Security Assessment Badge](https://mseep.net/pr/ulucaydin-mcp-server-newrelic-badge.png)](https://mseep.ai/app/ulucaydin-mcp-server-newrelic)\n\n# New Relic NerdGraph MCP Server\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) \u003c!-- Add license if applicable --\u003e\n\nThis repository provides a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server for interacting with the [New Relic NerdGraph API](https://docs.newrelic.com/docs/apis/nerdgraph/get-started/introduction-new-relic-nerdgraph/). It allows MCP clients (like Claude Desktop) to use natural language or specific commands to query and interact with your New Relic account data and features.\n\nBuilt using the [fastmcp](https://github.com/jlowin/fastmcp) framework.\n\n## Features\n\nThis MCP server exposes various New Relic capabilities as tools and resources, including:\n\n*   **Account Details:** Fetch basic information about the configured account.\n*   **Generic NerdGraph Queries:** Execute arbitrary NerdGraph queries.\n*   **NRQL Queries:** Run specific NRQL queries against your account data.\n*   **Entity Management:** Search for entities (Applications, Hosts, Monitors, etc.) and retrieve detailed information by GUID.\n*   **APM:** List Application Performance Monitoring (APM) applications.\n*   **Synthetics:** List Synthetic monitors and create simple browser monitors.\n*   **Alerts:** List alert policies, view open incidents, and acknowledge incidents.\n\n## Prerequisites\n\n*   **Python:** Python 3.10+ recommended (as required by `fastmcp`).\n*   **pip:** Python package installer.\n*   **New Relic Account:** Access to a New Relic account.\n*   **New Relic User API Key:** A User API key is required for authentication. You can generate one [here](https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys/#user-api-key). **Keep this key secure!**\n*   **New Relic Account ID:** Your New Relic Account ID is needed for most operations. You can find it in the New Relic UI (often in the URL or account settings).\n\n## Setup \u0026 Installation\n\n1.  **Clone the Repository:**\n    ```bash\n    git clone \u003crepository_url\u003e # Replace \u003crepository_url\u003e with the actual URL\n    cd mcp-server-newrelic\n    ```\n\n2.  **Install Dependencies:**\n    ```bash\n    pip install -r requirements.txt\n    ```\n    This will install `fastmcp`, `requests`, and their dependencies.\n\n## Configuration\n\nThe server requires your New Relic API Key and Account ID to function. Configure these using environment variables **before** running the server:\n\n```bash\n# Replace YOUR_API_KEY and YOUR_ACCOUNT_ID with your actual credentials\nexport NEW_RELIC_API_KEY=\"YOUR_API_KEY\"\nexport NEW_RELIC_ACCOUNT_ID=\"YOUR_ACCOUNT_ID\"\n```\n\n**Security Note:** Do not hardcode your API key in the source code. Using environment variables is the recommended approach. You can also use tools like `direnv` or place these `export` commands in your shell profile (`.zshrc`, `.bashrc`, etc.) for persistence, but be mindful of the security implications.\n\n## Running the Server\n\nOnce configured, start the server using the `fastmcp` command-line tool:\n\n```bash\nfastmcp run server.py:mcp\n```\n\n*   `server.py`: The main entry point script.\n*   `mcp`: The name of the `FastMCP` instance created within `server.py`.\n\nThe server will start, print registration messages, and listen for incoming MCP connections (typically on port 8000 by default, managed by `fastmcp`). You should see output similar to:\n\n```\nUsing New Relic Account ID: YOUR_ACCOUNT_ID\nRegistering common features...\nRegistering entity features...\nRegistering APM features...\nRegistering Synthetics features...\nRegistering Alerts features...\nFeature registration complete.\nINFO:     Started server process [XXXXX]\nINFO:     Waiting for application startup.\nINFO:     Application startup complete.\nINFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)\n```\n\nLeave this terminal window running.\n\n## Usage with MCP Clients\n\n1.  **Start the MCP Server** (as described above).\n2.  **Restart your MCP Client** (e.g., Claude Desktop).\n3.  The client should automatically detect the running server and connect to it. You might see an indicator (like a 🔨 icon in Claude Desktop) showing that external tools are available.\n4.  You can now interact with your New Relic account using natural language or by directly invoking the tools listed below.\n\n    *   **Natural Language Example:** \"Show me my APM applications\" or \"List open critical incidents in account 1234567\"\n    *   **Direct Invocation (if supported):** `list_apm_applications()` or `list_open_incidents(priority='CRITICAL', target_account_id=1234567)`\n\n## Available Tools \u0026 Resources\n\nThe server provides the following functions accessible via the Model Context Protocol:\n\n---\n\n### Common (`features/common.py`)\n\n*   **Tool: `query_nerdgraph`**\n    *   **Description:** Executes an arbitrary NerdGraph query. Use for operations not covered by specific tools.\n    *   **Arguments:**\n        *   `nerdgraph_query` (str): The GraphQL query string.\n        *   `variables` (Optional[Dict]): JSON dictionary of variables for the query.\n    *   **Returns:** JSON string of the query result.\n\n*   **Tool: `run_nrql_query`**\n    *   **Description:** Executes a NRQL query.\n    *   **Arguments:**\n        *   `nrql` (str): The NRQL query string (e.g., `\"SELECT count(*) FROM Transaction TIMESERIES\"`).\n        *   `target_account_id` (Optional[int]): Account ID to query (uses default from env if omitted).\n    *   **Returns:** JSON string of the NRQL result.\n\n*   **Resource: `get_account_details`**\n    *   **Description:** Provides basic details (ID, name) for the configured New Relic account.\n    *   **URI:** `newrelic://account_details`\n    *   **Returns:** JSON string containing account details (`{\"data\": {\"id\": ..., \"name\": ...}}`) or an error.\n\n---\n\n### Entities (`features/entities.py`)\n\n*   **Tool: `search_entities`**\n    *   **Description:** Searches for New Relic entities based on criteria.\n    *   **Arguments:**\n        *   `name` (Optional[str]): Filter by name (fuzzy match).\n        *   `entity_type` (Optional[str]): Filter by type (e.g., `'APPLICATION'`, `'HOST'`).\n        *   `domain` (Optional[str]): Filter by domain (e.g., `'APM'`, `'INFRA'`).\n        *   `tags` (Optional[List[Dict]]): Filter by tags (e.g., `[{\"key\": \"env\", \"value\": \"prod\"}]`).\n        *   `target_account_id` (Optional[int]): Explicit account ID to search within.\n        *   `limit` (int): Max results (default 50).\n    *   **Returns:** JSON string of search results.\n\n*   **Resource: `get_entity_details`**\n    *   **Description:** Retrieves detailed information for a specific entity. Includes common fields and type-specific details for APM, Browser, Infra, Synthetics, Dashboards, etc.\n    *   **URI:** `newrelic://entity/{guid}` (replace `{guid}` with the entity GUID)\n    *   **Returns:** JSON string of entity details.\n\n*   **Prompt: `generate_entity_search_query`**\n    *   **Description:** Generates the `query` string condition part for the `entitySearch` NerdGraph field, useful for constructing search queries.\n    *   **Arguments:**\n        *   `entity_name` (str): Name to search for (exact match used in prompt generation).\n        *   `entity_domain` (Optional[str]): Domain to include in the query condition.\n        *   `entity_type` (Optional[str]): Type to include in the query condition.\n        *   `target_account_id` (Optional[int]): Account ID to include in the query condition.\n    *   **Returns:** String representing the search condition (e.g., `\"accountId = 123 AND name = 'My App' AND domain = 'APM'\"`).\n\n---\n\n### APM (`features/apm.py`)\n\n*   **Tool: `list_apm_applications`**\n    *   **Description:** Lists APM applications.\n    *   **Arguments:**\n        *   `target_account_id` (Optional[int]): Account ID to query (uses default if omitted).\n    *   **Returns:** JSON string containing a list of APM applications.\n\n---\n\n### Synthetics (`features/synthetics.py`)\n\n*   **Tool: `list_synthetics_monitors`**\n    *   **Description:** Lists Synthetic monitors.\n    *   **Arguments:**\n        *   `target_account_id` (Optional[int]): Account ID to query (uses default if omitted).\n    *   **Returns:** JSON string containing a list of Synthetic monitors.\n\n*   **Tool: `create_simple_browser_monitor`**\n    *   **Description:** Creates a basic Synthetics simple browser monitor.\n    *   **Arguments:**\n        *   `monitor_name` (str): Name for the new monitor.\n        *   `url` (str): URL to monitor.\n        *   `locations` (List[str]): List of public location labels (e.g., `[\"AWS_US_EAST_1\"]`).\n        *   `period` (str): Check frequency (e.g., `\"EVERY_15_MINUTES\"`). Default: `\"EVERY_15_MINUTES\"`.\n        *   `status` (str): Initial status (`\"ENABLED\"` or `\"DISABLED\"`). Default: `\"ENABLED\"`.\n        *   `target_account_id` (Optional[int]): Account ID for creation (uses default if omitted).\n        *   `tags` (Optional[List[Dict]]): Optional tags (e.g., `[{\"key\": \"team\", \"value\": \"ops\"}]`).\n    *   **Returns:** JSON string with the result, including the new monitor's GUID.\n\n*   **Resource:** Synthetics monitor details can be retrieved using the `get_entity_details` resource with the monitor's GUID (`newrelic://entity/{monitor_guid}`).\n\n---\n\n### Alerts (`features/alerts.py`)\n\n*   **Tool: `list_alert_policies`**\n    *   **Description:** Lists alert policies, optionally filtering by name.\n    *   **Arguments:**\n        *   `target_account_id` (Optional[int]): Account ID to query (uses default if omitted).\n        *   `policy_name_filter` (Optional[str]): Filter policies where name contains this string.\n    *   **Returns:** JSON string containing a list of alert policies.\n\n*   **Tool: `list_open_incidents`**\n    *   **Description:** Lists currently open alert incidents.\n    *   **Arguments:**\n        *   `target_account_id` (Optional[int]): Account ID to query (uses default if omitted).\n        *   `priority` (Optional[str]): Filter by priority (`'CRITICAL'`, `'WARNING'`).\n    *   **Returns:** JSON string containing a list of open incidents.\n\n*   **Tool: `acknowledge_alert_incident`**\n    *   **Description:** Acknowledges an open alert incident.\n    *   **Arguments:**\n        *   `incident_id` (int): The ID of the incident to acknowledge.\n        *   `target_account_id` (Optional[int]): Account ID where the incident occurred (uses default if omitted).\n        *   `message` (Optional[str]): Optional message for the acknowledgement.\n    *   **Returns:** JSON string with the result of the acknowledgement.\n\n---\n\n## Contributing\n\nContributions are welcome! Please feel free to submit issues or pull requests.\n\n1.  Fork the repository.\n2.  Create a new branch (`git checkout -b feature/your-feature`).\n3.  Make your changes.\n4.  Commit your changes (`git commit -am 'Add some feature'`).\n5.  Push to the branch (`git push origin feature/your-feature`).\n6.  Open a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details (if a LICENSE file exists). ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fulucaydin%2Fmcp-server-newrelic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fulucaydin%2Fmcp-server-newrelic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fulucaydin%2Fmcp-server-newrelic/lists"}