langchain-toolstem
LangChain tools wrapping Toolstem MCP servers (Finance + SEC EDGAR) with x402 USDC micropayments — Python edition.
| Surface | Tools | Endpoint |
|---|---|---|
| Finance | get_stock_snapshot, get_company_metrics, compare_companies |
https://mcp.toolstem.com/mcp/finance |
| SEC EDGAR | get_company_filings_summary, get_insider_signal, get_institutional_signal, get_material_events_digest, compare_disclosure_signals |
https://mcp.toolstem.com/mcp/sec |
initialize and tools/list are free. Each tools/call costs $0.01 USDC on Base mainnet.
TypeScript sibling: langchain-toolstem
Install
pip install langchain-toolstem
With x402 payment support:
pip install 'langchain-toolstem[x402]'
Quick Start
Free Discovery (no wallet needed)
from langchain_toolstem import create_finance_tools, create_sec_tools
# List available tools — free, no payment required
finance_tools = await create_finance_tools()
sec_tools = await create_sec_tools()
for t in finance_tools + sec_tools:
print(f"{t.name}: {t.description[:80]}")
Paid Tool Calls (with wallet)
from langchain_toolstem import create_finance_tools, create_x402_httpx_client
# Create a paying HTTP client (needs USDC on Base mainnet)
client = await create_x402_httpx_client("0xYOUR_PRIVATE_KEY")
# Tools automatically pay 0.01 USDC per call
tools = await create_finance_tools(http_client=client)
result = await tools[0].ainvoke({"symbol": "AAPL"})
print(result)
With LangGraph Agent
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent
from langchain_toolstem import create_finance_tools, create_x402_httpx_client
client = await create_x402_httpx_client(os.environ["X402_PRIVATE_KEY"])
tools = await create_finance_tools(http_client=client)
agent = create_react_agent(ChatOpenAI(model="gpt-4o"), tools)
result = await agent.ainvoke({
"messages": [{"role": "user", "content": "Analyze NVDA stock"}]
})
API Reference
create_finance_tools(**kwargs) -> list[StructuredTool]
Discover and return the 3 Finance tools.
create_sec_tools(**kwargs) -> list[StructuredTool]
Discover and return the 5 SEC EDGAR tools.
create_x402_httpx_client(private_key, *, max_payment_usd=1.0) -> httpx.AsyncClient
Create an httpx.AsyncClient that auto-pays x402 USDC micropayments on HTTP 402.
discover_toolstem_tools(url, **kwargs) -> list[StructuredTool]
Low-level: connect to any Toolstem MCP endpoint and return LangChain tools.
Common kwargs for all functions:
| Parameter | Type | Default | Description |
|---|---|---|---|
http_client |
httpx.AsyncClient |
None |
Paying client from create_x402_httpx_client |
headers |
dict[str, str] |
None |
Extra headers for every request |
url |
str |
endpoint default | Override the MCP endpoint URL |
Network Details
| Field | Value |
|---|---|
| Chain | Base mainnet (eip155:8453) |
| Token | USDC |
| Contract | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
| Price per call | $0.01 |
| Wallets | Any EVM wallet (Coinbase Smart Wallet, MetaMask, etc.) |
Walletless Playground
Try the tools without a wallet at toolstem.com/playground — real, cached responses, no payment required.
Development
git clone https://github.com/toolstem/langchain-toolstem-python
cd langchain-toolstem-python
pip install -e '.[dev]'
pytest
Publishing to PyPI
This package uses PyPI Trusted Publishing (OIDC) — no API tokens needed.
One-time setup:
- Go to pypi.org/manage/account/publishing
- Add a new pending publisher:
- PyPI project name:
langchain-toolstem - Owner:
toolstem - Repository:
langchain-toolstem-python - Workflow:
publish.yml - Environment:
pypi
- PyPI project name:
- Tag a release:
git tag v0.1.0 && git push origin v0.1.0 - GitHub Actions will build and publish automatically.
License
MIT
Metadata
Release files for langchain-toolstem 0.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 | |
|---|---|---|---|---|
| langchain_toolstem-0.1.0.tar.gz | 12.1 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_toolstem-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.2 kB
Release files / langchain_toolstem-0.1.0.tar.gz
| Download URL | langchain_toolstem-0.1.0.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6fb00e0fa45db2eb1eb30b2ec12897389852d48322ec97cd0c0d0e05a95d6eea
|
|
BLAKE2b-256 checksum How to use checksums |
398612470df8e2ef808baf3bb6c0a068505917dba27040ed199e67dda908da04
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 4, 2026.
Transparency logRelease files / langchain_toolstem-0.1.0-py3-none-any.whl
| Download URL | langchain_toolstem-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a8a3b1d867773d817a96d240950bc509c6b18fdbf16b8b1d75da1db32a95a7e9
|
|
BLAKE2b-256 checksum How to use checksums |
43b299a17ccead44948395143a95808bc276e6472c809568b5f38301a0e9340d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 4, 2026.
Transparency logSecurity for langchain-toolstem 0.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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for langchain_toolstem-0.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 Jun 4, 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.