Skip to content

aneesq635/HTML5Solution_MCP_Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

29 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MCP Integration Server

A comprehensive Flask-based Model Context Protocol (MCP) server that provides seamless integration between Notion, Slack, and Jira. This server enables AI assistants and other applications to interact with these platforms through a unified API interface.

Features

πŸ—‚οΈ Notion Integration

  • Database Management: List, create, and manage Notion databases
  • Page Operations: Create, read, update, and delete Notion pages
  • Content Management: Add content blocks, comments, and manage page properties
  • Search & Discovery: Search across pages, databases, and content
  • Advanced Features: Archive pages, manage users, and handle complex property types

πŸ’¬ Slack Integration

  • Channel Management: Access channels, members, and channel information
  • Messaging: Send messages, replies, and manage message threads
  • User Management: Search users, get user information, and manage workspace members
  • Message Operations: Find, update, delete messages, and manage reactions
  • Advanced Search: Find messages by content, user, or keywords

🎯 Jira Integration

  • Project Management: List projects, get project details, and manage project users
  • Issue Management: Create, read, update, delete, and transition issues
  • Comprehensive Updates: Support for all issue fields including custom fields
  • User Management: Search users, assign issues, and manage project access
  • Comments & Collaboration: Add comments, manage issue relationships

Installation

Prerequisites

  • Python 3.8+
  • pip package manager
  • Access to Notion, Slack, and/or Jira APIs

Setup

  1. Clone or download the project files

  2. Install required packages:

pip install flask flask-cors python-dotenv requests slack-sdk fastmcp
  1. Create a .env file in your project root:
# Notion Configuration
NOTION_API_KEY=your_notion_integration_token
NOTION_DATABASE_ID=your_default_database_id

# Slack Configuration  
SLACK_BOT_TOKEN=xoxb-your-slack-bot-token

# Jira Configuration
JIRA_URL=https://yourcompany.atlassian.net
JIRA_EMAIL=your-email@company.com
JIRA_API_TOKEN=your_jira_api_token

API Setup Instructions

Notion Setup

  1. Go to Notion Developers
  2. Create a new integration
  3. Copy the "Internal Integration Token" to your .env file as NOTION_API_KEY
  4. Share your Notion pages/databases with the integration
  5. (Optional) Copy a database ID for NOTION_DATABASE_ID

Slack Setup

  1. Go to Slack API
  2. Create a new Slack app
  3. Go to "OAuth & Permissions" and add these Bot Token Scopes:
    • channels:history
    • channels:read
    • chat:write
    • users:read
    • reactions:read
    • reactions:write
  4. Install the app to your workspace
  5. Copy the "Bot User OAuth Token" to your .env file as SLACK_BOT_TOKEN

Jira Setup

  1. Go to your Jira instance β†’ Account Settings β†’ Security
  2. Create an API token
  3. Add your Jira URL, email, and API token to the .env file

Usage

Starting the Server

python your_script_name.py

The server will start on:

  • Flask API: http://localhost:3000
  • MCP Server: http://localhost:3030

API Endpoints

Configuration

  • GET /mcp/tools - List available tools
  • POST /mcp/configure - Configure API credentials dynamically
  • POST /mcp/tool/<tool_name> - Execute specific tool functions

Example Configuration Request

POST /mcp/configure
{
  "configuration": {
    "notion": {
      "apiKey": "secret_xyz...",
      "databaseId": "abc123..."
    },
    "slack": {
      "botToken": "xoxb-..."
    },
    "jira": {
      "url": "https://company.atlassian.net",
      "email": "user@company.com",
      "apiToken": "api_token_here"
    }
  }
}

Available Tools

Notion Tools

Tool Description
get_notion_databases List all accessible databases
get_notion_data Fetch data from a database
get_notion_page_data Get complete page data and content
search_notion_pages Search across all Notion content
update_notion_page Update page properties and content
create_notion_page_in_database Create new database pages
append_notion_page_content Add content blocks to pages
create_notion_database Create new databases
add_database_property Add properties to databases
get_notion_comments Retrieve page comments
create_notion_comment Add comments to pages
archive_notion_page Archive or restore pages
get_notion_users List workspace users

Slack Tools

Tool Description
get_slack_channels List all channels
send_slack_message Send messages to channels
get_slack_messages Retrieve channel message history
find_slack_messages Search messages by content
get_slack_thread_replies Get thread conversations
send_slack_thread_reply Reply to message threads
get_slack_user_info Get user information
get_slack_channel_members List channel members
add_slack_reaction Add emoji reactions
update_slack_message Edit existing messages
delete_slack_message Delete messages
find_messages_by_user Find messages from specific users
find_recent_messages_with_keywords Search by keywords

Jira Tools

Tool Description
get_jira_projects List all projects
get_jira_issues Get issues by project or JQL
get_jira_issue Get specific issue details
create_jira_issue Create new issues
update_jira_issue_comprehensive Update all issue properties
delete_jira_issue Delete issues
assign_jira_issue Assign issues to users
add_jira_comment Add comments to issues
get_jira_comments Retrieve issue comments
transition_jira_issue Change issue status
get_jira_transitions Get available status transitions
search_jira_users Search for users
get_jira_issue_types Get available issue types
get_jira_project_statuses Get project status options
get_jira_project_users Get project team members

Example Usage

Python Client Example

import requests

# Configure tools
config_response = requests.post('http://localhost:3000/mcp/configure', json={
    "configuration": {
        "notion": {"apiKey": "your_key", "databaseId": "your_db_id"},
        "slack": {"botToken": "your_token"}
    }
})

# Use a tool
tool_response = requests.post('http://localhost:3000/mcp/tool/get_notion_data', json={
    "database_identifier": "Task Tracker",
    "page_size": 100
})

print(tool_response.json())

Creating a Notion Page

requests.post('http://localhost:3000/mcp/tool/create_notion_page_in_database', json={
    "database_identifier": "Tasks",
    "title": "New Task",
    "properties": {
        "Status": "In Progress",
        "Priority": "High"
    }
})

Sending Slack Messages

requests.post('http://localhost:3000/mcp/tool/send_slack_message', json={
    "channel_name": "general",
    "text": "Hello from the integration!"
})

Error Handling

The API returns standardized responses:

Success Response:

{
  "success": true,
  "data": { ... }
}

Error Response:

{
  "success": false,
  "error": "Description of what went wrong"
}

Security Considerations

  • Environment Variables: Never commit .env files to version control
  • API Tokens: Regularly rotate your API tokens
  • Permissions: Use principle of least privilege for API scopes
  • HTTPS: Use HTTPS in production environments
  • Rate Limits: Be mindful of API rate limits for each service

Troubleshooting

Common Issues

  1. "Missing API key" errors

    • Ensure .env file is in the correct location
    • Verify environment variable names match exactly
    • Check that python-dotenv is installed
  2. Slack "channel not found" errors

    • Verify channel name doesn't include '#' prefix
    • Ensure bot has been added to the channel
    • Check bot permissions include required scopes
  3. Notion "database not found" errors

    • Verify database has been shared with your integration
    • Check database ID is correct
    • Ensure you have the right permissions
  4. Jira authentication errors

    • Verify API token is valid and not expired
    • Check email address matches your Jira account
    • Ensure Jira URL format is correct

Debug Mode

To enable more detailed logging, modify the Flask app startup:

app.run(host="0.0.0.0", port=3000, debug=True)

About

This is MCP Server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages