Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 122 additions & 0 deletions community_mcp_servers/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# LLM Provider Configuration (Required)

# Choose your LLM provider: gemini, groq, openai, or lightning
LLM_PROVIDER=gemini

# API Keys (provide based on your LLM_PROVIDER choice)
GOOGLE_API_KEY=your_google_api_key_here
# GROQ_API_KEY=your_groq_api_key_here
# OPENAI_API_KEY=your_openai_api_key_here
# LIGHTNING_API_KEY=your_lightning_api_key_here

# Optional: Custom model name
# MODEL=models/gemini-2.0-flash-exp

# Optional: Lightning AI custom endpoint
# LIGHTNING_BASE_URL=https://lightning.ai/api/v1

# GitHub Agent Configuration

# Required: GitHub Personal Access Token
# Create at: https://github.com/settings/tokens
GITHUB_PERSONAL_ACCESS_TOKEN=your_github_token_here

# Optional: GitHub MCP Server Configuration
# GITHUB_MCP_BEARER_TOKEN=your_bearer_token
# GITHUB_MCP_SERVER_URL=https://api.githubcopilot.com/mcp/

# Slack Agent Configuration
# See: https://github.com/korotovsky/slack-mcp-server

# Authentication: Choose ONE of these three methods:

# Method 1: User OAuth Token (Recommended - full access)
# Create at: https://api.slack.com/apps
SLACK_MCP_XOXP_TOKEN=xoxp-your-token-here

# Method 2: Bot Token (Limited access - invited channels only, no search)
# SLACK_MCP_XOXB_TOKEN=xoxb-your-bot-token-here

# Method 3: Browser Tokens (Stealth mode - no permissions needed)
# Extract from browser DevTools while logged into Slack
# SLACK_MCP_XOXC_TOKEN=xoxc-your-browser-token-here
# SLACK_MCP_XOXD_TOKEN=xoxd-your-browser-cookie-here

# Optional: Enable message posting
# Options: empty/false (disabled), true (all channels), or comma-separated channel IDs
# Use ! prefix to allow all EXCEPT specified channels: !C123,C456
# SLACK_MCP_ADD_MESSAGE_TOOL=false

# Optional: Auto-mark sent messages as read
# SLACK_MCP_ADD_MESSAGE_MARK=true

# Optional: Transport Configuration
# SLACK_MCP_TRANSPORT=stdio
# SLACK_MCP_SERVER_URL=http://127.0.0.1:13080/sse
# SLACK_MCP_API_KEY=your-api-key-here
# SLACK_MCP_HOST=127.0.0.1
# SLACK_MCP_PORT=13080

# Optional: Enterprise Slack settings
# SLACK_MCP_USER_AGENT=your-browser-user-agent
# SLACK_MCP_CUSTOM_TLS=true
# SLACK_MCP_PROXY=http://proxy.example.com:8080

# Optional: Cache configuration
# SLACK_MCP_USERS_CACHE=/path/to/users_cache.json
# SLACK_MCP_CHANNELS_CACHE=/path/to/channels_cache_v2.json

# Optional: Logging
# SLACK_MCP_LOG_LEVEL=info

# Jira Agent Configuration
# Uses mcp-atlassian package via uvx (Python)
# See: https://github.com/sooperset/mcp-atlassian
# Configured for: https://mifosforge.jira.com

# Required: Jira Instance URL
JIRA_URL=https://mifosforge.jira.com

# Authentication: Choose ONE method

# Method 1: API Token (Recommended for Cloud)
# Create at: https://id.atlassian.com/manage-profile/security/api-tokens
JIRA_USERNAME=your.email@company.com
JIRA_API_TOKEN=your_jira_api_token_here

# Method 2: Personal Access Token (Server/Data Center)
# Go to: Profile → Personal Access Tokens → Create token
# JIRA_PERSONAL_TOKEN=your_personal_access_token_here

# Optional: SSL verification (set to false for self-signed certs)
# JIRA_SSL_VERIFY=true

# Optional: Project filtering (limit to specific projects)
# JIRA_PROJECTS_FILTER=MIFOS,FINERACT

# Optional: Read-only mode (disable write operations)
# READ_ONLY_MODE=true

# Optional: Enable only specific tools
# ENABLED_TOOLS=jira_search,jira_get_issue

# Optional: Transport Configuration
# Default: stdio (uses uvx mcp-atlassian)
# JIRA_MCP_TRANSPORT=stdio

# Optional: Use Docker instead of uvx
# JIRA_MCP_USE_DOCKER=false
# JIRA_MCP_DOCKER_IMAGE=ghcr.io/sooperset/mcp-atlassian:latest

