Skip to main content
Glama

Jira-GitLab MCP Server

by gabbar910
simple_github_test.pyโ€ข6.58 kB
#!/usr/bin/env python3 """ Simple GitHub connectivity test """ import asyncio import json async def test_github_basic(): """Test basic GitHub functionality without MCP server. Initial Trial method""" try: from connectors.github_client import GitHubClient from utils.config import load_config print("๐Ÿ”ง Loading configuration...") config = load_config() print("๐Ÿ”— Testing GitHub connection...") github_client = GitHubClient(config["github"]) # Test connection connection_ok = await github_client.test_connection() print(f"Connection: {'โœ… SUCCESS' if connection_ok else 'โŒ FAILED'}") if not connection_ok: return False # Test getting repositories print("\n๐Ÿ“‹ Testing repository access...") repos = await github_client.get_projects() print(f"Repositories found: {len(repos)}") if len(repos) == 0: print("โš ๏ธ No repositories found. This could mean:") print(" - Your token doesn't have access to any repositories") print(" - You need to be added to repositories in GitHub") print(" - Your GitHub account has no repositories") # Try getting all repositories (not just owned) print("\n๐Ÿ” Trying to get all accessible repositories...") all_repos = await github_client.get_projects(owned=False) print(f"All accessible repositories: {len(all_repos)}") if len(all_repos) > 0: print("โœ… Found some accessible repositories!") repos = all_repos # Show repository details for i, repo in enumerate(repos[:3]): print(f"\n๐Ÿ“ Repository {i+1}:") print(f" Name: {repo['name']}") print(f" ID: {repo['id']}") print(f" URL: {repo['web_url']}") print(f" Default branch: {repo['default_branch']}") print(f" Visibility: {repo['visibility']}") # Test branch creation simulation if repos: test_repo = repos[0] print(f"\n๐ŸŒฟ Testing branch operations on '{test_repo['name']}'...") # Get existing branches branches = await github_client.get_branches(test_repo['id']) print(f" Existing branches: {len(branches)}") # Show some branches for branch in branches[:3]: status = "๐Ÿ”’" if branch['protected'] else "๐Ÿ”“" default = "โญ" if branch['default'] else " " print(f" {default} {status} {branch['name']}") # Simulate what would happen with branch creation test_branch = "feature/TEST-123-fix" existing = any(b['name'] == test_branch for b in branches) if existing: print(f" โš ๏ธ Branch '{test_branch}' already exists") else: print(f" โœ… Branch '{test_branch}' can be created") print(f" ๐Ÿ“ Would create: {test_repo['web_url']}/tree/{test_branch}") return True except Exception as e: print(f"โŒ Error: {e}") import traceback traceback.print_exc() return False async def test_mcp_tools_simulation(): """Simulate MCP tool functionality""" try: print("\n๐Ÿ› ๏ธ Simulating MCP Tools...") # Simulate the create_branch_for_issue tool print("\n๐Ÿ”ง Tool: create_branch_for_issue") print(" Input: issue_key='PROJ-123', project_id='owner/repo'") print(" Expected branch name: feature/PROJ-123-fix") print(" Expected output: Branch URL + Jira comment") # Simulate the get_jira_issues tool print("\n๐Ÿ”ง Tool: get_jira_issues") print(" Input: jql='project = DEMO AND status = \"To Do\"'") print(" Expected output: List of matching issues") # Simulate the comment_on_issue tool print("\n๐Ÿ”ง Tool: comment_on_issue") print(" Input: issue_key='PROJ-123', comment='Branch created: [URL]'") print(" Expected output: Success confirmation") # Simulate the commit_ai_fix tool print("\n๐Ÿ”ง Tool: commit_ai_fix") print(" Input: project_id='owner/repo', branch_name='feature/PROJ-123-fix'") print(" Expected output: Commit URL") # Simulate the create_merge_request tool (now pull request) print("\n๐Ÿ”ง Tool: create_merge_request") print(" Input: project_id='owner/repo', source_branch='feature/PROJ-123-fix'") print(" Expected output: Pull Request URL") return True except Exception as e: print(f"โŒ Error in MCP simulation: {e}") return False async def main(): print("๐Ÿงช Simple GitHub MCP Server Test") print("=" * 40) # Test 1: Basic GitHub functionality github_ok = await test_github_basic() # Test 2: MCP tools simulation mcp_ok = await test_mcp_tools_simulation() print("\n" + "=" * 40) print("๐Ÿ“Š Test Summary:") print(f"GitHub Connection: {'โœ… PASS' if github_ok else 'โŒ FAIL'}") print(f"MCP Tools Ready: {'โœ… PASS' if mcp_ok else 'โŒ FAIL'}") if github_ok and mcp_ok: print("\n๐ŸŽ‰ Your GitHub MCP server is ready!") print("\n๐Ÿ’ก What this means:") print(" โœ… GitHub connection is working") print(" โœ… Authentication is successful") print(" โœ… API access is functional") print(" โœ… MCP server can be started") print("\n๐Ÿš€ Next steps:") print(" 1. Add your Jira API token to config.json") print(" 2. Run: python mcp_server.py") print(" 3. Connect your AI agent to the MCP server") if github_ok: print("\n๐Ÿ“ Available for AI agents:") print(" - Create GitHub branches for Jira issues") print(" - Link branches back to Jira with comments") print(" - Query GitHub repositories and branches") print(" - Commit AI-generated fixes") print(" - Create pull requests") print(" - Automated DevOps workflows") else: print("\n๐Ÿ”ง Issues found - please check the errors above") if __name__ == "__main__": asyncio.run(main())

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gabbar910/MCPJiraGitlab'

If you have feedback or need assistance with the MCP directory API, please join our Discord server