Sponsored by Deepsite.site

MCP Text Transform Server

Created By
msv20177 months ago
Content

MCP Text Transform Server

A Model Context Protocol (MCP) server implementation in C# .NET 9 that provides text transformation tools. This server is compatible with Claude Desktop and other MCP clients.

📖 Learn more about MCP: Visit the official Model Context Protocol documentation for comprehensive guides and examples.

✨ Features

This MCP server provides two powerful text transformation tools:

  1. CapitalCase Tool (capital_case)

    • Converts text to Capital Case (Title Case) format
    • Handles camelCase/PascalCase by intelligently adding spaces
    • Example: "camelCaseExample""Camel Case Example"
  2. SnakeCase Tool (snake_case)

    • Converts text to snake_case format
    • Handles camelCase, PascalCase, and spaces
    • Example: "HelloWorld""hello_world"

🏗️ Architecture

This project uses the official Model Context Protocol SDK and follows modern C# practices:

  • MCP Protocol Compliance: Uses ModelContextProtocol NuGet package
  • STDIO Transport: Communicates via standard input/output (JSON-RPC)
  • Attribute-Based Tools: Simple [McpServerTool] decoration
  • Dependency Injection: Built-in .NET DI container
  • Structured Logging: Configured for MCP compatibility (stderr)
  • Modern C# Features: .NET 9, nullable reference types, async patterns

📁 Project Structure

McpServer/
├── Tools/                     # MCP tool implementations
│   └── TextTransformTools.cs  # Capital case & snake case tools
├── Program.cs                 # MCP server entry point
├── McpServer.csproj          # Project file with MCP SDK
└── README.md                 # This documentation

🚀 Getting Started

Prerequisites

  • .NET 9.0 SDK or later
  • Claude Desktop (for testing MCP integration)

Building the Server

# Clone and build
git clone <repository-url>
cd test-mcp-server
dotnet build

# Test the server
dotnet run

Testing the Tools

The server provides these text transformation capabilities:

Input: "camelCaseExample"
├── CapitalCase → "Camel Case Example"  
└── SnakeCase   → "camel_case_example"

Input: "Hello World"
├── CapitalCase → "Hello World"
└── SnakeCase   → "hello_world"

🖥️ Claude Desktop Integration

To use this MCP server with Claude Desktop, add the following configuration:

Step 1: Locate Claude Desktop Config

Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json

Step 2: Add Server Configuration

{
  "mcpServers": {
    "text-transform": {
      "command": "dotnet",
      "args": [
        "run",
        "--project",
        "/path/to/your/test-mcp-server/McpServer.csproj",
        "--no-build"
      ]
    }
  }
}

Replace /path/to/your/test-mcp-server with your actual project path:

Windows example:

{
  "mcpServers": {
    "text-transform": {
      "command": "dotnet",
      "args": [
        "run",
        "--project",
        "C:\\Users\\YourName\\projects\\test-mcp-server\\McpServer.csproj",
        "--no-build"
      ]
    }
  }
}

macOS/Linux example:

{
  "mcpServers": {
    "text-transform": {
      "command": "dotnet",
      "args": [
        "run",
        "--project",
        "/home/username/projects/test-mcp-server/McpServer.csproj",
        "--no-build"
      ]
    }
  }
}

Important notes:

  • Use absolute paths to the McpServer.csproj file
  • Use double backslashes (\\) on Windows for JSON escaping
  • Ensure the project file path exists
  • The --no-build flag speeds up server startup (recommended)

Step 3: Restart Claude Desktop

After saving the configuration, restart Claude Desktop. The text transformation tools will be available in your conversations.

Step 4: Test in Claude Desktop

Try these prompts to test the integration:

"Please convert 'HelloWorldExample' to capital case"
"Transform 'My Example Text' to snake_case format"  
"Convert 'camelCaseVariable' to title case"

🔧 Development

Adding New Tools

To add new MCP tools, simply add methods to the TextTransformTools class:

[McpServerTool]
[Description("Your tool description")]
public static string YourTool([Description("Input parameter")] string input)
{
    // Your transformation logic
    return transformedText;
}

Testing Locally

# Build and run
dotnet run

# Test with JSON-RPC (the server expects MCP protocol messages)
echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}' | dotnet run

🛠️ Troubleshooting

Claude Desktop Not Detecting MCP Server

If Claude Desktop doesn't show the text transformation tools, follow these steps:

1. Verify Server Works Locally

# Test the server responds to MCP commands:
echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}' | dotnet run

2. Check Claude Desktop Configuration

Location of config file:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

Exact configuration format:

{
  "mcpServers": {
    "text-transform": {
      "command": "dotnet",
      "args": [
        "run",
        "--project",
        "/path/to/your/test-mcp-server/McpServer.csproj",
        "--no-build"
      ]
    }
  }
}

