What is LangMCP?
LangMCP is an open-source Model Context Protocol (MCP) server that provides a safe, read-only interface for developers to inspect LangGraph thread states, checkpoints, and long-term memory. It bridges the gap between opaque database records and agent execution traces, allowing AI coding assistants to reason about persistent state without requiring direct database access.
- Best For: AI developers and engineers building stateful agents with LangGraph.
- Pricing: Open-source (Free).
- Category: AI Coding Assistants
- Free Option: Yes ✅
The Problem LangMCP Solves
When building sophisticated agents with LangGraph, the most complex issues rarely live in your system prompt or tool logic. Instead, they hide in the persistence layer: the threads, checkpoints, and memory namespaces that determine how an agent maintains continuity across multiple turns. Traditionally, when an agent fails to "remember" a piece of data, developers resort to manual SQL queries, custom diagnostic scripts, or sifting through complex logs. This is inefficient and, more importantly, insecure, as it often necessitates exposing database credentials directly to your AI assistant during the development cycle.
Developers working on long-running, stateful agent systems suffer the most from this visibility gap. Standard observability tools like LangSmith or Langfuse excel at showing you what happened during a specific execution trace, but they do not provide an easy way to query the "ground truth" of your database state. LangMCP fixes this by acting as a controlled bridge between your editor and your persistence layer.
By implementing a read-only MCP server, LangMCP allows your AI coding assistant (like Cursor or VS Code with an MCP client) to ask questions about your database without you needing to share raw access or write one-off inspection scripts. In this tutorial, you'll learn exactly how to use LangMCP — step by step.
How to Get Started with LangMCP in 5 Minutes
- Install the package: Run
uv pip install "langmcp[all]"in your project terminal to get the server up and running. - Configure your connection: Create a
langmcp.tomlfile in your project root and define yourPOSTGRES_URIwithin the profile settings to point to your LangGraph database. - Start the server: Execute
langmcp serve --config ./langmcp.tomlto initialize the MCP server instance using stdio transport. - Connect your IDE: Update your MCP client settings (such as your
mcp.jsonfor Cursor) to include the LangMCP command and your database environment variables. - Query your state: Open your AI assistant and ask specific questions like "Summarize thread [id]" or "Check for user memory" to begin inspecting your agent's persistence state.
How to Use LangMCP: Complete Tutorial
Step 1: Configuring Your Inspection Environment
The first requirement for using LangMCP is ensuring that the server can securely access your persistence layer. By defining profiles in your langmcp.toml file, you create a dedicated "view" into your system. You should point your checkpointer and store keys to your existing PostgreSQL URIs. Because LangMCP is designed to be a read-only utility, it is standard practice to use a restricted database user account that only has read permissions, providing an extra layer of security for your infrastructure.
POSTGRES_URI in the mcp.json configuration to avoid committing database credentials to version control.Step 2: Exploring Thread History and States
Once connected, the most frequent task is understanding why an agent made a specific decision. You can use the assistant to call get_thread_state or compare_checkpoints to look at the differences between two points in a conversation. This is particularly useful when the agent's behavior deviates from expectations after a specific tool invocation. Instead of manually parsing JSON blobs, the assistant can now summarize the thread and identify exactly which checkpoint triggered the change in state.
langmcp://profiles/{profile}/threads/{thread_id}/checkpoints resource to quickly view the history of a conversation without needing to prompt the model for an explanation first.Step 3: Auditing Long-Term Memory
LangGraph stores are often used to keep track of user preferences or external context that persists across multiple threads. LangMCP provides tools like search_store to help you verify that information was actually saved under the correct namespace. If a user complains that an agent forgot a setting, use the inspect_user_memory prompt. This allows the AI to systematically check if the memory exists, if it is stored in the correct namespace, and if the current thread has access to that specific memory context.
debug_thread prompt if you are unsure where to start; it initiates a guided diagnostic flow that checks for common memory gaps automatically.LangMCP: Pros & Cons
| Pros | Cons |
|---|---|
| Provides a safe, read-only interface for database inspection. | Requires manual configuration of TOML files for each project. |
| Eliminates the need for sharing database credentials with LLMs. | Limited strictly to LangGraph-based systems. |
| Native integration with LangGraph persistence APIs. | Read-only limitation prevents active database management or patching. |
| Includes pre-built prompts for common debugging workflows. | Setup overhead may feel excessive for very simple agent prototypes. |
LangMCP Pricing: Free vs Paid
LangMCP is an open-source project and is currently free to use in its entirety. As it functions as a local development utility, there are no cloud subscription tiers, usage limits, or gated enterprise features. You download, configure, and run it locally within your own development environment.
Because the tool is self-hosted and open-source, your only "cost" is the time spent on initial configuration and maintenance of your langmcp.toml files. There is no paid version, nor are there hidden premium features, making it a highly accessible tool for individual developers and teams alike.
👉 Check the latest pricing and repository updates on the official LangMCP website.
Who is LangMCP Best For?
For LangGraph developers: If you spend more time debugging thread states and persistence than writing actual graph logic, this tool provides the visibility you need to stop guessing why your agent acted a certain way.
For AI coding assistant power users: If you use Cursor or Claude Desktop to manage your codebase, LangMCP turns your assistant into a database-aware investigator that can solve memory-related bugs in seconds.
For security-conscious teams: If your team wants to give AI models inspection capabilities without the risk of accidentally running destructive database queries, the read-only, constrained design of LangMCP provides the perfect middle ground.
Alternatives to LangMCP
Common alternatives include standard database GUIs like DBeaver or PGAdmin, or writing custom Python scripts to query LangGraph checkpointer tables directly. While these tools are effective for general database management, they lack the specific agent-context awareness provided by LangMCP. LangMCP is the superior choice for developers specifically looking to enable AI-assisted debugging because it provides a purpose-built abstraction layer that prevents accidental data modification and simplifies complex state inspection into natural language prompts.
Final Verdict: Is LangMCP Worth It?
LangMCP is an essential utility for anyone building production-grade agents with LangGraph who wants to move beyond manual database log checking. It provides a safer, more structured way to perform state inspection without the usual security trade-offs.