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.1.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.1-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: toolbox_langchain-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 74be1de530049bd2465d23af320d5cf30e1c8d3fb0ae740a6528080e8e5b2a48
MD5 22b7b38f3df2d3cd9115874383dce776
BLAKE2b-256 9d9a4792fe64d5389ad5be98be63ecfcc84368182fe82cca77d5d30717fe6f2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for toolbox_langchain-1.0.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for toolbox_langchain-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7b33acb1a84d1aab8b55f6cc4d00c825144ce5d62060c8d160fbf6366671a8df
MD5 23e43a0161ea85a5a36bff6356216b10
BLAKE2b-256 14fd637294e34e112ac3cee885a5b80ca097f770fa15274e07e735192139e320

See more details on using hashes here.

Provenance

The following attestation bundles were made for toolbox_langchain-1.0.1-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