Skip to content

shahgahmed/simple-agent-shah

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Documentation Update Agent

This agent automatically checks if your Confluence documentation needs updating based on GitHub PR changes.

Features

  • Fetches GitHub PR details and code diffs via MCP server
  • Fetches Confluence pages via direct REST API
  • Analyzes discrepancies between code changes and documentation
  • Provides specific, actionable update recommendations

Setup

1. Environment Variables

Create a .env file in the simple-agent directory with the following:

# GitHub Personal Access Token
# Get one from: https://github.com/settings/tokens
# Scopes needed: repo (for private repos) or public_repo (for public repos)
GITHUB_TOKEN=ghp_your_github_token_here

# Atlassian Confluence Credentials
# Get your instance URL from your Confluence site (no trailing slash)
ATLASSIAN_BASE_URL=https://yourcompany.atlassian.net

# Your Atlassian account email
[email protected]

# Atlassian API Token (no quotes needed)
# Create one at: https://id.atlassian.com/manage-profile/security/api-tokens
ATLASSIAN_API_TOKEN=your_atlassian_api_token_here

# Datadog Workflow Keys (optional - for posting recommendations)
DD_API_KEY=your_datadog_api_key
DD_APP_KEY=your_datadog_app_key

2. Get GitHub Token

  1. Go to https://github.com/settings/tokens
  2. Click "Generate new token" → "Generate new token (classic)"
  3. Give it a name (e.g., "MCP Agent")
  4. Select scopes:
    • repo for private repositories
    • OR public_repo for public repositories only
  5. Copy the token and add to .env

3. Get Atlassian API Token

  1. Go to https://id.atlassian.com/manage-profile/security/api-tokens
  2. Click "Create API token"
  3. Give it a label (e.g., "Documentation Agent")
  4. Copy the token and add to .env

4. Configure the Agent

Edit agent.py and update these values:

owner = "your-github-username"
repo = "your-repo-name"
pr_number = 123  # Your PR number
confluence_search_query = "search terms"  # What to search for in Confluence

How It Works

  1. Fetch PR: Connects to GitHub MCP server and retrieves PR data including the code diff
  2. Fetch Confluence: Uses direct REST API to get your Confluence page content
  3. Analyze & Recommend: Uses GPT-4 to compare the PR changes with current documentation and suggest specific updates
  4. Post to Datadog: (Optional) Automatically posts recommendations to your Datadog workflow

Running the Agent

python agent.py

Or trigger via dispatch:

# Your dispatch command here

Output

The agent will provide:

  • Summary of PR changes
  • Identification of outdated documentation sections
  • Specific text updates needed (in Confluence format)
  • Priority levels for each recommended update
  • Automatic notification to Datadog workflow (if configured)

Troubleshooting

GitHub MCP Server Not Found

  • Ensure Node.js and npx are installed
  • The GitHub MCP server will be auto-installed on first run via npx -y @modelcontextprotocol/server-github

Confluence 403 Error (Access Denied)

  • Your user account doesn't have Confluence product access
  • Go to https://admin.atlassian.com/
  • Grant Confluence access to your user account
  • Add user to the relevant Confluence space

Confluence 404 Error (Not Found)

  • Check the page ID is correct (find it in the URL: /pages/123456/...)
  • Verify the page exists and isn't deleted
  • Ensure your user has permission to view the page

GitHub Authentication Errors

  • Verify your GITHUB_TOKEN is correct in .env
  • Check token has repo scope (for private repos) or public_repo (for public)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages