Metadata-Version: 2.5
Name: langchain-protogrid
Version: 0.1.1
Summary: LangChain tools from the protogrid MCP registry: find MCP servers by what they do, gate them on your rules, and load the tools of the ones that pass.
Project-URL: Homepage, https://protogrid.dev
Project-URL: Documentation, https://docs.protogrid.dev/sdk/langchain/
Project-URL: Repository, https://github.com/protogrid-dev/sdk
License-Expression: MIT
License-File: LICENSE
Keywords: agents,langchain,mcp,model-context-protocol,registry,tools
Requires-Python: >=3.11
Requires-Dist: langchain-core>=1.8
Requires-Dist: langchain[mcp]>=1.5
Requires-Dist: protogrid-sdk>=0.4.5
Description-Content-Type: text/markdown

# langchain-protogrid

LangChain tools from the [protogrid](https://protogrid.dev) MCP registry: find MCP servers by what they do, check them against your rules, and give your agent the tools of the ones that pass.

```bash
pip install langchain-protogrid
```

```python
from langchain.agents import create_agent
from langchain_protogrid import Rules, load_tools

tools = await load_tools(
    "send an email",
    rules=Rules(min_quality=70),          # also refuses hidden text, tool poisoning and known vulnerabilities
    secrets={"api_key": os.environ["MAIL_API_KEY"]},
)
agent = create_agent(model="anthropic:claude-sonnet-5", tools=tools)
```

- `load_tools` tries the best search results (or the `servers` you name) in order. Each goes through protogrid's gate with your rules; one that passes is connected to directly, with no proxy, and its tools come back named `<server key>_<tool>`.
- Secrets fill the `${NAME}` placeholders of the server's connection in your process; they are never sent to protogrid. A server needing a secret you did not give is passed over.
- Rules are yours, not the model's. `Rules(paid=False)` also refuses servers that charge per call (x402). The defaults refuse tools that hide text from people, tools holding instructions aimed at the model, and servers with a known vulnerability in their dependencies. Local packages are never loaded.
- `pins={"io.github.owner/server": "<tools_hash>"}` passes over a server whose checked tools changed since you reviewed them; `strict_tools=True` also compares the tools the server lists right now with the ones protogrid checked.
- `ProtogridSearch()` and `ProtogridGate(rules=...)` let the agent look for servers and check one itself.

Python 3.11 or later. MCP support comes from `langchain[mcp]` (`langchain.mcp`, in beta upstream). Full guide: [docs.protogrid.dev/sdk/langchain](https://docs.protogrid.dev/sdk/langchain/).

MIT licensed.
