LangGraph
Connect a LangGraph agent with LangChain MCP
LangGraph agents can use LangChain tools. In langchain[mcp] 1.4.0, MCPAdapter discovers a remote server and adapts its tools for create_agent and graph workflows.
Prerequisites
From setup to the first capture
- Python with langchain[mcp]>=1.4.0
- GRABBIT_API_KEY set by a secret manager
- LANGCHAIN_MODEL plus its provider package and credential, such as langchain-anthropic and ANTHROPIC_API_KEY
# pip install "langchain[mcp]==1.4.0" fastmcp langchain-anthropic
import asyncio
import os
from fastmcp.client import Client
from langchain.agents import create_agent
from langchain.mcp import MCPAdapter
async def run():
client = Client(
"https://mcp.grabbit.live",
auth=os.environ["GRABBIT_API_KEY"],
)
async with MCPAdapter(client) as adapter:
tools = await adapter.list_tools()
agent = create_agent(os.environ["LANGCHAIN_MODEL"], tools)
return await agent.ainvoke({
"messages": [{
"role": "user",
"content": "Capture https://example.com and return the screenshot URL with a short visual QA report.",
}]
})
print(asyncio.run(run()))FastMCP accepts a bearer-token string through Client(auth=...). It also supports auth="oauth" for a full OAuth 2.1 flow.
A test key returns a placeholder for wiring. The visual check below requires a live key and available credits. Call get_usage before a run when the agent needs to avoid an HTTP 402 interruption.
Call grab and inspect the result
Capture https://example.com and return the screenshot URL with a short visual QA report.Expected result
MCPAdapter discovers Grabbit tools as LangChain tools. The agent can call grab and receive the capture record plus image result.
Image handling
The result can carry standard image content. Keep image_url in state when downstream nodes or models do not accept an image block.

Troubleshooting
401 or authentication required
Complete the client OAuth flow, or check that the environment variable contains a current sk_ key.
The target URL is rejected
Use a public HTTP or HTTPS URL. Grabbit blocks localhost, private, link-local, and internal network targets.
The image is a placeholder
An sk_test_ key proves the integration without spending credits. Use an sk_live_ key when you need a real render.
402 credits_exhausted
Call get_usage, then add a separately purchased top-up or wait for the next annual subscription grant before retrying.
Security note
The langchain.mcp namespace is beta and raises LangChainBetaWarning. Pin the tested version and review release notes before upgrades.
Hosted screenshots without a browser in the agent runtime
A local headless browser means installing Chromium, keeping its dependencies current, bounding memory use, and handling timeouts. Grabbit runs the screenshot step on hosted rendering infrastructure and returns an image URL.
Local headless browser
- Needs Chromium installed in the agent's runtime
- Cookie and consent handling belongs to your automation
- You own the timeouts, retries, and scaling
- Breaks in CI, sandboxes, and remote runners with no browser
Grabbit
- One call, nothing to install or run
- Dismisses cookie and consent banners automatically
- Handles lazy-loaded, JavaScript-heavy, and full-page captures
- Runs from CI or sandboxes without a local browser install
Grabbit accepts public pages and supports cookie-banner handling, delayed JavaScript, selector targeting, and full-page output. Target sites can still reject automated traffic, and private or internal addresses are blocked.
Flat pricing, built for agents that loop
When an agent captures a page on every step, per-call metering turns into anxiety. Grabbit is one flat rate: $50 per year for 25,000 captures ($0.002 each). Annual subscription credits expire at term end; separately purchased top-ups do not expire while your account remains active. Test-environment keys render placeholders for integration checks. A real page capture needs a live key and available credits.
LangGraph FAQ
- Is this a native LangGraph MCP client?
- The supported path is LangChain MCPAdapter, whose tools can be used by agents and graph nodes. The namespace is beta in version 1.4.0.
- Can I use OAuth instead of a key?
- Yes. FastMCP accepts auth="oauth" and runs OAuth 2.1 discovery, dynamic client registration, redirect, and token exchange.
Give LangGraph eyes in two minutes
Free wiring test, one install, then your agent can screenshot public pages with a live key.