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
Licensed under the Apache License 2.0. Commercial and non-commercial use are both permitted.
Metadata
Release files for mcp-bastion-langchain 4.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mcp_bastion_langchain-4.1.0.tar.gz | 3.0 kB | With provenance | Details for mcp_bastion_langchain-4.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcp_bastion_langchain-4.1.0-py3-none-any.whl | Python 3 | none | any | Details for mcp_bastion_langchain-4.1.0-py3-none-any.whl |
Total release size: 6.4 kB
Release files / mcp_bastion_langchain-4.1.0.tar.gz
| Download URL | mcp_bastion_langchain-4.1.0.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
35ddebe5c9a3889a1a4979ffc13df4ab43c8601b2ce477a0040abedba0ad0975
|
|
BLAKE2b-256 checksum How to use checksums |
a89162fd2b00c198296e8c023665e769f1141e1bbf8e49048e7ea7da54c3bc2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.
Transparency logRelease files / mcp_bastion_langchain-4.1.0-py3-none-any.whl
| Download URL | mcp_bastion_langchain-4.1.0-py3-none-any.whl |
|---|---|
| Size | 3.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6e1dcfbf076c35550be5b4bd1c63c38746cf69002bd694ec14e7441fdfad668b
|
|
BLAKE2b-256 checksum How to use checksums |
d87dabb5e0bae26332372d0722e6d0476dcb47cff0a4e0bb58b2db18021d563f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.
Transparency logSecurity for mcp-bastion-langchain 4.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mcp_bastion_langchain-4.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.