newrelic-mcp-server


Namenewrelic-mcp-server JSON
Version 1.2.1 PyPI version JSON
download
home_pageNone
SummaryNew Relic MCP Server - Model Context Protocol server for New Relic APIs
upload_time2025-08-08 03:28:20
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT
keywords newrelic mcp monitoring observability claude ai
VCS
bugtrack_url
requirements fastmcp httpx python-dotenv
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # New Relic MCP Server

A Model Context Protocol (MCP) server that provides programmatic access to New Relic APIs, enabling AI assistants and other tools to interact with New Relic monitoring and observability data.

## Features

- **APM Application Management**: List and retrieve application details, metrics, and metric data
- **NRQL Queries**: Execute NRQL queries via NerdGraph
- **Alert Policies**: List and manage alert policies
- **Synthetic Monitoring**: Access synthetic monitor information
- **Dashboards**: List and retrieve dashboard configurations
- **Entity Search**: Search across all New Relic entities
- **Infrastructure**: Monitor servers and infrastructure components
- **Deployments**: Track and create application deployments
- **User Management**: List and manage users
- **NerdGraph**: Execute custom GraphQL queries

## Installation

### Option 1: Install from PyPI (Recommended)

```bash
pip install newrelic-mcp-server
```

### Option 2: Install from Source

```bash
# Clone this repository
git clone https://github.com/piekstra/newrelic-mcp-server.git
cd newrelic-mcp-server

# Install in development mode
pip install -e .
```

## Configuration

The server requires the following environment variables:

```bash
# Required
export NEWRELIC_API_KEY="your-api-key-here"  # Your New Relic User API key

# Optional
export NEWRELIC_REGION="US"  # or "EU" (default: "US")
export NEWRELIC_ACCOUNT_ID="your-account-id"  # Required for some operations
```

### Getting Your API Key

