Swarmia MCP Server

Swarmia MCP Server

Connect Swarmia's metrics and reports to MCP clients for advanced analytics.

2
Stars
1
Forks
2
Watchers
0
Issues
Swarmia MCP Server acts as a bridge between Swarmia's Export API and Model Context Protocol (MCP) clients, enabling streamlined access to advanced metrics and reporting. It supports the retrieval of pull request metrics, DORA metrics, investment balance reports, software capitalization data, and effort reporting. The server is designed to work seamlessly with various MCP clients, allowing users to fetch and analyze organizational engineering data via standardized protocols.

Key Features

Exposes Swarmia Export API endpoints over MCP
Provides pull request cycle time and review metrics
Fetches DORA performance metrics
Delivers investment balance and FTE reporting
Generates software capitalization reports
Effort breakdown by employee and issue
Integration-ready with multiple MCP clients
Customizable timeframes and data aggregation
Secure API token authentication
Command line and stdio server interface

Use Cases

Analyzing engineering team pull request cycle trends
Measuring DevOps performance with DORA metrics
Generating monthly investment balance by team or organization
Producing employee effort reports for specific issues or periods
Supporting software capitalization accounting with detailed reports
Aggregating and visualizing deployment frequencies and lead times
Automating engineering analytics reporting for management
Embedding Swarmia metrics in dashboards via MCP clients
Enabling ad-hoc queries for historical development activity
Connecting Swarmia data to AI-driven process optimizers

README

Swarmia MCP Server

A Model Context Protocol (MCP) server that provides access to Swarmia's Export API. This server allows you to fetch various metrics and reports from Swarmia including pull request metrics, DORA metrics, investment balance reports, software capitalization reports, and effort reporting.

Features

This MCP server provides access to the following Swarmia Export API endpoints:

  • Pull Request Metrics - Cycle time, review rate, merge time, PRs in progress, etc.
  • DORA Metrics - Deployment frequency, change lead time, change failure rate, mean time to recovery
  • Investment Balance - Monthly FTE data and investment category breakdowns
  • Software Capitalization Report - Employee contributions to capitalizable work
  • Software Capitalization Employees - FTE effort breakdown by month for each employee
  • Effort Reporting - Authors and their FTE for each issue in a given month

Prerequisites

  • Python 3.8 or higher
  • A Swarmia account with API access
  • A Swarmia API token (obtain from Settings/API tokens in your Swarmia dashboard)

Integration with MCP Clients

To use this MCP server with your favourite MCP client (E.g. Claude, Cursor etc.):

  1. Ensure depedancies are installed
bash
make install
  1. Add the following to your MCP configuration
json
   {
     "mcpServers": {
       "swarmia": {
         "command": "/path/to/swarmia-mcp/venv/bin/python3",
         "args": ["/path/to/swarmia-mcp/swarmia_mcp_server.py"],
         "env": {
           "SWARMIA_API_TOKEN": "your_api_token_here"
         }
       }
     }
   }
  1. Restart your client application

  2. Ask for some metrics Example queries:

    • "Analyze our team's pull request cycle time trends"
    • "Get the software capitalization report for Q1 2024"
    • "Show me effort reporting for last month"

Installation for Development

  1. Clone or download this repository
  2. Install the required dependencies and setup the project:
bash
make install
  1. Set up your Swarmia API token as an environment variable:
bash
export SWARMIA_API_TOKEN="your_api_token_here"

Quick Setup

For a complete setup including dependency installation and environment checks:

bash
make setup

Usage

Running the MCP Server

To run the server:

bash
make run

Or directly:

bash
python3 swarmia_mcp_server.py

The server will start and listen for MCP client connections via stdio.

Available Tools

The server provides the following tools:

1. get_pull_request_metrics

Get pull request metrics for the organization.

Parameters:

  • timeframe (optional): Predefined timeframe (last_7_days, last_14_days, last_30_days, etc.)
  • start_date (optional): Start date in YYYY-MM-DD format (alternative to timeframe)
  • end_date (optional): End date in YYYY-MM-DD format (alternative to timeframe)
  • timezone (optional): Timezone for data aggregation (default: UTC)

Returns: CSV data with columns including Start Date, End Date, Team, Cycle Time, Review Rate, Time to first review, PRs merged/week, Merge Time, PRs in progress, Contributors.

2. get_dora_metrics

Get DORA metrics for the organization.