Replace /path/to/your/test-mcp-server with your actual project path:

Windows:

"args": [
  "run",
  "--project",
  "C:\\Users\\YourName\\projects\\test-mcp-server\\McpServer.csproj",
  "--no-build"
]

macOS/Linux:

"args": [
  "run",
  "--project",
  "/home/username/projects/test-mcp-server/McpServer.csproj",
  "--no-build"
]

Important notes:

  • Use absolute paths to the McpServer.csproj file
  • Use double backslashes (\\) on Windows for JSON escaping
  • Ensure the project file path exists and is correct
  • The command should be dotnet (not full path)

3. Common Issues

  1. "Server not found" in Claude Desktop

    • Verify the file path in claude_desktop_config.json exists
    • Ensure the project builds successfully (dotnet build)
    • Check that .NET 9 SDK is installed (dotnet --version)
    • Try using forward slashes / instead of backslashes in paths
  2. Server starts but tools not available

    • Restart Claude Desktop completely after configuration changes
    • Check Claude Desktop's console/logs for error messages
    • Verify the server name in config matches exactly (text-transform)
  3. Build errors

    • Run dotnet restore to ensure all NuGet packages are installed
    • Verify you have .NET 9.0 SDK or later
    • Try dotnet clean followed by dotnet build

4. Advanced Debugging

Test with manual JSON-RPC:

# Initialize the server
echo '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "test", "version": "1.0.0"}}}' | dotnet run

# List available tools  
echo '{"jsonrpc": "2.0", "id": 2, "method": "tools/list"}' | dotnet run

# Test tool execution
echo '{"jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": {"name": "CapitalCase", "arguments": {"text": "hello world"}}}' | dotnet run

Check Claude Desktop logs:

  • Windows: Look in Event Viewer or Claude's application data folder
  • macOS: Use Console.app to view logs
  • Linux: Check system logs or run Claude from terminal

MCP Protocol Details

  1. Server starts but tools not available

    • Restart Claude Desktop after configuration changes
    • Check the server logs in Claude Desktop's console
  2. Build errors

    • Run dotnet restore to ensure all NuGet packages are installed
    • Verify you have .NET 9.0 SDK or later

MCP Protocol Details

This server implements the Model Context Protocol specification:

  • Transport: STDIO (JSON-RPC over stdin/stdout)
  • Protocol Version: Compatible with MCP clients
  • Tool Discovery: Automatic via [McpServerTool] attributes
  • Error Handling: Standard JSON-RPC error responses

For more details about the MCP protocol, see the official documentation.

📚 Technical Details

MCP SDK Features Used

  • ModelContextProtocol v0.2.0-preview.2
  • STDIO transport for Claude Desktop compatibility
  • Attribute-based tool registration
  • Automatic parameter validation and documentation

Dependencies

<PackageReference Include="ModelContextProtocol" Version="0.2.0-preview.2" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0" />

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Add your new MCP tools or enhancements
  4. Commit your changes (git commit -m 'Add amazing feature')
  5. Push to the branch (git push origin feature/amazing-feature)
  6. Open a Pull Request

🔮 Roadmap

  • Add more text transformation tools (kebab-case, UPPER_CASE, etc.)
  • Implement text validation and sanitization tools
  • Add support for batch text processing
  • Create comprehensive test suite
  • Add performance benchmarks "ServerName": "Text Transform MCP Server", "Version": "1.0.0", "Port": 8080, "Logging": { "LogLevel": "Information", "EnableStructuredLogging": true } } }

## Health Check

A health check endpoint is available at `/health` to verify the server status.

## Development

### Code Style

The project uses `.editorconfig` for consistent code formatting and follows:

- PascalCase for classes, methods, properties
- camelCase for private fields and parameters
- Underscore prefix for private fields (`_fieldName`)
- File-scoped namespaces
- Nullable reference types enabled

### Logging

Structured logging is implemented using `ILogger<T>` with appropriate log levels:

- **Debug**: Detailed transformation steps
- **Information**: Tool execution and server lifecycle
- **Warning**: Invalid inputs or missing tools
- **Error**: Exceptions and failures

### Testing

The project structure supports unit testing with:

- Dependency injection for testability
- Interface-based programming
- Separation of concerns

## MCP Protocol

This server implements the Model Context Protocol for integration with MCP-compatible clients. The tools can be discovered and executed through the standard MCP tool calling interface.

## License

This project is provided as-is for educational and development purposes.
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Playwright McpPlaywright MCP server
DeepChatYour AI Partner on Desktop
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
WindsurfThe new purpose-built IDE to harness magic
Tavily Mcp
Serper MCP ServerA Serper MCP Server
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
ChatWiseThe second fastest AI chatbot™
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Amap Maps高德地图官方 MCP Server
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
CursorThe AI Code Editor