Skip to main content

A custom MCP Client for Quantalogic

Project description

🛠️ QuantaLogic MCP Toolbox

A generic adapter for interacting with one or more MCP servers via JSON-based configuration, with automatic tool discovery, caching, and session management.


PyPI Version License: MIT


📋 Table of Contents

  1. Installation
  2. Configuration
  3. Quickstart Example
  4. Architecture
  5. API Reference
  6. Contributing
  7. License

🚀 Installation

Install from PyPI:

pip install quantalogic-toolbox-mcp

Or with Poetry:

poetry add quantalogic-toolbox-mcp

⚙️ Configuration

By default, the toolbox reads JSON files from ./mcp_config/ or the directory set by MCP_CONFIG_DIR. You can also specify a single file via the MCP_CONFIG_FILE environment variable.

Create a config file (mcp.json) in mcp_config/ with the following structure:

{
  "mcpServers": {
    "sqlite": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-v",
        "mcp-test:/mcp",
        "mcp/sqlite",
        "--db-path",
        "/mcp/test.db"
      ]
    },
    "mcp_hn": {
      "command": "uvx",
      "args": ["mcp-hn"]
    },
    "fetcher": {
      "command": "npx",
      "args": ["-y", "fetcher-mcp"]
    },
    "job_search": {
      "command": "npx",
      "args": ["-y", "job-searchoor"]
    },
    "edgeone": {
      "command": "npx",
      "args": ["edgeone-pages-mcp"]
    }
  }
}
  • command: Executable or Docker alias
  • args: Argument list to launch the server

Environment variables in env entries can use {{ env.VAR_NAME }} and will be resolved at runtime.


🏃 Quickstart Example

from quantalogic_toolbox_mcp.tools import get_tools
import asyncio

async def main():
    # Discover core and dynamic tools
    tools = get_tools()

    # List configured servers
    from quantalogic_toolbox_mcp.tools import list_servers
    servers = await list_servers()
    print("Servers:", servers)

    # List tools on a server
    resources = await tools[0]('sqlite')  # mcp_list_tools
    print("Tools on sqlite:", resources)

    # Call a specific tool dynamically
    dynamic = [t for t in tools if hasattr(t, 'server_name') and t.server_name == 'sqlite'][0]
    result = await dynamic(input_file="/mcp/test.db")
    print("Result:", result)

asyncio.run(main())

🏛️ Architecture

%%{init: { 'theme': 'base', 'themeVariables': { 
    'primaryColor': '#A3C9E2', 
    'secondaryColor': '#B7E3CC', 
    'tertiaryColor': '#F9E0BB', 
    'lineColor': '#B5B5B5', 
    'fontFamily': 'Inter, Arial, sans-serif'
} }}%%
flowchart TD
    A[Load JSON configs] --> B{Cache valid?}
    B -- Yes --> C[Load servers & tools from cache]
    B -- No  --> D[Read & resolve configs]
    D --> E[Fetch tool lists & details]
    C & E --> F[Populate `tools_cache`]
    F --> G["get_tools()"]
    G --> H[Execute core or dynamic tools]
    H --> I[Parse & return results]

📖 API Reference

  • get_tools()List[Callable]

    • Returns core functions and dynamic tool wrappers.
  • mcp_list_resources(server_name: str)List[str]

  • mcp_list_tools(server_name: str)List[str]

  • mcp_call_tool(server_name: str, tool_name: str, arguments: dict)Any

  • list_servers()List[str]

For full signatures and details, refer to toolboxes/quantalogic-toolbox-mcp/quantalogic_toolbox_mcp/tools.py.


🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add tests in tests/
  4. Run pytest and ruff .
  5. Submit a pull request against main

Please see CONTRIBUTING.md for more details.


📜 License

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

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

quantalogic_toolbox_mcp-0.13.0.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quantalogic_toolbox_mcp-0.13.0-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file quantalogic_toolbox_mcp-0.13.0.tar.gz.

File metadata

  • Download URL: quantalogic_toolbox_mcp-0.13.0.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.8 Darwin/24.4.0

File hashes

Hashes for quantalogic_toolbox_mcp-0.13.0.tar.gz
Algorithm Hash digest
SHA256 568a142b3039c999ff5bb70780a6a26050b5a31647d1aee7696b7d5f7db37a4e
MD5 5fb1af849a70c30139ecf8170bd69c0a
BLAKE2b-256 85cab840e86b2d9f9e218a4722d5dc112fa8a3e0ba2baa6cb1e75331a291dfb3

See more details on using hashes here.

File details

Details for the file quantalogic_toolbox_mcp-0.13.0-py3-none-any.whl.

File metadata

File hashes

Hashes for quantalogic_toolbox_mcp-0.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b7a7634c8164b5d080ee6ec7930afa986ae73d0ace1dc16caffa87b178296eea
MD5 ddcaa37a6a9766a39db89818305e5cad
BLAKE2b-256 8a800fa61a5b5c195671e7a865708d49b6699803da27e08fbc20a34550a05730

See more details on using hashes here.

Supported by

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