MCP Session Closer
The MCP Session Closer server automates Cursor work session management by syncing context files, updating documentation, creating Notion entries, and committing changes to git.
Available Tools:
end_session: Closes work sessions gracefully by extracting session details (accomplishments, decisions, blockers, next steps), syncing context files across multiple AI assistants (
claude.md,gemini.md,agents.md,.cursor/context.md), updating Agent OS files (session-summary.md, roadmap.md, decisions.md), creating Notion entries, and committing all changes to git with descriptive timestamps.sync_context_files: Synchronizes and deduplicates content across all AI context files without closing the session, maintaining unified context for different assistants.
update_session_summary: Appends timestamped session information to
.agent-os/session-summary.mdwithout performing a full session close, useful for logging progress checkpoints.
Key Features:
Notion Integration: Automatically creates Notion pages or appends blocks with markdown-to-Notion conversion and chunking for large content, using MCP tools with direct API fallback.
Agent OS Support: Updates roadmaps (marks completed items) and decision logs automatically if these files exist, creating them if missing.
Git Integration: Automatically stages and commits all modified files with descriptive messages.
Cross-platform: Works on Windows, macOS, and Linux.
Automatically stages and commits changes to git repositories with descriptive commit messages when closing work sessions
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Session CloserClose this session and sync everything"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Session Closer
A Model Context Protocol (MCP) server for Cursor that gracefully closes work sessions, syncs context files, updates Agent OS files, and commits changes to git.
Features
end_session: Close Cursor sessions with automatic context sync, Notion entry creation, and git commit
sync_context_files: Sync context files across
claude.md,gemini.md,agents.md, and.cursor/context.mdupdate_session_summary: Update session summaries without closing the session
create_notion_entry: Create Notion entries from markdown content (append to page or create in database)
Notion Integration: Automatically creates Notion entries via MCP tools (with Python script fallback)
Related MCP server: iroha for Notion
Quick Setup
1. Install Dependencies
npm install2. Build the Server
npm run build3. Configure Cursor
Add to your Cursor MCP settings (~/.cursor/mcp.json or %APPDATA%\Cursor\mcp.json on Windows):
{
"mcpServers": {
"session-closer": {
"command": "node",
"args": [
"/path/to/mcp-session-closer/dist/index.js"
],
"env": {
"CURSOR_WORKSPACE": "${workspaceFolder}"
}
}
}
}Note: Replace /path/to/mcp-session-closer with your actual path. On Windows, use forward slashes or double backslashes.
4. Restart Cursor
Restart Cursor to load the MCP server.
Usage
End Session
In Cursor chat, simply ask:
Close this session and sync everythingOr use the tool directly:
Use end_session with conversationSummary: "Implemented user auth, fixed login bugs"The server will:
Extract session details (accomplishments, decisions, blockers, next steps)
Update
.agent-os/session-summary.mdCreate Notion entry via MCP (or fallback to Python script)
Update Agent OS roadmap and decisions (if present)
Sync all context files (
claude.md,gemini.md,agents.md,.cursor/context.md)Commit all changes to git with descriptive message
Sync Context Files Only
Sync context filesOr:
Use sync_context_filesUpdate Session Summary Only
Use update_session_summary with summary: "Made progress on feature X"Create Notion Entry from Markdown
Create a Notion entry directly from markdown content. This is useful for adding completion reports, documentation, or any structured content to Notion.
Append to existing page:
Use create_notion_entry with markdownContent: "# My Report\n\nContent here..." and pageId: "your-page-id"Create new page in database:
Use create_notion_entry with markdownContent: "# My Report\n\nContent here..." and databaseId: "your-database-id"With custom title and date:
Use create_notion_entry with markdownContent: "# My Report\n\nContent here...", databaseId: "your-database-id", title: "Custom Title", date: "2026-02-08", project: "Development"Features:
Automatically converts markdown to Notion blocks
Handles large content by chunking (Notion limit: 100 blocks per request)
Extracts title from first H1 if not provided
Extracts date from markdown if present
Falls back to direct Notion API if MCP tools unavailable
How It Works
Session Closing Flow
When you call end_session, the server automatically:
Gathers Session Info
Extracts accomplishments from conversation
Identifies decisions made
Notes any blockers
Lists next steps
Tracks changed files
Updates Session Summary
Creates/updates
.agent-os/session-summary.mdAppends session details with timestamp
Formats as structured markdown
Updates Agent OS (if present)
Marks completed items in
.agent-os/product/roadmap.mdAdds new decisions to
.agent-os/product/decisions.mdMaintains proper markdown structure
Syncs Context Files
Reads content from all context files
Merges and deduplicates content
Updates all files with unified context:
claude.mdgemini.mdagents.md.cursor/context.md
Commits to Git
Stages all modified files
Creates descriptive commit message
Commits with timestamp
Configuration
Required Environment Variables
CURSOR_WORKSPACE- Set automatically by Cursor to the current workspace folder
Notion Integration
The server can automatically create Notion entries when closing sessions, and you can also create entries manually using the create_notion_entry tool. Configure via environment variables:
Required:
NOTION_API_TOKENorNOTION_API_KEYorNOTION_TOKEN- Your Notion integration token (get from https://www.notion.so/my-integrations)
Choose one (for automatic session entries):
NOTION_PAGE_ID- Append blocks to existing page (recommended, avoids serialization issues)NOTION_DATABASE_ID- Create new page in database
Optional:
NOTION_PROJECT- Default project name for database entries (default: "Development")
Example:
export NOTION_API_TOKEN="ntn_your_token_here"
export NOTION_DATABASE_ID="2ba968fc-73c0-8045-b1c7-c89951ece547"
export NOTION_PROJECT="Development"How it works:
Primary: Uses Notion MCP tools via Docker (
mcp/notion:latest)Fallback: If MCP fails, falls back to direct Notion API calls
Chunking: Automatically handles large content by splitting into chunks of 100 blocks (Notion API limit)
Note: When using create_notion_entry tool, you can override environment variables by passing pageId, databaseId, title, date, or project as parameters.
MCP Integration:
Connects to Notion MCP server via Docker stdio transport
Uses
append-blockstool (preferred) orcreate-pagetoolHandles parameter serialization correctly
Non-blocking: errors don't fail session close
Optional Files
The server works with or without these files:
.agent-os/session-summary.md- Session history (created if missing).agent-os/product/roadmap.md- Product roadmap (updated if present).agent-os/product/decisions.md- Decision log (updated if present)claude.md,gemini.md,agents.md,.cursor/context.md- Context files
Development
Run in Development Mode
npm run devBuild
npm run buildStart Production Server
npm startTroubleshooting
MCP Server Not Found
Verify the path in Cursor MCP config is correct
Use forward slashes or escaped backslashes on Windows
Check that
dist/index.jsexists after building
Git Commit Fails
Ensure git is initialized:
git initConfigure git user:
git config user.name "Your Name" git config user.email "your.email@example.com"Check you have write permissions
Context Files Not Syncing
Verify write permissions in the workspace directory
Check that no other processes are locking the files
Ensure the workspace path is correct
Session Summary Not Updating
Check that
.agent-osdirectory exists (created automatically)Verify write permissions in the workspace
Look for errors in Cursor's MCP logs
Notion Entry Not Creating
Verify
NOTION_API_TOKENis set correctlyCheck that
NOTION_PAGE_IDorNOTION_DATABASE_IDis configuredEnsure Docker can run
mcp/notion:latestcontainerCheck Docker logs:
docker logs mcp-notion(if running as container)Verify Notion integration has access to the target page/database
If MCP fails, check if Python fallback script exists and is executable
Project Structure
mcp-session-closer/
├── src/
│ ├── index.ts # MCP server implementation
│ ├── session-closer.ts # Core session closing logic
│ ├── notion-client.ts # Notion MCP client wrapper
│ └── types.ts # TypeScript type definitions
├── dist/ # Compiled JavaScript (generated)
├── package.json # Node.js dependencies
├── tsconfig.json # TypeScript configuration
├── Dockerfile # Docker build configuration
├── docker-compose.yml # Docker Compose configuration
└── README.md # This fileWhy Use This?
Automated Workflow
No Manual Steps: Automatically syncs, updates, and commits
Consistent Format: Standardized session summaries and git commits
Time Saver: Closes sessions in seconds, not minutes
Context Continuity
Unified Context: All AI assistants see the same project context
Cross-Session Memory: Session summaries persist across restarts
Decision Tracking: Maintains history of why decisions were made
Git Integration
Automatic Commits: Never forget to commit your work
Descriptive Messages: Auto-generated commit messages with context
Clean History: Organized commits at natural breakpoints
License
MIT
Contributing
This is a personal tool, but feel free to fork and adapt it for your needs!
Available Tools
3 toolsend_sessionB
Close the current Cursor session, sync all context files, update Agent OS files, and commit to git. This is the main tool for ending a work session.
| Name | Required | Description | Default |
|---|---|---|---|
| conversationSummary | Yes | Summary of what was accomplished in this session. If not provided, will attempt to extract from context. | |
| accomplishments | No | List of specific accomplishments (optional, will be extracted if not provided) | |
| decisions | No | List of decisions made during this session (optional) | |
| blockers | No | List of blockers or issues encountered (optional) | |
| nextSteps | No | List of next steps or TODO items (optional) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions actions like syncing files and committing to git, which imply mutations and potential side effects, but doesn't detail permissions needed, error handling, or what happens if operations fail. For a tool with multiple operations and no annotations, this is a significant gap in transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise and front-loaded, with two sentences that efficiently convey the tool's purpose and main use case. Every sentence adds value without redundancy, though it could be slightly more structured by explicitly listing key actions or outcomes.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (multiple operations like syncing and committing) and lack of annotations or output schema, the description is somewhat incomplete. It covers the high-level purpose but misses details on behavioral traits, error scenarios, and return values. This leaves gaps for an AI agent to fully understand how to invoke it correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the input schema already documents all parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema, such as formatting details or examples. Baseline 3 is appropriate when the schema handles parameter documentation effectively.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with specific verbs ('Close', 'sync', 'update', 'commit') and resources ('Cursor session', 'context files', 'Agent OS files', 'git'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'sync_context_files' or 'update_session_summary', which might have overlapping functionality.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage context by stating 'This is the main tool for ending a work session,' which suggests it should be used to conclude sessions. However, it doesn't provide explicit guidance on when to use this tool versus alternatives like 'sync_context_files' or 'update_session_summary,' nor does it specify prerequisites or exclusions, leaving some ambiguity.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
sync_context_filesA
Sync all context files (claude.md, gemini.md, agents.md, .cursor/context.md) without closing the session. Useful for mid-session syncs.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It discloses that the tool performs a sync operation without closing the session, which is useful behavioral context. However, it doesn't mention potential side effects, error conditions, or what 'sync' entails (e.g., overwriting, merging, or validation), leaving gaps in transparency for a mutation-like tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two concise sentences with zero waste. The first sentence states the action and resources, and the second provides usage context. It's front-loaded with the core purpose and efficiently structured.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no annotations, no output schema, and 0 parameters, the description is minimal but covers the basics. It explains what the tool does and when to use it, but for a tool that likely modifies files, it lacks details on behavior, outcomes, or error handling. This makes it adequate but with clear gaps in completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add parameter details, which is appropriate here. A baseline of 4 is applied since there are no parameters to explain, and the description focuses on the tool's purpose instead.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Sync all context files') and specifies the resources (claude.md, gemini.md, agents.md, .cursor/context.md). It distinguishes from siblings by mentioning 'without closing the session', which differentiates it from 'end_session'. However, it doesn't explicitly contrast with 'update_session_summary', keeping it from a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context for when to use this tool ('Useful for mid-session syncs'), which implies usage during an ongoing session rather than at the end. It doesn't explicitly state when not to use it or name alternatives like 'update_session_summary', but the mid-session focus gives practical guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
update_session_summaryB
Update the session summary file with current session info without doing a full session close.
| Name | Required | Description | Default |
|---|---|---|---|
| summary | Yes | Session summary text to append to session-summary.md |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden. It states the tool updates a file, implying mutation, but doesn't disclose important behavioral traits like whether this requires specific permissions, how conflicts are handled, if changes are reversible, or what happens to existing content. The 'append' behavior is only hinted at in the parameter description, not in the main description.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that front-loads the core purpose. It could be slightly more structured by explicitly mentioning the append behavior, but it avoids unnecessary elaboration.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what 'update' entails (e.g., append vs. replace), what the session-summary.md file is, or what the tool returns. The context of 'current session info' is vague without elaboration.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, with the single parameter 'summary' well-documented in the schema. The description doesn't add any parameter semantics beyond what the schema provides, maintaining the baseline score of 3 for high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('update') and resource ('session summary file') with specific context ('without doing a full session close'). It distinguishes from 'end_session' by specifying partial vs. full closure, but doesn't explicitly differentiate from 'sync_context_files'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage context ('without doing a full session close'), suggesting this is for incremental updates during an active session rather than final closure. However, it doesn't provide explicit guidance on when to choose this over 'sync_context_files' or what triggers its use.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
3 tool updates
- First observed
end_session - First observed
sync_context_files - First observed
update_session_summary
TDQS
Scored across 3 tools
Each tool has a clearly distinct purpose: end_session closes the session with full sync and git commit, sync_context_files syncs files without closing, and update_session_summary updates only the summary file. There is no overlap in functionality, making tool selection unambiguous.
All tool names follow a consistent verb_noun pattern (end_session, sync_context_files, update_session_summary) with snake_case throughout. The naming is predictable and aligns well with their described actions.
With 3 tools, this server is well-scoped for session management tasks. Each tool serves a specific, necessary function (full close, partial sync, summary update), and there are no extraneous or missing tools for the domain.
The toolset provides complete coverage for session lifecycle management: end_session handles full closure, sync_context_files allows mid-session syncs, and update_session_summary supports summary updates. There are no obvious gaps, and agents can perform all expected operations without dead ends.
Related MCP Connectors
Cross-agent artifact workspace with provenance across Claude Code, Codex, Cursor, LangGraph.
- OneLoreOAuthai.onelore
Shared project context for AI agents and teams: docs, tasks, and messages that stay current.
Shared memory for coding agents. Stop re-explaining your codebase every session.
Research-backed linting + generation for agent context files (CLAUDE.md, AGENTS.md, Cursor rules).
Related MCP Servers
- AlicenseAqualityDmaintenanceProvides cross-session memory for Claude Code by extracting structured handoffs at session end and retrieving relevant past context at session start.27MIT
- AlicenseNot gradedqualityAmaintenancePersists Claude Code sessions to Notion as team memory, enabling queryable recall of decisions, work state, and project architecture.MIT
- AlicenseAqualityDmaintenanceEnables session continuity across AI coding assistants by preserving context and generating handoff markdown, allowing seamless switching between tools like Cursor, Claude Code, and Claude Desktop.11MIT
- FlicenseNot gradedqualityAmaintenanceCaptures a coding agent's session into an Intent Document, enabling guided and verifiable pull-request reviews on GitHub.1-