AI Agents Need Inspectable State. That’s Why I Built LangMCP | by Muhammad Abdullah Shafat Mulkana | Jun, 2026 | Towards AISitemapOpen in appSign up<br>Sign in
Medium Logo
Get app<br>Write
Search
Sign up<br>Sign in
Towards AI
We build Enterprise AI. We teach what we learn. Join 100K+ AI practitioners on Towards AI Academy. Free: 6-day Agentic AI Engineering Email Guide: https://email-course.towardsai.net/
AI Agents Need Inspectable State. That’s Why I Built LangMCP
Checkpoints, memory, and the debugging gap that traces don’t fill.
Muhammad Abdullah Shafat Mulkana
6 min read·<br>Just now
Listen
Share
Press enter or click to view image in full size
Inspecting an agent’s inner workings.<br>AI Generated via GeminiThe first time an AI agent forgets something important, the instinct is to blame the prompt. I’ve done that too.<br>You look at the system message. You reread the tool descriptions. You ask whether the model ignored an instruction, or whether the user said something ambiguous three turns ago.<br>Sometimes that is the problem.<br>But when you are building with LangGraph, the most interesting behavior often lives in checkpoints, thread state, long-term memory, namespaces, configurable IDs, and all the persistence details that decide whether a conversation feels coherent from one turn to the next.<br>At some point, the real question stops being:<br>“What did the model do?”<br>And becomes:<br>“What is actually in the database right now?”<br>That question is why I built LangMCP.<br>The debugging gap in stateful agents<br>Tools like Langsmith and Langfuse are excellent for traces. They tell you what happened during a run, which tools were called, what the model returned, and how a chain or graph executed.<br>But while building real agent systems, I kept running into a slightly different debugging problem.<br>I did not only want to know what happened during one execution. I wanted to inspect the state that survived after execution. You can do that with database consoles, local scripts, logs, and trace dashboards. I did that for a while.<br>But none of those felt like the right interface for an AI coding assistant.<br>I did not want to give the assistant arbitrary SQL access. I did not want database credentials floating around in prompts. I did not want every developer to keep a private collection of scripts for inspecting thread state.<br>I wanted something smaller and safer:<br>A local MCP server that understands LangGraph persistence and exposes only the inspection operations I actually need.<br>That became LangMCP.<br>What LangMCP is<br>LangMCP is a development MCP server for LangGraph checkpoint and store inspection.<br>It connects through named profiles, uses LangGraph-native checkpointer and store APIs, and gives MCP clients such as Cursor or Claude Desktop a read-only way to inspect persistence. It gets a narrow, intentional surface area:<br>listing profiles,<br>checking health,<br>discovering thread IDs,<br>inspecting thread state,<br>listing checkpoint history,<br>comparing checkpoints,<br>summarizing threads,<br>inspecting store namespaces,<br>searching long-term memory, and<br>summarizing user memory.<br>That surface is intentionally practical. It is designed to answer the question that matters during development:<br>“Why did this agent behave this way?”<br>Why MCP was the right boundary<br>MCP gives the project a clean shape.<br>The editor or assistant does not need direct database access. It talks to LangMCP. LangMCP owns the profiles, backend adapters, redaction, pagination, and read-only enforcement.<br>That separation matters. A useful assistant should be able to inspect state, but it should not accidentally become a migration tool.<br>The workflow is simple:<br>1. Configure profiles in langmcp.toml.<br>2. Start the MCP server with stdio transport.<br>3. Ask the assistant about a thread, checkpoint, or user memory.<br>4. Let the assistant inspect the state through constrained operations.<br>5. Get back a verdict grounded in actual persistence data.<br>This is the part I like most about the design. It does not ask the model to be clever with infrastructure. It gives the model a safer lens into the system.<br>Getting started with LangMCP<br>Install Python Package<br>uv pip install "langmcp[all]"2. Configure a profile in langmcp.toml:<br>[profiles.dev]<br>checkpointer = "${POSTGRES_URI}"<br>store = "${POSTGRES_URI}"3. Start the server and connect your editor:<br>langmcp serve --config ./langmcp.tomlThen ask your assistant: “Summarize thread abc123 and check if user memory exists for user_456.”<br>Get Muhammad Abdullah Shafat Mulkana’s stories in your inbox
Join Medium for free to get updates from this writer.
Subscribe
Subscribe
Remember me for faster sign in
If you want to add LangMCP to your AI-based coding IDE such as cursor or vscode, the mcp.json should have the following structure.<br>"mcpServers": {<br>"langmcp": {<br>"command": "uvx",<br>"args": ["langmcp[all]", "serve", "--config", "ABSOLUTE_PATH_TO_LANGMCP_TOML"],<br>"env": {<br>"LANGMCP_READ_ONLY": "true",<br>"POSTGRES_URI": "postgresql://READONLY_USER:READONLY_PASSWORD@HOST:5432/DB_NAME"<br>}Tools are...