# McpServerAspNetCore

> Minimal implementation of an MCP sample server featuring API Key authentication, CORS support, and example server-side tools for weather and time retrieval.

- **Type:** MCP server
- **Install:** `agentstack add mcp-marcominerva-mcpserveraspnetcore`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [marcominerva](https://agentstack.voostack.com/s/marcominerva)
- **Installs:** 0
- **Category:** [Search](https://agentstack.voostack.com/c/search)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [marcominerva](https://github.com/marcominerva)
- **Source:** https://github.com/marcominerva/McpServerAspNetCore

## Install

```sh
agentstack add mcp-marcominerva-mcpserveraspnetcore
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# MCP Server with ASP.NET Core

Minimal implementation of a Model Context Protocol (MCP) server based on ASP.NET Core 10. The project serves as an example to expose MCP tools to compatible clients, including authentication, automatic discovery, and API documentation.

## Project purpose
Provide a simple, ready-to-use starting point to build an MCP server on ASP.NET Core, useful for integrating server-side tools into agents/assistants that speak MCP.

## Exposed features
- Framework: ASP.NET Core 10, minimal configuration ready for extension.
- Security: access protected via API Key.
- MCP Tool Discovery: automatic detection/exposure of the server's available MCP tools.
- OpenAPI/Swagger UI: interface to explore and test the exposed endpoints.
- CORS: enabled/configurable to allow access from secure external origins.
- Example server-side tools:
 - Weather: retrieve weather conditions for a location.
 - Time: get current date and time (e.g., for a specific time zone).

These features make it possible to connect an MCP client and automatically discover/consume the tools published by the server, with support for security, documentation, and interoperability.

## Configuration

### OpenWeatherMap API Key

The weather tools use the [OpenWeatherMap API](https://openweathermap.org/api) to retrieve weather data. To use these tools, you need to obtain a free API key:

1. Go to [OpenWeatherMap](https://openweathermap.org/) and create a free account
2. Navigate to your [API keys page](https://home.openweathermap.org/api_keys)
3. Generate a new API key (or copy your existing one)
4. Add the API key to your configuration file

#### Update appsettings.json

Open `src/McpServerAspNetCore/appsettings.json` and update the `OpenWeatherMapAppId` value:

```json
{
    "AppSettings": {
        "OpenWeatherMapBaseUrl": "https://api.openweathermap.org/data/2.5/",
        "OpenWeatherMapAppId": "YOUR_API_KEY_HERE"
    }
}
```

### Azure OpenAI Configuration (for Client Apps)

The sample client applications (`McpClientConsoleApp.ExtensionsAI` and `McpClientConsoleApp.Agents`) use Azure OpenAI to demonstrate how to integrate MCP tools with AI agents. To run these clients, you need to configure your Azure OpenAI credentials:

1. Create an [Azure OpenAI resource](https://portal.azure.com/#create/Microsoft.CognitiveServicesOpenAI) in the Azure Portal
2. Deploy a GPT model (e.g., GPT-4) from the Azure OpenAI Studio
3. Get your endpoint URL and API key from the Azure Portal (under "Keys and Endpoint")
4. Update the `Constants.cs` file in each client project

#### Update Constants.cs

Open `src/McpClientConsoleApp.ExtensionsAI/Constants.cs` (or `src/McpClientConsoleApp.Agents/Constants.cs`) and update the values:

```csharp
public static class Constants
{
    public const string Endpoint = "https://YOUR_RESOURCE_NAME.openai.azure.com/";
    public const string DeploymentName = "YOUR_DEPLOYMENT_NAME";
    public const string ApiKey = "YOUR_AZURE_OPENAI_API_KEY";
}
```

**Note:** For production applications, consider using Azure Key Vault or environment variables to store these sensitive credentials securely instead of hardcoding them.

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [marcominerva](https://github.com/marcominerva)
- **Source:** [marcominerva/McpServerAspNetCore](https://github.com/marcominerva/McpServerAspNetCore)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-marcominerva-mcpserveraspnetcore
- Seller: https://agentstack.voostack.com/s/marcominerva
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
