Pythonic MCP client
Project description
MCPager 📟
A lightweight synchronous client for Model Context Protocol (MCP) servers
MCPager is a small, fast, and predictable Python client for interacting with Model Context Protocol (MCP) servers.
It is designed for independent AI developers who want to connect tools, agents, and LLMs to MCP backends without asyncio, event loops, or framework lock-in.
MCPager acts like a pager: it sends a request, waits for a response, and delivers it reliably — whether the MCP server is running over stdio, HTTP, or streaming (SSE).
Why MCPager?
Most MCP client libraries today are:
- deeply async,
- tightly coupled to one agentic framework, if any (e.g. LangChain),
- or built around complex lifecycle management.
MCPager takes a different approach:
Simple. Synchronous. Composable.
- No
asyncio - No background event loops
- Provides abstract adapter for an agentic implementation of your choice (although a concrete LangChain adapter also available out of the box)
- Designed for tool-calling agents
Features
- 🧠 Session-based MCP protocol
- 🔌 Multiple transports
stdio(local processes)http(FastMCP, remote servers)text/event-stream(SSE / streaming MCP)
- 🧰 Tool discovery & invocation
- 🧩 LangGraph & LangChain integration
- 🧵 Thread-safe synchronous request handling
- 🔍 Built-in JSON-RPC and session ID management
Installation
pip install mcpager
Quick Example
- Start an MCP server
For example, using FastMCP:
fastmcp run examples/echo_server.py --transport http
- Connect using MCPager
from mcpager.client import StdioTransport, HttpTransport, Session, MCPClient
from mcpager.adapters import LangGraphBackend
transport = HttpTransport('http://localhost:8000/mcp')
# or you can use StdioTransport for local testing like this:
# transport = StdioTransport(["fastmcp", "run", "echo_server.py"])
session = Session(transport)
backend = LangGraphBackend()
client = MCPClient(backend, session)
client.initialize()
tools = client.list_tools()
print(tools)
result = client.call_tool("echo", text="Hello from MCPager!")
print(result)
Using MCPager with LangGraph
MCPager can expose MCP tools directly to LangGraph agents.
from langgraph.prebuilt import create_react_agent
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="gpt-4o-mini")
agent = create_react_agent(llm, tools)
response = agent.invoke(
{
'messages': [
{
'role': 'user',
'content': "Please echo the text 'Hello from MCPClient!'"
}
]
}
)
print("Agent response:", response)
Your MCP tools are now callable by the agent as native LangGraph tools.
Architecture
MCPager is built around three simple layers:
MCPClient
↓
BackendAdapter (LangGraphBackend, etc.)
↓
Session (JSON-RPC + session handling)
↓
Transport (stdio, http, SSE)
This makes MCPager:
-
easy to test
-
easy to extend
-
safe to embed in agents, workers, or pipelines
Transports
Stdio (local MCP servers)
StdioTransport(["python", "my_server.py"])
HTTP (FastMCP or remote MCP)
HttpTransport("http://localhost:3000")
Supports:
-
normal JSON responses
-
text/event-stream (SSE streaming)
Documentation
Full documentation and guides are available here:
This includes:
-
MCP protocol overview
-
Tool schemas
-
Server & client examples
-
Agent integration patterns
Who is MCPager for?
MCPager is for:
-
Independent AI developers
-
Agent builders
-
Tool & plugin authors
-
Anyone building MCP-based systems without wanting async complexity
If you want reliable tool calls from LLM agents to real backends, MCPager is built for you.
Project Philosophy
MCPager follows a few strict principles:
-
Synchronous by default
-
Explicit session handling
-
No hidden magic
-
Transport-agnostic
-
Agent-friendly
Think of it as:
“The curl of MCP.”
License
Apache 2.0
Contributions
PRs, issues, and ideas are welcome. MCPager is meant to grow with the MCP ecosystem. 📟
Below is our current backlog:
- Task: support sampling
- Task: support elicitation
- 30.12.2025 MCPager client released!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcpager-0.1.1.tar.gz.
File metadata
- Download URL: mcpager-0.1.1.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86d5fa465548400f5f8f6fabad5105e4b1d39458aacca8a86e1a23c013482f66
|
|
| MD5 |
59d682baac33540e6b3cebe738e24b4c
|
|
| BLAKE2b-256 |
9c86d2db9f4fc9cb31a840b9dbade4abf84fc7ed77b39a68d786d799dbe06301
|
File details
Details for the file mcpager-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mcpager-0.1.1-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b3b8a07e9c75d82bb65846b3e3247d2c6cf135aa9f90eb390604ba0f52c3378
|
|
| MD5 |
e26eb49033f6bfcb1c2fc6097030f1e9
|
|
| BLAKE2b-256 |
a0d42da224e0f57ad2ff9d8393a2b3d4e8d1550be0c5ab8fdf623a4fe6bea881
|