# Optional: Proxy settings
# HTTP_PROXY=http://proxy.example.com:8080
# HTTPS_PROXY=http://proxy.example.com:8080
# NO_PROXY=localhost,127.0.0.1

# Optional: Custom HTTP headers (for corporate environments)
# Format: key=value,key2=value2
# JIRA_CUSTOM_HEADERS=X-Custom-Header=value

# Optional: Logging
# MCP_VERBOSE=true
# MCP_VERY_VERBOSE=false
51 changes: 51 additions & 0 deletions community_mcp_servers/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
*.env

# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
.venv/
venv/
ENV/
env/

# uv
uv.lock
.python-version

# IDEs
.vscode/

# Node
node_modules/
package-lock.json
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# Testing
.pytest_cache/
.coverage
htmlcov/
*.cover

# Logs
*.log

195 changes: 195 additions & 0 deletions community_mcp_servers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
# Community AI MCP Agent

A unified Python CLI for interacting with GitHub, Slack, and Jira using the Model Context Protocol (MCP) and LangChain.

## Features

- **GitHub Agent**: Repository management, issues, PRs, and code operations
- **Slack Agent**: Channel management, messaging, and workspace interactions
- **Jira Agent**: Issue tracking, project management, and workflow automation
- **Multi-LLM Support**: Works with Gemini, Groq, OpenAI, and Lightning AI
- **Extensible Architecture**: Built on LangChain and LangGraph for easy customization

## Quick Start

### 1. Installation

```bash
# Clone the repository
cd community_chatbot/mcp_impl

# Install Python dependencies (using uv or pip)
uv sync
# or
pip install -r requirements.txt

# Install Node.js dependencies for Slack agent (requires Node.js)
cd agents
npm install
cd ..
```

### 2. Configuration

Copy the example environment file and configure your credentials:

```bash
cp .env.example .env
```

**Minimum required configuration:**

```env
# Choose your LLM provider
LLM_PROVIDER=gemini
GOOGLE_API_KEY=your_key_here

# Enable agents as needed
GITHUB_PERSONAL_ACCESS_TOKEN=your_token_here
SLACK_MCP_XOXP_TOKEN=xoxp-your-token-here
JIRA_URL=https://your-company.atlassian.net
JIRA_USERNAME=your.email@company.com
JIRA_API_TOKEN=your_token_here
```

### 3. Usage

```bash
# Run the GitHub agent
python main.py github

# Run the Slack agent
python main.py slack

# Run the Jira agent
python main.py jira

# Get help for any agent
python main.py github --help
```

## Agent Details

### GitHub Agent

Interact with GitHub repositories using your personal access token.

**Required:**

