Skip to main content

Model Context Protocol tool calling support for LangChain

Project description

langchain-mcp

PyPI - Version

Model Context Protocol tool calling support in LangChain.

Create a langchain_mcp.MCPToolkit with an mcp.ClientSession, then await toolkit.initialize() and toolkit.get_tools() to get the list of langchain_core.tools.BaseTools.

Example:

https://github.com/rectalogic/langchain-mcp/blob/8fa8445a24755bf91789f52718c32361ed916f46/tests/demo.py#L34-L43

Demo

You can run the demo against Groq llama-3.1-8b-instant:

$ export GROQ_API_KEY=xxx
$ uv run tests/demo.py "Read and summarize the file ./LICENSE"
Secure MCP Filesystem Server running on stdio
Allowed directories: [ '/users/aw/projects/rectalogic/langchain-mcp' ]
The file ./LICENSE is a MIT License agreement. It states that the software is provided "as is" without warranty and that the authors and copyright holders are not liable for any claims, damages, or other liability arising from the software or its use.

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

langchain_mcp-0.1.0.tar.gz (48.4 kB view details)

Uploaded Source

Built Distribution

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

langchain_mcp-0.1.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file langchain_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: langchain_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 48.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for langchain_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3a0ab6dc4d846dcc37a0866c9f0ac23a4e758706bef83ab122d62e3e2faab9cb
MD5 b0ee94cf48023a45f3162015536fc12d
BLAKE2b-256 704e86566ba914b7816f0a87cbf70444c0969e4b901291e1f4e472229f4d67c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_mcp-0.1.0.tar.gz:

Publisher: publish.yml on rectalogic/langchain-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file langchain_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: langchain_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for langchain_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8102e04b9b0d6e9186e3fd715f2873cb486ad809ebdad49cc55b1214a7d62dfb
MD5 5a1136c8f67f87634b1e9e1d9a783e2e
BLAKE2b-256 0e3afced061a0c27ebf81b85cd849695610b53c78eef98ed9d3cbfb7bec9c755

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_mcp-0.1.0-py3-none-any.whl:

Publisher: publish.yml on rectalogic/langchain-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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