Skip to main content

help with connection details

Project description

Upload Python Package Latest Release CurrentLocal

ConnectionVault

    pip install connectionvault
    connectionvault --help

Note

  • version 2.0.0 Tested for postgres, sql server and mysql db
  • version 2.1.1 Easier execution code, mysql db inetgrated, ReadMe updated with MCP inetgration
  • version 2.2.0 Test connection from CLI {ex - connectionvault --test config_name}
  • verson 2.2.1 OPtion 3 Display Conn hides Pass and present Tabular Data {ex - connectionvault --connections - [3] Display Connections

Purpose

The purpose of this project is to centralize the database connections (credentials and other connections details) file (as YAML) on a user's machine.

Running the Project : Pre-requisites

  1. Create empty file ~ connections.yaml on a location of your choice.
  2. Save that location as varibale path with name conn_home.
  3. Steps defined below as how to setup varibale on Windows and Linux

For Windows (CMD):

# Define and save the path
setx conn_home "C:\path\outside\your\project\preferably"

# Check the path
echo %conn_home%

# Define and save the path
setx conn_home "C:\path\outside\your\project\preferably"

# Check the path
echo %conn_home%

For Windows Powershell:

# Define and save the path
[System.Environment]::SetEnvironmentVariable('conn_home', 'C:\path\outside\your\project\preferably', 'User')

# Check the path
$env:conn_home

For Linux:

# Define and save the path in your .bashrc
echo 'export conn_home="path/outside/your/project/preferably"' >> ~/.bashrc

# Source the .bashrc to apply changes
source ~/.bashrc

Usage Examples:

From CLI run

connectionvault --example

MCP Integration:

On a MAchine where you have your Database running and want to spin MCP server, follow below steps:

  1. Create project for MCP server

  2. Install "connectionvault", "fastmcp"

  3. Run a MCP server with a code like below

    from mcp.server.fastmcp.server import FastMCP 
    from src.main_call import return_string
    
    mcp = FastMCP("connections", log_level="ERROR")
    
    @mcp.prompt()
    def connections_prompt():
        return """
        You are interacting with a connections service that calls the 'connections' tool with a single parameter: req_string (string).
        this function when called returns a database connection string based on a match it finds on 'req_string' in a secure database credentials configuration file.
        """
    
    @mcp.resource("resource://empty")
    def empty_resource():
        return None  # Returns an empty resource
    
    
    @mcp.tool()
    def connections(req_string: str) -> str:
        db_config = return_string(req_string)  
        return db_config
    
    if __name__ == "__main__":
        mcp.run(transport='stdio')
    

UML's

    pyreverse -o png -p myUML .
    or
    app\src> code2flow -o output.png cli.py connection_manager.py connection_utility.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

connectionvault-2.2.1.tar.gz (65.0 kB view details)

Uploaded Source

Built Distribution

connectionvault-2.2.1-py3-none-any.whl (64.9 kB view details)

Uploaded Python 3

File details

Details for the file connectionvault-2.2.1.tar.gz.

File metadata

  • Download URL: connectionvault-2.2.1.tar.gz
  • Upload date:
  • Size: 65.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for connectionvault-2.2.1.tar.gz
Algorithm Hash digest
SHA256 9aecb68cfbc6e0e32f4ca911a13d63a3413b4aa81516b74e56caf66317e149a3
MD5 f5405c0f21f35c4dc1a37e3b0593dfa3
BLAKE2b-256 3c60582c3468a2dddc6370d0b4f6349c93d307bcf74bcdfde526a33d91020e3f

See more details on using hashes here.

File details

Details for the file connectionvault-2.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for connectionvault-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ec376a178fcf9bcb680ea17eba95dd2e40636f2a5d0286b60fd4c66f22e62890
MD5 cf541e787630f43a6b8ef3a3b7bb1a2c
BLAKE2b-256 4555afc3ce92ab48e7cc4a9f972b3aaadacc02a9e4c1d825a818abb38adc4b4a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page