- `GITHUB_PERSONAL_ACCESS_TOKEN` - [Create here](https://github.com/settings/tokens)

**Capabilities:**

- Repository operations (create, clone, search)
- Issue and PR management
- Code search and file operations
- Workflow automation

### Slack Agent

Connect to Slack workspaces and manage communications.

**Required:**

- `SLACK_MCP_XOXP_TOKEN` - [Create Slack app](https://api.slack.com/apps)

**Capabilities:**

- Channel and user management
- Message posting and retrieval
- Workspace information

**Optional:** Enable message posting with `SLACK_MCP_ADD_MESSAGE_TOOL=true`

### Jira Agent

Manage Jira projects and issues programmatically.

**Required:**

- `JIRA_URL` - Your Jira instance URL
- `JIRA_USERNAME` - Your email
- `JIRA_API_TOKEN` - [Create here](https://id.atlassian.com/manage-profile/security/api-tokens)

**Capabilities:**

- Issue CRUD operations
- Project and sprint management
- Advanced JQL searches
- Custom field handling

## Implementation Details

- **MCP integration:** Agents use an internal MCP-based client flow implemented in [community_chatbot/mcp_impl/lib/base_agent.py](community_chatbot/mcp_impl/lib/base_agent.py). The CLI shell for each agent is created with the helper in [community_chatbot/mcp_impl/lib/base_mcp.py](community_chatbot/mcp_impl/lib/base_mcp.py) which exposes commands like `list-tools`, `chat`, `invoke-tool`, and `health`.

- **MCP client used:** The code constructs a `MultiServerMCPClient` (from the `langchain_mcp_adapters` package) inside `BaseAgent.initialize()` to discover and load remote MCP tools. Tools discovered from the MCP endpoints are converted into LangGraph/LangChain-compatible tool definitions and used to create a React-style agent via `langgraph.prebuilt.create_react_agent`.

- **Transport options:** Agents support multiple transport modes:
- `stdio` — runs a local process (usually an `npx` package or a Docker image) and communicates over stdio. Examples:
- Slack: runs `npx slack-mcp-server --transport stdio` (see [community_chatbot/mcp_impl/agents/slack_agent.py](community_chatbot/mcp_impl/agents/slack_agent.py)).
- Jira: can run `ghcr.io/sooperset/mcp-atlassian:latest` (Docker) or `npx mcp-atlassian@latest` (see [community_chatbot/mcp_impl/agents/jira_agent.py](community_chatbot/mcp_impl/agents/jira_agent.py)).
- `sse` / `streamable_http` — connects to an HTTP/SSE MCP server endpoint. Default example endpoints used by the code:
- Slack HTTP default: `http://127.0.0.1:13080/sse`
- Jira HTTP default: `http://127.0.0.1:8080/sse`
The HTTP transport builder is implemented in [community_chatbot/mcp_impl/lib/base_transport.py](community_chatbot/mcp_impl/lib/base_transport.py).

- **LLM & agent creation:** The LLM provider is chosen by `LLM_PROVIDER` (see [community_chatbot/mcp_impl/lib/base_agent.py](community_chatbot/mcp_impl/lib/base_agent.py)) and the repository includes provider adapters in [community_chatbot/mcp_impl/llm_providers/](community_chatbot/mcp_impl/llm_providers/) (Gemini, Groq, Lightning). The selected LLM is passed into `create_react_agent` alongside the loaded MCP tools to form the agent executor.

### GitHub Agent

- `https://github.com/github/github-mcp-server` — GitHub MCP server repository.
- `https://api.githubcopilot.com/mcp/` — default GitHub MCP endpoint used as the service URL in `agents/github_agent.py`.
- `langchain_mcp_adapters` — MCP client package used via `MultiServerMCPClient` (see `lib/base_agent.py`).
- `langgraph` / `langchain` — used to create the React-style agent (`langgraph.prebuilt.create_react_agent`).

### Slack Agent

- `https://github.com/korotovsky/slack-mcp-server` — Slack MCP server repository.
- `npx slack-mcp-server` — npm package invoked in `agents/slack_agent.py` when using the `stdio` transport (runs `slack-mcp-server --transport stdio`).
- `SLACK_*` environment variables (tokens) map to Slack credentials and standard Slack developer docs: <https://api.slack.com/>
- Default local HTTP/SSE endpoint in code: `http://127.0.0.1:13080/sse` (used when `SLACK_MCP_TRANSPORT` is set to `sse`/`streamable_http`).

### Jira Agent

- `https://github.com/sooperset/mcp-atlassian` — Jira MCP server repository.
- `ghcr.io/sooperset/mcp-atlassian:latest` — Docker image referenced in `agents/jira_agent.py` for the `stdio` Docker transport.
- `npx mcp-atlassian@latest` — npm package fallback for `stdio` (non-Docker) mode.
- Jira developer docs and API token creation: <https://id.atlassian.com/manage-profile/security/api-tokens>
- Default local HTTP/SSE endpoint in code: `http://127.0.0.1:8080/sse` (used when `JIRA_MCP_TRANSPORT` is `sse`/`streamable_http`).

## Project Structure

```
mcp_impl/
├── agents/ # Agent implementations
│ ├── github_agent.py
│ ├── jira_agent.py
│ └── slack_agent.py
├── lib/ # Core library
│ ├── base_agent.py # Base agent class
│ ├── base_mcp.py # MCP integration
│ └── utils.py # Utilities
├── llm_providers/ # LLM provider implementations
│ ├── gemini.py
│ ├── groq_llm.py
│ ├── lightning_llm.py
│ └── __init__.py
├── main.py # CLI entry point
├── .env.example # Configuration template
└── requirements.txt # Python dependencies
```

## Requirements

- Python >= 3.12
- Valid API keys for your chosen LLM provider
- Agent-specific credentials (GitHub token, Slack token, Jira credentials)

## Getting API Keys

- **GitHub**: [Settings → Developer settings → Personal access tokens](https://github.com/settings/tokens)
- **Slack**: [Create a Slack app](https://api.slack.com/apps) → Install to workspace → Copy OAuth token
- **Jira**: [Account security → API tokens](https://id.atlassian.com/manage-profile/security/api-tokens)
- **Gemini**: [Google AI Studio](https://aistudio.google.com/app/apikey)
- **Groq**: [Groq Console](https://console.groq.com/keys)
- **OpenAI**: [OpenAI API Keys](https://platform.openai.com/api-keys)
5 changes: 5 additions & 0 deletions community_mcp_servers/agents/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from .github_agent import get_github_agent
from .jira_agent import get_jira_agent
from .slack_agent import get_slack_agent

__all__ = ["get_github_agent", "get_jira_agent", "get_slack_agent"]
Loading