Parameters:

  • timeframe (optional): Predefined timeframe
  • start_date (optional): Start date in YYYY-MM-DD format
  • end_date (optional): End date in YYYY-MM-DD format
  • timezone (optional): Timezone for data aggregation
  • app (optional): Deployment application name(s), comma-separated
  • environment (optional): Deployment environment(s), comma-separated

Returns: CSV data with DORA metrics including Deployment Frequency, Change Lead Time, Average Time to Deploy, Change Failure Rate, Mean Time to Recovery, Deployment Count.

3. get_investment_balance

Get investment balance statistics using the Effort model.

Parameters:

  • start_date (required): First day of the month in YYYY-MM-DD format
  • end_date (required): Last day of the month in YYYY-MM-DD format
  • timezone (optional): Timezone for data aggregation

Returns: CSV data with investment categories, FTE months, relative percentages, and activity counts.

4. get_software_capitalization_report

Get software capitalization report with employee contributions.

Parameters:

  • start_date (required): First day of the start month in YYYY-MM-DD format
  • end_date (required): Last day of the end month in YYYY-MM-DD format
  • timezone (optional): Timezone for data aggregation

Returns: CSV data with employee details, capitalizable work, developer months, and additional context.

5. get_software_capitalization_employees

Get list of employees with FTE effort breakdown by month.

Parameters:

  • year (required): Year for the report (e.g., 2024)
  • timezone (optional): Timezone for data aggregation

Returns: CSV data with employee details and monthly FTE breakdowns.

6. get_effort_reporting

Get effort reporting for authors and their FTE for each issue.

Parameters:

  • month (required): Month in YYYY-MM-DD format (first day of the month)
  • timezone (optional): Timezone for data aggregation
  • custom_field (optional): Jira field ID to include as Custom field column
  • group_by (optional): How FTE rows should be grouped (highestLevelIssue, lowestLevelIssue, customField)

Returns: CSV data with author details, FTE contributions, and issue information.

Configuration

Environment Variables

  • SWARMIA_API_TOKEN: Your Swarmia API token (required)

Timeframes

The following predefined timeframes are available:

  • last_7_days
  • last_14_days
  • last_30_days
  • last_60_days
  • last_90_days
  • last_180_days
  • last_365_days

Timezones

You can specify any timezone using tz database identifiers (e.g., America/New_York, Europe/London, Asia/Tokyo). The default is UTC.

API Reference

This MCP server is based on the Swarmia Export API documentation.

Base URL

https://app.swarmia.com/api/v0

Authentication

The server uses token-based authentication. Your API token is passed as a query parameter to all requests.

Error Handling

The server includes comprehensive error handling for:

  • Missing or invalid API tokens
  • HTTP request failures
  • Invalid parameters
  • API rate limiting
  • Network connectivity issues

Logging

The server logs all activities at the INFO level. You can adjust the logging level by modifying the logging.basicConfig() call in the server code.

Development

Available Make Targets

The project includes a comprehensive Makefile with the following targets:

  • make help - Show available targets and help information
  • make install - Install dependencies and setup the project
  • make setup - Complete setup (install + environment checks)
  • make test - Test the API connection and server functionality
  • make run - Run the MCP server
  • make check-env - Check if required environment variables are set
  • make clean - Clean up temporary files
  • make format - Format code with black (if available)
  • make lint - Lint code with flake8 (if available)
  • make type-check - Type check with mypy (if available)
  • make quality - Run all quality checks
  • make info - Show project information

Testing

To test the server:

bash
make test

Example Usage

Here's an example of how you might use this server with an MCP client:

python
# Example: Get pull request metrics for the last 30 days
result = await client.call_tool(
    "get_pull_request_metrics",
    {
        "timeframe": "last_30_days",
        "timezone": "America/New_York"
    }
)

# Example: Get DORA metrics for a specific date range
result = await client.call_tool(
    "get_dora_metrics",
    {
        "start_date": "2024-01-01",
        "end_date": "2024-01-31",
        "app": "my-app",
        "environment": "production"
    }
)

# Example: Get investment balance for January 2024
result = await client.call_tool(
    "get_investment_balance",
    {
        "start_date": "2024-01-01",
        "end_date": "2024-01-31"
    }
)

Troubleshooting

