Skip to main content

Python SDK for interacting with the Toolbox service with LangChain

Project description

MCP Toolbox Logo

MCP Toolbox LangChain SDK

This SDK allows you to seamlessly integrate the functionalities of MCP Toolbox into your LangChain GenAI applications, enabling advanced orchestration and interaction with LLMs.

For detailed guides, authentication examples, and advanced configuration, visit the Python SDK Langchain Guide.

Table of Contents

Installation

pip install toolbox-langchain

Quickstart

Here's a minimal example to get you started using LangGraph:

from toolbox_langchain import ToolboxClient
from langchain_google_vertexai import ChatVertexAI
from langgraph.prebuilt import create_react_agent

async with ToolboxClient("http://127.0.0.1:5000") as toolbox:
    tools = toolbox.load_toolset()

    model = ChatVertexAI(model="gemini-3-flash-preview")
    agent = create_react_agent(model, tools)

    prompt = "How's the weather today?"

    for s in agent.stream({"messages": [("user", prompt)]}, stream_mode="values"):
        message = s["messages"][-1]
        if isinstance(message, tuple):
            print(message)
        else:
            message.pretty_print()

Usage

The toolbox-langchain package provids a dedicated integration to seamlessly load and use MCP Toolbox tools within the LangChain orchestration framework. For detailed guides and advanced configuration, please visit the following sections on our Documentation Site:

Contributing

Contributions are welcome! Please refer to the DEVELOPER.md file for guidelines on how to set up a development environment and run tests.

License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.

Support

If you encounter issues or have questions, check the existing GitHub Issues for the main Toolbox project.

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

toolbox_langchain-1.0.0.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

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

toolbox_langchain-1.0.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file toolbox_langchain-1.0.0.tar.gz.

File metadata

  • Download URL: toolbox_langchain-1.0.0.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for toolbox_langchain-1.0.0.tar.gz
Algorithm Hash digest
SHA256 06c0174a3e9b15a191c29bdfbf1c4b0a11dcc697786c5d47cca8091196eec1b3
MD5 0bc4df699d572a04857bc519b8ea1ba0
BLAKE2b-256 89b7e0cabb3e0dc849e2a6974584d8e3eabf7f596440a276956bc5d5bb31afa2

See more details on using hashes here.

Provenance

The following attestation bundles were made for toolbox_langchain-1.0.0.tar.gz:

Publisher: google-cloud-sdk-py@oss-exit-gate-prod.iam.gserviceaccount.com

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.
  • Statement: Publication detail:
    • Token Issuer: https://accounts.google.com
    • Service Account: google-cloud-sdk-py@oss-exit-gate-prod.iam.gserviceaccount.com

File details

Details for the file toolbox_langchain-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for toolbox_langchain-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ac07aeff3faee92ab2601c309058fed71fab1c1ff5ec27a31403c151e276de2
MD5 7a04d9ec67e1f4d8a7bbeada92d433cb
BLAKE2b-256 599624f40ddec99e0c4cc97829b79e362ed82f7a48aeecf137fe67384aa43080

See more details on using hashes here.

Provenance

The following attestation bundles were made for toolbox_langchain-1.0.0-py3-none-any.whl:

Publisher: google-cloud-sdk-py@oss-exit-gate-prod.iam.gserviceaccount.com

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.
  • Statement: Publication detail:
    • Token Issuer: https://accounts.google.com
    • Service Account: google-cloud-sdk-py@oss-exit-gate-prod.iam.gserviceaccount.com

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