Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1,092 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Pursuit MCP Client

A Python client for connecting to Model Context Protocol (MCP) servers, with built-in support for Slack, Salesforce, and Google Drive integrations.

๐Ÿš€ Features

  • Multi-Service Support: Connect to Slack, Salesforce, and Google Drive through MCP servers
  • Unified Interface: Single client to manage all your service connections
  • Async/Await Support: Built with modern Python async patterns
  • Transport Flexibility: Supports WebSocket and stdio transports
  • Authentication Handling: Built-in OAuth and API key management
  • Error Handling: Robust error handling with fallback mechanisms
  • Type Safety: Full type hints and Pydantic models

๐Ÿ“ฆ Installation

  1. Clone the repository:
git clone <repository-url>
cd pursuit-mcp-client
  1. Install dependencies:
pip install -r requirements.txt

Or install in development mode:

pip install -e .

โš™๏ธ Configuration

  1. Copy the environment template:
cp .env.example .env
  1. Fill in your credentials in .env:

Slack Configuration

SLACK_BOT_TOKEN=xoxb-your-slack-bot-token
SLACK_TEAM_ID=your-slack-team-id

Salesforce Configuration

SALESFORCE_USERNAME=your-salesforce-username
SALESFORCE_PASSWORD=your-salesforce-password
SALESFORCE_SECURITY_TOKEN=your-security-token
SALESFORCE_DOMAIN=login  # or test for sandbox

Google Drive Configuration

GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
GOOGLE_REDIRECT_URI=http://localhost:8080/callback

๐ŸŽฏ Quick Start

Basic Usage

import asyncio
from mcp_client import UnifiedMCPClient

async def main():
    client = UnifiedMCPClient()
    
    try:
        # Connect to services
        slack = await client.connect_slack("ws://localhost:8001/mcp/slack")
        salesforce = await client.connect_salesforce("ws://localhost:8002/mcp/salesforce")
        gdrive = await client.connect_google_drive("ws://localhost:8003/mcp/gdrive")
        
        # Use the services
        channels = await slack.get_channels()
        accounts = await salesforce.query("SELECT Id, Name FROM Account LIMIT 5")
        files = await gdrive.list_files(page_size=10)
        
        print(f"Found {len(channels)} Slack channels")
        print(f"Found {accounts['totalSize']} Salesforce accounts")
        print(f"Found {len(files['files'])} Google Drive files")
        
    finally:
        await client.disconnect_all()

asyncio.run(main())

Service-Specific Usage

Slack

# Connect to Slack
slack = await client.connect_slack("stdio")

# Post a message
await slack.post_message("#general", "Hello from MCP Client! ๐Ÿค–")

# Get channels
channels = await slack.get_channels(limit=10)

# Search messages
results = await slack.search_messages("important", count=20)

Salesforce

# Connect to Salesforce
salesforce = await client.connect_salesforce("stdio")

# Query records
accounts = await salesforce.query("SELECT Id, Name FROM Account LIMIT 10")

# Create a record
new_account = await salesforce.create_record("Account", {
    "Name": "Test Account",
    "Type": "Prospect"
})

# Update a record
await salesforce.update_record("Account", account_id, {
    "Description": "Updated via MCP"
})

Google Drive

# Connect to Google Drive
gdrive = await client.connect_google_drive("stdio")

# List files
files = await gdrive.list_files(page_size=20)

# Upload a file
await gdrive.upload_file(
    name="test.txt",
    content=b"Hello, world!",
    mime_type="text/plain"
)

# Create a folder
folder = await gdrive.create_folder("My New Folder")

๐Ÿ“ Project Structure

pursuit-mcp-client/
โ”œโ”€โ”€ mcp_client/
โ”‚   โ”œโ”€โ”€ __init__.py          # Main exports
โ”‚   โ”œโ”€โ”€ client.py            # Core MCP client
โ”‚   โ”œโ”€โ”€ transport.py         # Transport layer (WebSocket, stdio)
โ”‚   โ”œโ”€โ”€ types.py             # Type definitions
โ”‚   โ”œโ”€โ”€ unified_client.py    # Unified client interface
โ”‚   โ””โ”€โ”€ services/
โ”‚       โ”œโ”€โ”€ __init__.py
โ”‚       โ”œโ”€โ”€ base.py          # Base service class
โ”‚       โ”œโ”€โ”€ slack.py         # Slack integration
โ”‚       โ”œโ”€โ”€ salesforce.py    # Salesforce integration
โ”‚       โ””โ”€โ”€ google_drive.py  # Google Drive integration
โ”œโ”€โ”€ examples/
โ”‚   โ”œโ”€โ”€ basic_usage.py       # Basic usage example
โ”‚   โ”œโ”€โ”€ slack_example.py     # Slack-specific example
โ”‚   โ”œโ”€โ”€ salesforce_example.py # Salesforce-specific example
โ”‚   โ””โ”€โ”€ google_drive_example.py # Google Drive-specific example
โ”œโ”€โ”€ config/
โ”‚   โ””โ”€โ”€ mcp_servers.json     # MCP server configurations
โ”œโ”€โ”€ requirements.txt         # Python dependencies
โ”œโ”€โ”€ pyproject.toml          # Project configuration
โ””โ”€โ”€ README.md               # This file

๐Ÿ”ง MCP Server Setup

This client requires MCP servers to be running for each service. You can:

  1. Use existing MCP servers:

  2. Run servers locally using the provided configurations in config/mcp_servers.json

  3. Use stdio transport if you have command-line MCP tools

๐Ÿงช Examples

Run the example scripts to see the client in action:

# Basic usage with all services
python examples/basic_usage.py

# Service-specific examples
python examples/slack_example.py
python examples/salesforce_example.py
python examples/google_drive_example.py

๐Ÿ› ๏ธ Development

Setting up for Development

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black mcp_client/

# Type checking
mypy mcp_client/

Transport Options

The client supports multiple transport mechanisms:

  1. WebSocket: ws://localhost:8001/mcp/service
  2. Stdio: "stdio" (for command-line MCP tools)
  3. Custom Transport: Implement the Transport interface

๐Ÿ” Authentication

Slack

  • Create a Slack app at https://api.slack.com/apps
  • Add bot scopes: chat:write, channels:read, users:read, etc.
  • Install the app to your workspace
  • Copy the Bot User OAuth Token

Salesforce

  • Use your Salesforce username and password
  • Generate a security token from Setup > Personal Information > Reset Security Token
  • For sandbox, use test.salesforce.com as domain

Google Drive

  • Create a project in Google Cloud Console
  • Enable the Google Drive API
  • Create OAuth 2.0 credentials
  • Download the credentials file or use client ID/secret

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Run the test suite
  6. Submit a pull request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ†˜ Support

For issues and questions:

  1. Check the examples directory
  2. Review the configuration files
  3. Open an issue on GitHub

๐Ÿ”ฎ Roadmap

  • Add more service integrations (Teams, Discord, etc.)
  • Implement connection pooling
  • Add retry mechanisms with exponential backoff
  • Create a web UI for configuration
  • Add comprehensive logging
  • Support for MCP server discovery
  • Plugin architecture for custom services

Happy coding! ๐Ÿš€

About

Financial forecasting solution integrating Salesforce and Sage Intacct for sales pipeline visibility and payment tracking

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages