使用说明
GuidMcp - GUID Generation MCP Server
A simple Model Context Protocol (MCP) server that provides GUID generation functionality for AI assistants and other MCP clients.
Overview
This project implements an MCP server that exposes tools for generating GUIDs (Globally Unique Identifiers). The server uses the stdio transport protocol to communicate with MCP clients, making it easy to integrate with various AI assistants and development tools.
Features
- Generate GUID: Creates a new random GUID in standard string format
- Generate Multiple GUIDs: Creates multiple GUIDs in a single call for improved efficiency
- Lightweight: Minimal dependencies and fast startup time
- Cross-platform: Runs on Windows, macOS, and Linux
- Standards-compliant: Uses the standard .NET
Guid.NewGuid()implementation
Prerequisites
- .NET 8 SDK for building; .NET 8 runtime for the framework-dependent server
- Python 3 for the dependency-free protocol regression test
- An MCP-compatible client (such as Claude Desktop, Cursor, or other AI assistants)
Installation
-
Clone this repository:
git clone https://github.com/ilyasakin/GuidMcp cd GuidMcp -
Build the project:
dotnet build -
Run the server:
dotnet bin/Debug/net8.0/GuidMcp.dll
Usage
Running the Server
The server communicates via standard input/output (stdio), so it's typically launched by an MCP client rather than run directly by users.
dotnet build --configuration Release
dotnet bin/Release/net8.0/GuidMcp.dll
Build before connecting a client. Standard output is reserved for MCP JSON-RPC; diagnostics go to standard error. Launching the built DLL avoids build output entering the protocol stream.
Available Tools
GenerateGuid
Generates a new GUID and returns it as a string.
Parameters: None
Returns: A string representation of a newly generated GUID
Example output:
a6af25e4-649f-47cb-9ed8-0a5ca26d14e3
GenerateMultipleGuids
Generates multiple GUIDs and returns them as an array.
Parameters:
count(int): The number of GUIDs to generate
Returns: An array of strings from the C# method, transmitted over MCP as one text content block per GUID. A count of zero returns no content blocks; a negative count returns a tool error.
Example output:
[
"e56ea49d-7f2a-415b-9829-e6d92d74f9ca",
"05fbc459-3954-44fa-9fa2-a2fc1240dd17",
"10a90f53-c644-456f-a79e-2dd03551d9c9"
]
Integration with MCP Clients
To use this server with an MCP client, you'll need to configure the client to launch this server. Here's an example configuration:
{
"mcpServers": {
"guid-generator": {
"command": "dotnet",
"args": ["/path/to/GuidMcp/bin/Release/net8.0/GuidMcp.dll"]
}
}
}
Example Usage in AI Assistants
Once configured, you can ask your AI assistant to generate GUIDs:
- "Generate a new GUID for me"
- "I need a unique identifier"
- "Create a GUID for this new record"
- "Generate 5 GUIDs for my database records"
- "I need 10 unique identifiers"
The AI assistant will call the appropriate tool (generate_guid for single GUIDs or generate_multiple_guids for multiple GUIDs) and return fresh GUIDs each time.
Development
Project Structure
GuidMcp/
├── Program.cs # Main entry point and server configuration
├── Tools/
│ └── GuidTools.cs # GUID generation tool implementation
├── GuidMcp.csproj # Project file
└── README.md # This file
Building and Testing
dotnet build --configuration Release
python3 tests/stdio_smoke.py dotnet bin/Release/net8.0/GuidMcp.dll
# Native AOT (requires the platform's native compiler/linker prerequisites)
dotnet publish --configuration Release --runtime linux-x64 --output artifacts/native
python3 tests/stdio_smoke.py ./artifacts/native/GuidMcp
The protocol regression test checks initialization, exact tool names and input schema, UUID v4 format, uniqueness, zero/single/multiple counts, negative-count error recovery, stdout purity, and clean shutdown. It uses only Python's standard library and exercises the actual server process. CI runs it against both the managed build and the Linux Native AOT executable.
Dependency upgrades
The current target and MCP preview version are retained until a stable SDK migration passes the protocol tests. In particular, changing SDK versions can change serialization of string[]; preserve the existing one-text-block-per-GUID response. .NET 8 support ends November 10, 2026, so migration to .NET 10 LTS should be completed before then. See the .NET support policy and MCP SDK releases.
LICENSE
MIT License
Copyright (c) 2025 ilyas akın
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.