Skip to main content

MCP-Bastion security middleware integration for LangChain - prompt injection, PII, and rate-limit protection for LLM agents

Project description

mcp-bastion-langchain

Security middleware for LangChain powered by MCP-Bastion.

Protects your LangChain agents from prompt injection, PII leakage, and resource exhaustion.

Install

pip install mcp-bastion-langchain

Usage

Callback (automatic protection)

from langchain_openai import ChatOpenAI
from mcp_bastion_langchain import BastionSecurityCallback

llm = ChatOpenAI(callbacks=[BastionSecurityCallback()])
llm.invoke("Hello, what is MCP?")

Tool decorator

from mcp_bastion_langchain import secure_tool

@secure_tool
def my_tool(query: str) -> str:
    return f"Result for {query}"

Features

  • Content filtering on all LLM prompts and tool inputs
  • Rate limiting per caller
  • Prompt injection detection
  • PII redaction

License

Same terms as the MCP-Bastion project: see LICENSE. Non-commercial use is free with required citation/attribution; copyright terms apply. Commercial use as defined in the License may need a separate agreement (COMMERCIAL_LICENSE.md).

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

mcp_bastion_langchain-3.1.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

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

mcp_bastion_langchain-3.1.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file mcp_bastion_langchain-3.1.0.tar.gz.

File metadata

  • Download URL: mcp_bastion_langchain-3.1.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mcp_bastion_langchain-3.1.0.tar.gz
Algorithm Hash digest
SHA256 7eb9fd3d674b1d61d02a08bdaafa00c3a8a69af35cddedf711040820c90e700a
MD5 ef5e93c66fa76939a19dabfae7908f25
BLAKE2b-256 6baee12d53ec035a2870203d60f0a23fdf1d97ee8a4a0295f68c649bd6971124

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_bastion_langchain-3.1.0.tar.gz:

Publisher: publish-integrations.yml on vaquarkhan/MCP-Bastion

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

File details

Details for the file mcp_bastion_langchain-3.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_bastion_langchain-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c3ecb2e7ec9995944c296827c62b666fa61af96ef4baef3af0209fee34749c93
MD5 b98d6904851512a0b82d3d4c611994a2
BLAKE2b-256 f94cae124015da52bf6da1df0a2dfd842388204f18ef42195d475300ed6c4065

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_bastion_langchain-3.1.0-py3-none-any.whl:

Publisher: publish-integrations.yml on vaquarkhan/MCP-Bastion

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