mcp-simple

Tahubu-AI/mcp-simple

3.2

If you are the rightful owner of mcp-simple and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This project demonstrates a Model Context Protocol (MCP) server using .NET, featuring a Mars Photos API server and an interactive AI client.

Tools
  1. get-current-date

    Provides the current date for photo queries.

  2. photo query

    Allows querying of Mars rover photos by rover, date, and camera.

MCP .NET Demo - Mars Photos API

A complete demonstration of the Model Context Protocol (MCP) using .NET, featuring a Mars Photos API server and an interactive AI client. This project provides a simple example of how to build MCP servers and clients in .NET.

šŸš€ Overview

This solution demonstrates a simple implementation of MCP (Model Context Protocol) using .NET 9.0, featuring:

  • MCP Server: A Mars Photos API server that provides tools to query NASA's Mars rover data
  • MCP Client: An interactive console application that connects to Claude AI for natural language queries
  • Streaming HTTP Transport: Primary transport for client-server communication
  • AI Integration: Anthropic Claude AI for intelligent photo queries

šŸ—ļø Architecture

graph LR
    A[MCP Client<br/>Claude AI] -->|HTTP Streaming| B[MCP Server<br/>Mars Photos]
    B -->|HTTP| C[NASA API<br/>Mars Rovers]
    
    style A fill:#e1f5fe
    style B fill:#f3e5f5
    style C fill:#e8f5e8

Transport Options

  1. Streaming HTTP Transport (Primary)

    • Used when running the mcp-simple-client project
    • Enables real-time communication between client and server
    • Supports streaming responses for better user experience
  2. Stdio Transport (Alternative)

    • Used when running the MCP server from external clients like Claude Desktop or VS Code
    • Standard MCP transport for tool integration

Components

  1. MCP Server (mcp-simple-server/)

    • Implements Mars Photos API tools
    • Provides get-current-date and photo query capabilities
    • Handles NASA API communication
    • Supports both HTTP and stdio transports
  2. MCP Client (mcp-simple-client/)

    • Interactive console interface
    • Integrates with Claude AI via Anthropic SDK
    • Features conversation history and system prompt control
    • Demonstrates different MCP interaction modes
    • Uses streaming HTTP transport for real-time communication

šŸ› ļø Technologies Used

  • .NET 9.0 - Modern .NET framework
  • Model Context Protocol - AI tool integration standard
  • Anthropic Claude AI - Natural language processing
  • NASA Mars Photos API - Real Mars rover data
  • Microsoft.Extensions.AI - AI integration libraries
  • HTTP Streaming - Real-time client-server communication

šŸ“ Project Structure

1-simple/
ā”œā”€ā”€ README.md                    # This file
ā”œā”€ā”€ mcp-simple.sln              # Solution file
ā”œā”€ā”€ mcp-simple-server/          # MCP Server implementation
│   ā”œā”€ā”€ README.md               # Server setup and documentation
│   ā”œā”€ā”€ Program.cs              # Server entry point
│   ā”œā”€ā”€ MarsPhotosTools.cs      # MCP tools implementation
│   └── NasaApiConfiguration.cs # NASA API configuration
└── mcp-simple-client/          # MCP Client implementation
    ā”œā”€ā”€ README.md               # Client setup and documentation
    ā”œā”€ā”€ Program.cs              # Client entry point
    └── mcp-simple-client.csproj # Client project file

šŸš€ Quick Start

Prerequisites

  • .NET 9.0 SDK
  • Anthropic API key (for Claude AI access)
  • Internet connection (for NASA API access)

Setup Instructions

  1. Clone and Build

    git clone <repository-url>
    cd 1-simple
    dotnet build
    
  2. Configure API Keys

    # Set Anthropic API key for the client
    cd mcp-simple-client
    dotnet user-secrets set "ANTHROPIC_API_KEY" "your-api-key-here"
    
  3. Run the Demo

    # Start the client (it will automatically start the server)
    cd mcp-simple-client
    dotnet run
    

šŸ“– Detailed Documentation

Server Setup

For detailed server setup, configuration, and API documentation, see:

Client Setup

For client configuration, interactive menu system, and usage examples, see:

šŸŽÆ Demo Features

Interactive Menu System

  • Choose between conversation history modes
  • Toggle system prompt for date tool instructions
  • Custom configuration options

Mars Photos Queries

  • Query photos by rover, date, and camera
  • Real-time date resolution for relative queries
  • Detailed photo information and metadata

AI Integration

  • Natural language processing with Claude
  • Context-aware conversations
  • Intelligent tool selection

Streaming Communication

  • Real-time response streaming
  • Immediate feedback during AI processing
  • Enhanced user experience

šŸ”§ Development

Building from Source

# Build the entire solution
dotnet build

# Build individual projects
dotnet build mcp-simple-server
dotnet build mcp-simple-client

Debugging

  • Open the solution in Visual Studio
  • Set mcp-simple-client as the startup project
  • Press F5 to debug

🌟 Key Learning Outcomes

This demo demonstrates:

  1. MCP Server Implementation

    • Tool definition and implementation
    • API integration patterns
    • Error handling and validation
  2. MCP Client Implementation

    • Client-server communication
    • AI integration patterns
    • User experience design
  3. Real-world MCP Usage

    • Practical tool development
    • Natural language processing
    • Context management

šŸ¤ Contributing

This is a demonstration project. For contributions to the MCP specification or related tools, please refer to the official MCP documentation.

šŸ“„ License

This project is provided as a demonstration of MCP capabilities in .NET. Please refer to individual component licenses for specific terms.

šŸ”— Related Resources