Document Title: MCP Shared Memory Server User Guide
Document Version: 1.0.0
Document Date: December 2025
Document Status: Released
Product Name: MCP Shared Memory Server
Product Version: 1.0.0
Target Audience: Software developers, system administrators, MCP client users
Purpose: This guide provides instructions for installing, configuring, and using the MCP Shared Memory Server for inter-process communication via shared memory on Windows systems.
Copyright Notice:
Β© 2025 MCP Shared Memory Server Project. All rights reserved.
This document is provided "as is" without warranty of any kind.
Document Conventions:
- Bold text indicates user interface elements or emphasis.
Monospace textindicates code, commands, or file names.β οΈ Warning indicates potential data loss or security risks.- βΉοΈ Note provides additional information.
- π Procedure indicates step-by-step instructions.
- Document Title, Version, and Status ................... 1
- Copyright Notice ...................................... 1
- Document Conventions .................................. 1
- 1.1 Purpose and Scope ................................. 2
- 1.2 Target Audience ................................... 2
- 1.3 Product Overview .................................. 3
- 1.4 Related Documents ................................. 3
- 2.1 System Architecture ............................... 4
- 2.2 Operational Modes ................................. 7
- 2.3 Data Flow ......................................... 7
- 3.1 System Requirements ............................... 8
- 3.2 Installation Procedure ............................ 8
- 3.3 Configuration Procedure ........................... 10
- 3.4 Startup Procedure ................................. 10
- 3.5 Normal Operation Procedures ....................... 11
- 3.5.1 Basic Memory Operations ....................... 11
- 3.5.2 Typed Data Operations ......................... 12
- 3.6 Shutdown Procedure ................................ 13
- 4.1 Uninstallation Procedure .......................... 14
- 4.2 Post-Uninstallation Considerations ................ 14
- 5.1 Common Issues and Solutions ....................... 15
- 5.2 Error Messages and Meanings ....................... 16
- 5.3 Diagnostic Procedures ............................. 16
- Appendix A: MCP Tools Reference ........................ 23
- Appendix B: Sample Applications ........................ 24
This user guide describes the MCP Shared Memory Server, a software component that implements the Model Context Protocol (MCP) for managing shared memory operations on Windows systems. The guide covers installation, configuration, operation, and troubleshooting of the server.
The scope includes:
- System requirements and prerequisites
- Installation and setup procedures
- Basic and advanced usage scenarios
- Maintenance and troubleshooting
- Uninstallation procedures
This guide is intended for:
- Software Developers who need to integrate shared memory capabilities into their applications
- System Administrators responsible for deploying and maintaining MCP servers
- End Users of MCP-compatible client applications (e.g., Claude Desktop, VS Code)
The MCP Shared Memory Server is an advanced implementation of a Model Context Protocol (MCP) server that provides comprehensive shared memory management capabilities for Windows applications. Built using the official MCP C# SDK, this server enables secure and efficient inter-process communication through memory-mapped files.
Key features:
- Thread-safe shared memory operations
- Typed data handling (SystemStatus, Messages, Metrics)
- MCP protocol compliance
- JSON-RPC 2.0 communication
- Comprehensive error handling and logging
The MCP Shared Memory Server operates within a client-server architecture using the Model Context Protocol. The system consists of three main components:
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β SharedMemoryApp βββββΆβ Global Shared ββββββ McpSharedServer β
β (Writer) β β Memory β β (MCP Server) β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β
βΌ
ββββββββββββββββ
β MCP Clients β
β (Claude, VS β
β Code, etc.) β
ββββββββββββββββ
SharedMemoryApp: A .NET console application that writes data to shared memory.
McpSharedServer: The MCP server that exposes shared memory operations via MCP tools.
Global Shared Memory: Windows memory-mapped file for inter-process communication.
MCP Clients: Compatible applications that can invoke server tools.
The server supports two primary operational modes:
- Standalone Mode: Server runs independently, managing shared memory operations.
- Integrated Mode: Server integrates with MCP-compatible client applications for enhanced functionality.
- SharedMemoryApp writes data to Windows shared memory.
- McpSharedServer monitors and manages the shared memory.
- MCP clients connect to the server and invoke tools to read/write data.
- All operations are thread-safe with proper synchronization.
Hardware Requirements:
- Windows operating system (Windows 10/11 recommended)
- Minimum 4 GB RAM
- 100 MB available disk space
Software Requirements:
- .NET 8.0 SDK or later
- Administrator privileges (for global shared memory access)
- MCP-compatible client application
π Procedure: Installing the MCP Shared Memory Server
-
Download the source code:
git clone <repository-url> cd MCP-Shared-Memory
-
Install required packages:
dotnet add package ModelContextProtocol --prerelease dotnet add package Microsoft.Extensions.Hosting
-
Build the solution:
dotnet build
-
Verify installation:
dotnet run --project SharedMemoryApp/SharedMemoryApp.csproj
Expected result: Application starts and provides an interactive menu.
The server uses default configuration. For advanced scenarios:
- Review
SharedMemoryTools.csfor memory size limits. - Modify
MaxMemorySizeconstant if needed (default: 1MB). - Ensure global shared memory name matches:
Global\MCP_SharedMemory.
π Procedure: Starting the MCP Shared Memory Server
- Start the shared memory writer (optional for testing):
dotnet run --project SharedMemoryApp/SharedMemoryApp.csproj
2. **Start the MCP server:**
```bash
dotnet run --project McpSharedServer/McpSharedServer.csproj
- Verify server is running:
- Server should display startup messages
- No error messages should appear
Reading data:
var result = await client.CallToolAsync("get_shared_memory");Writing data:
await client.CallToolAsync("write_shared_memory", new()
{
["json_data"] = "{\"status\": \"active\"}"
});Creating system status:
await client.CallToolAsync("create_system_status", new()
{
["status"] = "healthy",
["cpu_usage"] = 45,
["memory_usage"] = 2048576000L
});Sending messages:
await client.CallToolAsync("create_message", new()
{
["content"] = "Hello from MCP client!",
["sender"] = "MCP_Client_1"
});π Procedure: Shutting Down the Server
-
Stop MCP clients connected to the server.
-
Terminate the MCP server process:
- Press
Ctrl+Cin the terminal running the server - Or close the terminal window
- Press
-
Stop the shared memory application (if running):
- Press
Ctrl+Cor close the application
- Press
π Procedure: Uninstalling the MCP Shared Memory Server
-
Stop all running processes:
- Terminate any running instances of
McpSharedServer - Terminate any running instances of
SharedMemoryApp
- Terminate any running instances of
-
Remove shared memory resources:
- Windows automatically cleans up memory-mapped files when processes exit
- No manual cleanup required
-
Remove project files:
# Navigate to project directory cd MCP-Shared-Memory # Remove build artifacts dotnet clean # Remove entire directory (optional) cd .. rm -rf MCP-Shared-Memory
-
Remove NuGet packages (if installed globally):
dotnet nuget locals all --clear
- Shared memory resources are automatically released by Windows
- No system registry entries are modified
- No Windows services are installed
- Project can be safely deleted without residual files
Issue: "Access denied" when starting applications
Solution: Run applications as Administrator. Global shared memory requires elevated privileges.
Issue: "Shared memory not found" error
Solution: Ensure SharedMemoryApp has been run at least once to create the shared memory segment.
Issue: Server fails to start
Solution: Verify .NET 8.0 SDK is installed and all dependencies are available.
Issue: Memory size limit exceeded
Solution: Reduce data size or modify MaxMemorySize constant in the source code.
"Invalid data size: X"- Data being read exceeds expected limits"Memory manager is in read-only mode"- Attempting to write when manager is read-only"Operation failed after all retries"- Network or system errors after retry attempts
π Procedure: Collecting Diagnostic Information
-
Check server logs:
- Review console output for error messages
- Look for startup confirmation messages
-
Verify shared memory state:
var info = await client.CallToolAsync("get_shared_memory_info");
-
Test basic connectivity:
var tools = await client.ListToolsAsync();
MCP (Model Context Protocol): An open protocol that standardizes how applications provide context to Large Language Models.
Shared Memory: A memory segment that can be accessed by multiple processes, enabling inter-process communication.
Memory-Mapped File: A mechanism that maps a file or memory region into the address space of a process.
JSON-RPC 2.0: A stateless, light-weight remote procedure call protocol encoded in JSON.
Global Shared Memory: A shared memory segment accessible system-wide on Windows (requires Administrator privileges).
Thread Safety: Property of code that allows it to run correctly in multi-threaded environments.
- Access Control: Section 3.5, Appendix A
- Administrator Privileges: Section 3.1, Section 5.1
- Appendices: Section 8
- Architecture: Section 2.1
- Audience, Target: Section 1.2
- Basic Memory Operations: Section 3.5.1, Appendix A
- Client Integration: Section 3.5
- Common Issues: Section 5.1
- Concept of Operations: Section 2
- Configuration: Section 3.3
- Conventions, Document: Front Matter
- Copyright: Front Matter
- CPU Usage: Section 3.5.2
- Data Flow: Section 2.3
- Data Types, Typed: Section 3.5.2, Appendix A
- Diagnostic Procedures: Section 5.3
- Document Conventions: Front Matter
- Error Messages: Section 5.2
- Error Handling: Section 5
- Features, Key: Section 1.3
- Front Matter: Front Matter
- Glossary: Section 6
- Global Shared Memory: Section 2.1, Section 6
- Hardware Requirements: Section 3.1
- Index: Section 7
- Installation: Section 3.2
- Integrated Mode: Section 2.2
- Introduction: Section 1
- JSON-RPC 2.0: Section 2.3, Section 6
- License: Appendix B (implied)
- MCP Clients: Section 2.1
- MCP Protocol: Section 1.3, Section 6
- MCP Tools: Section 3.5, Appendix A
- Memory Configuration: Section 3.3
- Memory Size Limits: Section 3.5, Appendix A
- Memory-Mapped File: Section 6
- Metrics, Performance: Section 3.5.2, Appendix A
- Normal Operation: Section 3.5
- Operational Modes: Section 2.2
- Overview, Product: Section 1.3
- Performance Metrics: Section 3.5.2
- Prerequisites: Section 3.1
- Procedures: Section 3
- Product Overview: Section 1.3
- Purpose and Scope: Section 1.1
- Related Documents: Section 1.4
- Requirements, System: Section 3.1
- Sample Applications: Appendix B
- Scope: Section 1.1
- Shared Memory: Section 2.3, Section 6
- Shutdown Procedure: Section 3.6
- Software Requirements: Section 3.1
- Standalone Mode: Section 2.2
- Startup Procedure: Section 3.4
- Status, System: Section 3.5.2, Appendix A
- System Administrators: Section 1.2
- System Architecture: Section 2.1
- System Requirements: Section 3.1
- Table of Contents: Table of Contents
- Target Audience: Section 1.2
- Thread Safety: Section 1.3, Section 6
- Tools, MCP: Section 3.5, Appendix A
- Troubleshooting: Section 5
- Typed Data Operations: Section 3.5.2, Appendix A
- Uninstallation: Section 4
- Usage Scenarios: Section 1.1
- Version, Document: Front Matter
- Version, Product: Front Matter
Basic Memory Operations:
get_shared_memory- Reads JSON data from shared memorywrite_shared_memory- Writes JSON data to shared memoryclear_shared_memory- Clears all data from shared memoryget_shared_memory_info- Returns memory state information
Typed Data Operations:
create_system_status- Creates system status datacreate_message- Creates message datacreate_metrics- Creates performance metrics datawrite_typed_data/read_typed_data- Typed data operations
The samples/McpSharedMemoryClient/ directory contains a demonstration application showing JSON-RPC protocol patterns.
Run the sample:
dotnet run --project samples/McpSharedMemoryClient/McpSharedMemoryClient.csprojEnd of Document