1. Log in to New Relic
2. Navigate to the [API Keys page](https://one.newrelic.com/api-keys)
3. Create a new User API key (starts with `NRAK`)
4. Copy the key and set it as the `NEWRELIC_API_KEY` environment variable

## Usage

### With Claude Desktop

Add the following to your Claude Desktop configuration (`claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "newrelic": {
      "command": "newrelic-mcp-server",
      "env": {
        "NEWRELIC_API_KEY": "your-api-key-here",
        "NEWRELIC_REGION": "US",
        "NEWRELIC_ACCOUNT_ID": "your-account-id"
      }
    }
  }
}
```

### With Other MCP Clients

```bash
# Start the server directly
newrelic-mcp-server

# Or run as a module
python -m newrelic_mcp
```

## Available Tools

### Application Management

- `list_applications` - List all APM applications
- `get_application` - Get details for a specific application
- `get_application_metrics` - Get available metrics for an application
- `get_application_metric_data` - Get metric data with time range filtering

### Querying

- `query_nrql` - Execute NRQL queries for data analysis
- `nerdgraph_query` - Execute custom NerdGraph GraphQL queries

### Monitoring

- `list_alert_policies` - List all alert policies
- `get_alert_policy` - Get specific alert policy details
- `list_synthetic_monitors` - List synthetic monitors
- `get_synthetic_monitor` - Get synthetic monitor details

### Dashboards & Visualization

- `list_dashboards` - List all dashboards
- `get_dashboard` - Get dashboard configuration and widgets

### Infrastructure

- `list_servers` - List monitored servers
- `get_server` - Get server details
- `search_entities` - Search across all entity types

### Deployment Tracking

- `list_deployments` - List application deployments
- `create_deployment` - Record new deployments

### User Management

- `list_users` - List account users
- `get_user` - Get user details

## Examples

### Query Application Performance

```python
# List all applications
await list_applications()

# Get specific application metrics
await get_application_metric_data(
    app_id='123456',
    metric_names=['HttpDispatcher', 'Apdex'],
    from_time='2024-01-01T00:00:00Z',
    to_time='2024-01-02T00:00:00Z'
)
```

### Execute NRQL Query

```python
await query_nrql(
    account_id='1234567',
    nrql='SELECT average(duration) FROM Transaction WHERE appName = "My App" SINCE 1 hour ago'
)
```

### Search Entities

```python
await search_entities(
    query='name LIKE "%production%"',
    limit=50
)
```

### Create Deployment Marker

```python
await create_deployment(
    app_id='123456',
    revision='v2.0.1',
    description='Production deployment',
    user='deploy-bot',
    changelog='Fixed critical bug in payment processing'
)
```

## Development

```bash
# Clone the repository
git clone https://github.com/piekstra/newrelic-mcp-server.git
cd newrelic-mcp-server

# Install in development mode
pip install -e .[dev]

# Install pre-commit hooks
pre-commit install

# Run the server
newrelic-mcp-server

# Run tests (when available)
pytest

# Format code
black newrelic_mcp

# Lint code
flake8 newrelic_mcp

# Run all pre-commit checks
pre-commit run --all-files
```

## Dependencies

- `fastmcp` - FastMCP framework for building MCP servers
- `httpx` - Async HTTP client for API requests
- `python-dotenv` - Environment variable management (optional)

## API Rate Limits

Be aware of New Relic's API rate limits:
- REST API v2: Subject to rate limiting per account
- NerdGraph: Higher rate limits but still enforced
- Synthetic Monitoring API: 3 requests per second

## Security

- Never commit API keys to version control
- Use environment variables for sensitive configuration
- API keys should have minimal required permissions
- Consider using separate keys for different environments

## Troubleshooting

### Authentication Errors

- Ensure your API key starts with `NRAK`
- Verify the key has the necessary permissions
- Check if you're using the correct region (US/EU)

### Rate Limiting

If you encounter rate limit errors:
- Implement exponential backoff in your client code
- Cache frequently accessed data
- Batch operations where possible

### Connection Issues

- Verify network connectivity
- Check firewall rules for API endpoints
- Ensure correct base URLs for your region

### Python Environment

- Ensure Python 3.10+ is installed
- Install dependencies with `pip install -r requirements.txt`
- Check that the script is executable: `chmod +x newrelic_mcp_server.py`

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## License

MIT

## Support

For issues and questions:
- GitHub Issues: [Create an issue](https://github.com/piekstra/newrelic-mcp-server/issues)
- New Relic Documentation: [docs.newrelic.com](https://docs.newrelic.com)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "newrelic-mcp-server",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "newrelic, mcp, monitoring, observability, claude, ai",
    "author": null,
    "author_email": "Caleb Piekstra <calebpiekstra@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/49/d4/03512aaed3b720db16d6296baae5c125b5b1dd7b2fc52a4d81cac31ef258/newrelic_mcp_server-1.2.1.tar.gz",
    "platform": null,
    "description": "# New Relic MCP Server\n\nA Model Context Protocol (MCP) server that provides programmatic access to New Relic APIs, enabling AI assistants and other tools to interact with New Relic monitoring and observability data.\n\n## Features\n\n- **APM Application Management**: List and retrieve application details, metrics, and metric data\n- **NRQL Queries**: Execute NRQL queries via NerdGraph\n- **Alert Policies**: List and manage alert policies\n- **Synthetic Monitoring**: Access synthetic monitor information\n- **Dashboards**: List and retrieve dashboard configurations\n- **Entity Search**: Search across all New Relic entities\n- **Infrastructure**: Monitor servers and infrastructure components\n- **Deployments**: Track and create application deployments\n- **User Management**: List and manage users\n- **NerdGraph**: Execute custom GraphQL queries\n\n## Installation\n\n### Option 1: Install from PyPI (Recommended)\n\n```bash\npip install newrelic-mcp-server\n```\n\n### Option 2: Install from Source\n\n```bash\n# Clone this repository\ngit clone https://github.com/piekstra/newrelic-mcp-server.git\ncd newrelic-mcp-server\n\n# Install in development mode\npip install -e .\n```\n\n## Configuration\n\nThe server requires the following environment variables:\n\n```bash\n# Required\nexport NEWRELIC_API_KEY=\"your-api-key-here\"  # Your New Relic User API key\n\n# Optional\nexport NEWRELIC_REGION=\"US\"  # or \"EU\" (default: \"US\")\nexport NEWRELIC_ACCOUNT_ID=\"your-account-id\"  # Required for some operations\n```\n\n### Getting Your API Key\n\n1. Log in to New Relic\n2. Navigate to the [API Keys page](https://one.newrelic.com/api-keys)\n3. Create a new User API key (starts with `NRAK`)\n4. Copy the key and set it as the `NEWRELIC_API_KEY` environment variable\n\n## Usage\n\n### With Claude Desktop\n\nAdd the following to your Claude Desktop configuration (`claude_desktop_config.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"newrelic\": {\n      \"command\": \"newrelic-mcp-server\",\n      \"env\": {\n        \"NEWRELIC_API_KEY\": \"your-api-key-here\",\n        \"NEWRELIC_REGION\": \"US\",\n        \"NEWRELIC_ACCOUNT_ID\": \"your-account-id\"\n      }\n    }\n  }\n}\n```\n\n### With Other MCP Clients\n\n```bash\n# Start the server directly\nnewrelic-mcp-server\n\n# Or run as a module\npython -m newrelic_mcp\n```\n\n## Available Tools\n\n### Application Management\n\n- `list_applications` - List all APM applications\n- `get_application` - Get details for a specific application\n- `get_application_metrics` - Get available metrics for an application\n- `get_application_metric_data` - Get metric data with time range filtering\n\n### Querying\n\n- `query_nrql` - Execute NRQL queries for data analysis\n- `nerdgraph_query` - Execute custom NerdGraph GraphQL queries\n\n### Monitoring\n\n- `list_alert_policies` - List all alert policies\n- `get_alert_policy` - Get specific alert policy details\n- `list_synthetic_monitors` - List synthetic monitors\n- `get_synthetic_monitor` - Get synthetic monitor details\n\n### Dashboards & Visualization\n\n- `list_dashboards` - List all dashboards\n- `get_dashboard` - Get dashboard configuration and widgets\n\n### Infrastructure\n\n- `list_servers` - List monitored servers\n- `get_server` - Get server details\n- `search_entities` - Search across all entity types\n\n### Deployment Tracking\n\n- `list_deployments` - List application deployments\n- `create_deployment` - Record new deployments\n\n### User Management\n\n- `list_users` - List account users\n- `get_user` - Get user details\n\n## Examples\n\n### Query Application Performance\n\n```python\n# List all applications\nawait list_applications()\n\n# Get specific application metrics\nawait get_application_metric_data(\n    app_id='123456',\n    metric_names=['HttpDispatcher', 'Apdex'],\n    from_time='2024-01-01T00:00:00Z',\n    to_time='2024-01-02T00:00:00Z'\n)\n```\n\n### Execute NRQL Query\n\n```python\nawait query_nrql(\n    account_id='1234567',\n    nrql='SELECT average(duration) FROM Transaction WHERE appName = \"My App\" SINCE 1 hour ago'\n)\n```\n\n### Search Entities\n\n```python\nawait search_entities(\n    query='name LIKE \"%production%\"',\n    limit=50\n)\n```\n\n### Create Deployment Marker\n\n```python\nawait create_deployment(\n    app_id='123456',\n    revision='v2.0.1',\n    description='Production deployment',\n    user='deploy-bot',\n    changelog='Fixed critical bug in payment processing'\n)\n```\n\n## Development\n\n```bash\n# Clone the repository\ngit clone https://github.com/piekstra/newrelic-mcp-server.git\ncd newrelic-mcp-server\n\n# Install in development mode\npip install -e .[dev]\n\n# Install pre-commit hooks\npre-commit install\n\n# Run the server\nnewrelic-mcp-server\n\n# Run tests (when available)\npytest\n\n# Format code\nblack newrelic_mcp\n\n# Lint code\nflake8 newrelic_mcp\n\n# Run all pre-commit checks\npre-commit run --all-files\n```\n\n## Dependencies\n\n- `fastmcp` - FastMCP framework for building MCP servers\n- `httpx` - Async HTTP client for API requests\n- `python-dotenv` - Environment variable management (optional)\n\n## API Rate Limits\n\nBe aware of New Relic's API rate limits:\n- REST API v2: Subject to rate limiting per account\n- NerdGraph: Higher rate limits but still enforced\n- Synthetic Monitoring API: 3 requests per second\n\n## Security\n\n- Never commit API keys to version control\n- Use environment variables for sensitive configuration\n- API keys should have minimal required permissions\n- Consider using separate keys for different environments\n\n## Troubleshooting\n\n### Authentication Errors\n\n- Ensure your API key starts with `NRAK`\n- Verify the key has the necessary permissions\n- Check if you're using the correct region (US/EU)\n\n### Rate Limiting\n\nIf you encounter rate limit errors:\n- Implement exponential backoff in your client code\n- Cache frequently accessed data\n- Batch operations where possible\n\n### Connection Issues\n\n- Verify network connectivity\n- Check firewall rules for API endpoints\n- Ensure correct base URLs for your region\n\n### Python Environment\n\n- Ensure Python 3.10+ is installed\n- Install dependencies with `pip install -r requirements.txt`\n- Check that the script is executable: `chmod +x newrelic_mcp_server.py`\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nMIT\n\n## Support\n\nFor issues and questions:\n- GitHub Issues: [Create an issue](https://github.com/piekstra/newrelic-mcp-server/issues)\n- New Relic Documentation: [docs.newrelic.com](https://docs.newrelic.com)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "New Relic MCP Server - Model Context Protocol server for New Relic APIs",
    "version": "1.2.1",
    "project_urls": {
        "Documentation": "https://github.com/piekstra/newrelic-mcp-server#readme",
        "Homepage": "https://github.com/piekstra/newrelic-mcp-server",
        "Issues": "https://github.com/piekstra/newrelic-mcp-server/issues",
        "Repository": "https://github.com/piekstra/newrelic-mcp-server"
    },
    "split_keywords": [
        "newrelic",
        " mcp",
        " monitoring",
        " observability",
        " claude",
        " ai"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c47c116e52b0154a568b830b029a0d021f56583bcf32792c40fb2eb9fa77a24b",
                "md5": "5f0040d3dcba5713a220c246b5e2f1f0",
                "sha256": "e5c64cfdd87120fc6e2e16f399a53d771014f6392204f41e72e7c6a258c01190"
            },
            "downloads": -1,
            "filename": "newrelic_mcp_server-1.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5f0040d3dcba5713a220c246b5e2f1f0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 9190,
            "upload_time": "2025-08-08T03:28:18",
            "upload_time_iso_8601": "2025-08-08T03:28:18.694221Z",
            "url": "https://files.pythonhosted.org/packages/c4/7c/116e52b0154a568b830b029a0d021f56583bcf32792c40fb2eb9fa77a24b/newrelic_mcp_server-1.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "49d403512aaed3b720db16d6296baae5c125b5b1dd7b2fc52a4d81cac31ef258",
                "md5": "1eacc9a54ab4d79b412f9bc63c83ec8c",
                "sha256": "62f0a76d99375fb4faf78be9c5bd5ccd8e0ce6e4a764039f120b651253cc809e"
            },
            "downloads": -1,
            "filename": "newrelic_mcp_server-1.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "1eacc9a54ab4d79b412f9bc63c83ec8c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 11117,
            "upload_time": "2025-08-08T03:28:20",
            "upload_time_iso_8601": "2025-08-08T03:28:20.044139Z",
            "url": "https://files.pythonhosted.org/packages/49/d4/03512aaed3b720db16d6296baae5c125b5b1dd7b2fc52a4d81cac31ef258/newrelic_mcp_server-1.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-08 03:28:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "piekstra",
    "github_project": "newrelic-mcp-server#readme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "fastmcp",
            "specs": []
        },
        {
            "name": "httpx",
            "specs": []
        },
        {
            "name": "python-dotenv",
            "specs": []
        }
    ],
    "lcname": "newrelic-mcp-server"
}
        
Elapsed time: 1.99077s