Common Issues

  1. "SWARMIA_API_TOKEN environment variable is required"

    • Make sure you've set the SWARMIA_API_TOKEN environment variable
    • Verify your token is valid and has the necessary permissions
  2. "API request failed with status 401"

    • Your API token may be invalid or expired
    • Check your token in the Swarmia dashboard
  3. "API request failed with status 403"

    • Your token may not have permission to access the requested data
    • Contact your Swarmia administrator
  4. "Request failed: Connection timeout"

    • Check your internet connection
    • Verify that app.swarmia.com is accessible from your network

Getting Help

Star History

Star History Chart

Repository Owner

mattjegan
mattjegan

User

Repository Details

Language Python
Default Branch main
Size 12 KB
Contributors 1
License MIT License
MCP Verified Nov 12, 2025

Programming Languages

Python
73.77%
Makefile
26.23%

Join Our Newsletter

Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.

We respect your privacy. Unsubscribe at any time.

Related MCPs

Discover similar Model Context Protocol servers

  • MacOS Resource Monitor MCP Server

    MacOS Resource Monitor MCP Server

    Lightweight MCP server for monitoring CPU, memory, and network usage on macOS.

    MacOS Resource Monitor MCP Server provides real-time monitoring of system resources on macOS devices, exposing an MCP endpoint for integration with LLMs or other clients. It identifies resource-intensive processes across CPU, memory, and network, delivering structured JSON outputs. The server offers advanced filtering, sorting, and system overviews, assisting in performance analysis and bottleneck identification. Designed for seamless integration and lightweight system monitoring.

    • 16
    • MCP
    • Pratyay/mac-monitor-mcp
  • SonarQube MCP Server

    SonarQube MCP Server

    Model Context Protocol server for AI access to SonarQube code quality metrics.

    SonarQube MCP Server offers a Model Context Protocol (MCP) server that integrates with SonarQube, enabling AI assistants to access code quality metrics, issues, and analysis results programmatically. It supports retrieving detailed quality metrics, filtering issues, reviewing security hotspots, analyzing branches and pull requests, and monitoring project health. The server facilitates multi-project analysis, contextual code review, and improved assistant workflows through a standardized protocol.

    • 101
    • MCP
    • sapientpants/sonarqube-mcp-server
  • JMeter MCP Server

    JMeter MCP Server

    Execute and analyze JMeter tests via Model Context Protocol integration.

    JMeter MCP Server enables execution and analysis of Apache JMeter tests through MCP-compatible clients. It provides command-line and programmatic tools for running JMeter tests in GUI and non-GUI modes, parsing and analyzing JTL result files, and generating detailed metrics and reports. Designed for integration with tools that follow the Model Context Protocol, it facilitates seamless performance testing workflows and actionable insights for test results.

    • 47
    • MCP
    • QAInsights/jmeter-mcp-server
  • Rootly MCP Server

    Rootly MCP Server

    Seamlessly integrate Rootly incident management into MCP-compatible editors.

    Rootly MCP Server provides an MCP-compliant server to access and manage Rootly's incident management API from within editors like Cursor, Windsurf, and Claude. It enables context-rich workflows and tool generation based on Rootly’s OpenAPI specification, allowing users to resolve incidents directly within their development environment. The server supports flexible authentication and dynamic resource generation while ensuring smart pagination to optimize editor context windows.

    • 36
    • MCP
    • Rootly-AI-Labs/Rootly-MCP-server
  • Crypto Sentiment MCP Server

    Crypto Sentiment MCP Server

    AI-accessible crypto sentiment data powered by Santiment.

    Delivers cryptocurrency sentiment analysis, social volume metrics, trending topics, and social dominance statistics to AI agents via the Model Context Protocol. Provides standardized APIs for retrieving market mood, tracking trending words, and monitoring significant shifts in online discussions about crypto assets. Integrates with Santiment to leverage aggregated data from social media and news sources for in-depth market insights.

    • 40
    • MCP
    • kukapay/crypto-sentiment-mcp
  • OpsLevel MCP Server

    OpsLevel MCP Server

    Read-only MCP server for integrating OpsLevel data with AI tools.

    OpsLevel MCP Server implements the Model Context Protocol to provide AI tools with a secure way to access and interact with OpsLevel account data. It supports read-only operations for a wide range of OpsLevel resources such as actions, campaigns, checks, components, documentation, domains, and more. The tool is compatible with popular environments including Claude Desktop and VS Code, enabling easy integration via configuration and API tokens. Installation options include Homebrew, Docker, and standalone binaries.

    • 8
    • MCP
    • OpsLevel/opslevel-mcp
  • Didn't find tool you were looking for?

    Be as detailed as possible for better results