A Model Context Protocol (MCP) server built with .NET that provides travel information including flights and hotels data.
- GetFlights: Search available flights with optional filtering by destination (IATA code)
- GetHotels: Search available hotels with optional filtering by city
- Case-insensitive filtering using
Contains - Data loaded from embedded JSON files
- Strongly typed with C# records
- Custom MCP protocol implementation over stdio (JSON-RPC 2.0)
- Zero external dependencies (except System.Text.Json)
- .NET 8.0: Modern C# with minimal APIs
- System.Text.Json: Fast JSON serialization
- MCP Protocol: Custom implementation of Model Context Protocol over stdio
- JSON-RPC 2.0: Standard protocol for client-server communication
- .NET 8.0 SDK or higher
- Visual Studio Code with GitHub Copilot extension
-
Clone or navigate to the project directory
cd TravelMCP
-
Restore dependencies
dotnet restore
-
Build the project
dotnet build
The project includes a pre-configured .vscode/mcp.json file. To use it:
-
Open the project in VS Code:
code .
-
Reload VS Code: Press
Ctrl+Shift+PDeveloper: Reload Window -
Open Copilot Chat: Press
Ctrl+Alt+I -
Verify tools are available: Type
@workspace /toolsin the chat
Once configured, you can interact with the server through GitHub Copilot Chat in VS Code:
Example prompts:
- "Show me all available flights"
- "Find flights to Las Vegas"
- "What hotels are available in San Francisco?"
- "Show me all hotels"
The MCP server will provide the data through the integrated tools.
Search for available flights with optional destination filtering.
Parameters:
to(optional): IATA destination code (e.g., "LAS", "SFO", "EZE")
Example usage in Copilot:
Show me flights to Las Vegas
Find flights with destination SFO
Search for available hotels with optional city filtering.
Parameters:
city(optional): City name (e.g., "Las Vegas", "San Francisco", "Buenos Aires")
Example usage in Copilot:
Show me hotels in San Francisco
Find hotels in Buenos Aires
{
"flight_number": "AA1456",
"airline": "American Airlines",
"from": "Miami (MIA)",
"to": "Las Vegas (LAS)",
"departure_time": "2025-11-05T09:45:00",
"arrival_time": "2025-11-05T12:10:00",
"duration": "5h 25m",
"price_usd": 289.99
}{
"city": "Las Vegas",
"hotel_name": "The Venetian Resort",
"rating": 4.8,
"price_per_night_usd": 289.00,
"address": "3355 S Las Vegas Blvd, Las Vegas, NV 89109, USA",
"amenities": ["Pool", "Casino", "Spa", "Free WiFi"]
}TravelMCP/
Data/
flights.json # Sample flight data
hotels.json # Sample hotel data
Mcp/
McpServer.cs # MCP server implementation
Protocol.cs # JSON-RPC protocol types
Models/
Flight.cs # Flight data model
Hotel.cs # Hotel data model
Program.cs # Application entry point
TravelServer.cs # Business logic and tool handlers
TravelMCP.csproj # Project configuration
.\test-server.ps1This will send sample MCP requests to the server and display the responses.
cd Tests
dotnet runThis runs automated tests verifying:
- Retrieving all flights
- Filtering by IATA code
- Case-insensitive partial search
- Filtering hotels by city
- Immutable records: Uses C#
recordtypes for data models - Strong typing: All data is strongly typed with JSON deserialization
- Flexible filtering: Uses
Containsfor partial searches - Case-insensitive: Searches without case distinction
- XML documentation: Code comments for IntelliSense
- Complete MCP protocol: Custom implementation without external dependencies
- Safe null handling: Optional parameters with default values
- JSON Schema: Input schema definitions for tools
- Error handling: Proper error responses per JSON-RPC 2.0
- Add date validation to filter future flights
- Implement sorting by price, rating, duration
- Add combined
GetTravelPackage(destination)tool to search flight+hotel - Additional filters: airline, price range, specific amenities
- Add seat/room availability
- Implement booking (mock)
- Connect to real flight/hotel APIs
- Data caching with temporal invalidation
- Structured logging (Serilog, NLog)
- Unit tests with xUnit/NUnit
- Integration tests for MCP protocol
- Metrics and telemetry
- IATA code validation against official list
- Multi-language support (i18n)
- Separate into layers (Data, Business, MCP)
- Dependency injection
- External configuration (appsettings.json)
- Containerization with Docker
- Health checks
- Rate limiting to prevent abuse
This is a demonstration project. Suggestions and improvements are welcome!
MIT
Built with using .NET and MCP