### Start Seq Server with Docker Compose Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/INTEGRATION_TESTS-EN.md Starts a Seq server using the project's `docker-compose.yml` file. This is an alternative to manual Docker commands for easier management. ```bash # Use docker-compose.yml from project root docker-compose up -d seq # Check status docker-compose ps ``` -------------------------------- ### Publishing and Running Seq-MCP Server Executable Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/deployment-en.md This snippet shows how to publish the Seq-MCP project into an optimized release build and then run the resulting executable. This method is recommended for production due to its fast startup and included dependencies. It requires the .NET SDK to be installed. ```bash # Publish once dotnet publish src/SeqMcp/SeqMcp.csproj -c Release -o ./publish # Run instantly ./publish/SeqMcp.exe # Windows ./publish/SeqMcp # Linux/macOS ``` -------------------------------- ### Start Seq Docker Container for Testing Source: https://github.com/weselow/seq-mcp-server/blob/master/README-EN.md This command starts a Seq server instance in a Docker container, making it available for integration tests. It maps the container's port 80 to the host's port 5341 and accepts the End User License Agreement. Ensure Docker is installed and running. ```bash docker run -d --name seq-test -e ACCEPT_EULA=Y -p 5341:80 datalust/seq ``` -------------------------------- ### Start Seq Server with Docker Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/INTEGRATION_TESTS-EN.md Launches a Seq server instance in a Docker container, making it accessible for integration tests. It maps ports 5341 and 5342 and accepts the End-User License Agreement. ```bash # Start Seq in container docker run -d \ --name seq-test \ -e ACCEPT_EULA=Y \ -p 5341:80 \ -p 5342:5341 \ datalust/seq:latest # Verify Seq is running curl http://localhost:5341/api # Open Seq UI open http://localhost:5341 ``` -------------------------------- ### Docker Compose Quick Start for Seq MCP Server Source: https://github.com/weselow/seq-mcp-server/blob/master/README-EN.md Provides commands to quickly set up and run the Seq MCP Server alongside the Seq server using Docker Compose. This includes steps for environment variable configuration, starting services, checking logs, and verifying health. ```bash # 1. Create .env file (optional) cp .env.example .env # Edit .env if needed # 2. Start both services docker-compose up -d # 3. Check logs docker-compose logs -f seq-mcp # 4. Check health curl http://localhost:5555/health # 5. Open Seq UI http://localhost:8080 ``` -------------------------------- ### Running Seq-MCP Server with Docker Compose Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/deployment-en.md This command is used to start the Seq-MCP server using Docker Compose. It assumes a docker-compose.yml file is present in the project directory, simplifying the management of containerized applications and their configurations. ```bash docker-compose up -d ``` -------------------------------- ### Claude Desktop MCP Server Configuration Source: https://github.com/weselow/seq-mcp-server/blob/master/README.md Configuration examples for integrating the Seq MCP Server with Claude Desktop. It shows minimal setup and a recommended configuration with project scope filtering using headers. This filtering optimizes token usage by retrieving logs only for a specific project. ```json { "mcpServers": { "seq": { "url": "http://localhost:5555/sse" // ОБЯЗАТЕЛЬНО: URL MCP сервера } } } ``` ```json { "mcpServers": { "seq": { "url": "http://localhost:5555/sse", // ОБЯЗАТЕЛЬНО: URL MCP сервера "headers": { "X-Seq-Project-Scope": "MyWebApp", // ОПЦИОНАЛЬНО: фильтр по проекту (экономит токены!) "X-Seq-Scope-Field": "Application" // ОПЦИОНАЛЬНО: поле для фильтрации (по умолчанию "Application") } } } } ``` -------------------------------- ### MCP Server Startup Logs Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/configuration-en.md Example log output from the MCP server upon startup, indicating the configured server URL, Seq URL, and transport protocol. This is crucial for verifying the configuration. ```log info: SeqMcp[0] Seq MCP Server starting... info: SeqMcp[0] Server URL: http://localhost:5555 info: SeqMcp[0] Seq URL: http://localhost:5341 info: SeqMcp[0] Transport: HTTP/SSE ``` -------------------------------- ### Docker Compose CLI Commands Source: https://context7.com/weselow/seq-mcp-server/llms.txt A set of essential command-line interface commands for managing the Docker Compose setup. These commands cover starting, stopping, viewing logs, scaling, and cleaning up the services defined in the docker-compose.yml file. ```bash # Start full stack docker-compose up -d # Check logs docker-compose logs -f seq-mcp # Scale for high availability docker-compose up -d --scale seq-mcp=3 # Stop and cleanup docker-compose down -v ``` -------------------------------- ### Start Seq MCP Server on Linux/macOS Source: https://github.com/weselow/seq-mcp-server/blob/master/README-EN.md Starts the Seq MCP server on Linux or macOS using bash. Requires setting the SEQ_URL and optionally SEQ_API_KEY environment variables before executing the application. This configuration is minimal, using only required parameters. ```bash # Minimal configuration (required parameters only) export SEQ_URL="http://localhost:5341" # REQUIRED: Seq server URL export SEQ_API_KEY="your-api-key" # OPTIONAL: API key (if Seq requires authentication) ./publish/SeqMcp ``` -------------------------------- ### Start MCP Server on Linux/macOS Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/configuration-en.md Commands to start the MCP server executable on Linux or macOS. Environment variables can be prepended to the command for configuration. ```bash # Linux/macOS cd /path/to/seq-mcp-server/publish ./SeqMcp ``` ```bash # Linux/macOS with environment variables SEQ_URL="http://localhost:5341" SEQ_API_KEY="your-key" PORT="5555" ./SeqMcp ``` -------------------------------- ### Start Seq MCP Server on Windows (PowerShell) Source: https://github.com/weselow/seq-mcp-server/blob/master/README-EN.md Starts the Seq MCP server on Windows using PowerShell. Requires setting the SEQ_URL and optionally SEQ_API_KEY environment variables before executing the application. This configuration is minimal, using only required parameters. ```powershell # Minimal configuration (required parameters only) $env:SEQ_URL="http://localhost:5341" # REQUIRED: Seq server URL $env:SEQ_API_KEY="your-api-key" # OPTIONAL: API key (if Seq requires authentication) ./publish\SeqMcp.exe ``` -------------------------------- ### Development: Running Seq-MCP Server with 'dotnet run' Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/deployment-en.md This command initiates the Seq-MCP server using 'dotnet run', which is convenient for active development as it handles rebuilding and running. However, it has a slower startup time compared to a published executable and is not recommended for production or Claude Desktop. ```bash cd src/SeqMcp dotnet run ``` -------------------------------- ### GitHub Actions CI for Integration Tests Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/INTEGRATION_TESTS.md This GitHub Actions workflow configures integration tests for the project. It sets up the .NET environment, starts a Seq server as a service, waits for Seq to become available, and then runs the integration tests, passing the Seq URL as an environment variable. ```yaml name: Integration Tests on: [push, pull_request] jobs: integration-tests: runs-on: ubuntu-latest services: seq: image: datalust/seq:latest ports: - 5341:80 env: ACCEPT_EULA: Y steps: - uses: actions/checkout@v3 - name: Setup .NET uses: actions/setup-dotnet@v3 with: dotnet-version: '9.0.x' - name: Wait for Seq run: | timeout 30 bash -c 'until curl -f http://localhost:5341/api; do sleep 1; done' - name: Run Integration Tests run: dotnet test --filter "IntegrationTests" env: SEQ_URL: http://localhost:5341 ``` -------------------------------- ### Stop Seq Server with Docker Compose Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/INTEGRATION_TESTS-EN.md Stops and removes all services defined in the `docker-compose.yml` file, including the Seq server. This is the counterpart to starting services with Docker Compose. ```bash # Docker Compose docker-compose down ``` -------------------------------- ### Start MCP Server on Windows Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/configuration-en.md Commands to start the MCP server executable on Windows. It can be run directly or with environment variables set for configuration. ```bash # Windows (PowerShell) cd M:\repos\seq-mcp-server\publish .\SeqMcp.exe ``` ```bash # Windows (PowerShell) with environment variables $env:SEQ_URL="http://localhost:5341" $env:SEQ_API_KEY="your-key" $env:PORT="5555" .\SeqMcp.exe ``` -------------------------------- ### Build and Publish Seq MCP Server (CLI) Source: https://github.com/weselow/seq-mcp-server/blob/master/README.md This command sequence is used for building and publishing the Seq MCP Server project locally. It assumes the .NET 9 SDK is installed and a Seq server is running separately. This is an alternative to using the Docker image. ```bash dotnet publish -c Release -o ./publish cd publish currentChar = "/" ``` -------------------------------- ### Configuring Seq-MCP Server for Claude Desktop Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/deployment-en.md This JSON configuration is used for setting up Claude Desktop to communicate with the Seq-MCP server. It specifies the server URL and optional headers. Ensure the server is running before configuring Claude Desktop. ```json { "mcpServers": { "seq": { "url": "http://localhost:5555/sse", "headers": { "X-Seq-Project-Scope": "MyProject" } } } } ``` -------------------------------- ### Check Seq Server Docker Logs Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/INTEGRATION_TESTS-EN.md Retrieves the logs from the running Seq Docker container. This is essential for diagnosing issues when the Seq server fails to start or operate correctly. ```bash # Check Docker logs docker logs seq-test ``` -------------------------------- ### Check Port Availability Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/INTEGRATION_TESTS-EN.md Lists network connections and listening ports on the system, used to verify if port 5341 is occupied by another process before starting Seq. ```bash # Check ports netstat -an | grep 5341 ``` -------------------------------- ### Run All .NET Integration Tests Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/INTEGRATION_TESTS-EN.md Executes all integration tests within the project using the .NET CLI. Tests marked with 'Skip' will be ignored by default. ```bash dotnet test ``` -------------------------------- ### Updating Published Seq-MCP Server Version Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/deployment-en.md This sequence of commands outlines the process for updating the published version of the Seq-MCP server. It involves running tests, republishing the project, and restarting the server or dependent applications like Claude Desktop. ```bash # 1. Run tests dotnet test # 2. Republish dotnet publish src/SeqMcp/SeqMcp.csproj -c Release -o ./publish # 3. Restart Claude Desktop (if using) ``` -------------------------------- ### Running Seq-MCP Server with Docker Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/deployment-en.md This command demonstrates how to run the Seq-MCP server as a Docker container. It maps port 5555 and allows setting environment variables for the SEQ URL and API key. This is a convenient way to deploy the server in an isolated environment. ```bash docker run -d \ --name seq-mcp \ -p 5555:5555 \ -e SEQ_URL=http://your-seq-server:5341 \ -e SEQ_API_KEY=your-api-key-if-needed \ ghcr.io/weselow/seq-mcp-server:latest ``` -------------------------------- ### Example: Filtering Seq Events via Environment Variables (.NET CLI) Source: https://github.com/weselow/seq-mcp-server/blob/master/README-EN.md This example shows how to set environment variables for project scope filtering before running the Seq MCP server using the .NET CLI. This method requires setting variables in the shell prior to execution. ```bash export SEQ_PROJECT_SCOPE="MyProject" export SEQ_SCOPE_FIELD="Application" dotnet run ``` -------------------------------- ### Local GitHub Actions Testing with Act Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/CICD.md Shows how to install and use the 'act' tool to run GitHub Actions workflows locally. It covers listing workflows, running specific workflows or jobs, and passing secrets. ```bash # Install act # macOS: brew install act # Windows: choco install act-cli # Linux: curl https://raw.githubusercontent.com/nektos/act/master/install.sh | bash # List workflows act -l # Run CI workflow act push -W .github/workflows/ci.yml # Run specific job act push -j build-and-test # Run with secrets act push -s GITHUB_TOKEN=your-token ``` -------------------------------- ### Claude Desktop MCP Server Configuration Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/configuration-en.md Example configuration for Claude Desktop to connect to the MCP server using HTTP/SSE. It specifies the server URL and custom headers for project and scope. ```json { "mcpServers": { "seq": { "url": "http://localhost:5555/sse", "headers": { "X-Seq-Project-Scope": "MyProject", "X-Seq-Scope-Field": "Application" } } } } ``` -------------------------------- ### Build Seq MCP Server with .NET CLI Source: https://github.com/weselow/seq-mcp-server/blob/master/README-EN.md This command initiates the build process for the Seq MCP Server project using the .NET CLI. It's a prerequisite step for running the server locally without Docker, assuming the .NET 9 SDK is installed. ```bash dotnet build ``` -------------------------------- ### Configure Integration Tests with Environment Variables Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/INTEGRATION_TESTS-EN.md Sets environment variables for integration tests, including the Seq server URL and API key. This is typically done in a `.env` file or directly in the shell. ```bash # .env for integration tests export SEQ_URL="http://localhost:5341" export SEQ_API_KEY="your-api-key-if-needed" ``` -------------------------------- ### Compromise: Running Seq-MCP Server with 'dotnet run --no-build' Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/deployment-en.md This method allows running the Seq-MCP server without recompiling, using the last build. It requires a prior manual build and is slower than a published executable but faster than a full 'dotnet run'. It's suitable as a compromise between development speed and startup performance. ```bash # Build first dotnet build src/SeqMcp/SeqMcp.csproj -c Release # Then run dotnet run --no-build --project src/SeqMcp/SeqMcp.csproj ``` -------------------------------- ### Example: Filtering Seq Events via HTTP Headers (curl) Source: https://github.com/weselow/seq-mcp-server/blob/master/README-EN.md This example demonstrates how to send a request to the MCP server with custom HTTP headers for project scope filtering using curl. This method is advantageous as it allows for dynamic filtering without restarting the server. ```bash curl -H "X-Seq-Project-Scope: MyProject" \ -H "X-Seq-Scope-Field: Application" \ http://localhost:5555/mcp/v1 ``` -------------------------------- ### CI Workflow Configuration (YAML) Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/CICD.md Defines the Continuous Integration workflow for the Seq MCP Server. This workflow handles building, testing, and publishing artifacts. It includes steps for code checkout, .NET SDK setup, dependency management, building, running unit tests, and uploading test results. It also includes linting and formatting checks, and publishes artifacts only for the main branches. ```yaml # .github/workflows/ci.yml name: CI on: push: branches: [ master, main, develop ] pull_request: branches: [ master, main, develop ] workflow_dispatch: jobs: build-and-test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup .NET SDK uses: actions/setup-dotnet@v4 with: dotnet-version: '9.0.x' - name: Cache NuGet packages uses: actions/cache@v4 with: path: ~/.nuget/packages key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} restore-keys: \ ${{ runner.os }}-nuget- - name: Restore dependencies run: dotnet restore - name: Build run: dotnet build --no-restore --configuration Release - name: Test run: dotnet test --no-build --configuration Release --logger trx --results-directory ./TestResults - name: Upload test results uses: actions/upload-artifact@v4 with: name: test-results path: ./TestResults - name: Generate test report # This step would typically involve a tool to process TRX files into a readable report run: echo "Generating test report..." lint-and-format-check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup .NET SDK uses: actions/setup-dotnet@v4 with: dotnet-version: '9.0.x' - name: Restore dependencies run: dotnet restore - name: Check code formatting run: dotnet format --verify-no-changes - name: Build with warnings as errors run: dotnet build --configuration Release /p:WarningsAsErrors=true publish-artifacts: runs-on: ubuntu-latest needs: [ build-and-test, lint-and-format-check ] if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' steps: - uses: actions/checkout@v4 - name: Setup .NET SDK uses: actions/setup-dotnet@v4 with: dotnet-version: '9.0.x' - name: Publish application run: dotnet publish -c Release -o ./publish - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: published-app path: ./publish retention-days: 7 ``` -------------------------------- ### Docker Compose for Seq and MCP Server Source: https://context7.com/weselow/seq-mcp-server/llms.txt This Docker Compose file defines the services for running the Seq log server and the MCP server. It includes environment variables, port mappings, volume definitions, and health checks. It's designed for a full-stack setup. ```yaml version: '3.8' services: seq: image: datalust/seq:latest container_name: seq environment: - ACCEPT_EULA=Y ports: - "8080:80" # Seq UI - "5341:5341" # Seq ingestion volumes: - seq-data:/data healthcheck: test: ["CMD", "curl", "-f", "http://localhost/api"] interval: 30s timeout: 10s retries: 3 seq-mcp: image: ghcr.io/weselow/seq-mcp-server:latest container_name: seq-mcp ports: - "5555:5555" environment: - SEQ_URL=http://seq:80 - SEQ_PROJECT_SCOPE=MyWebApp - SEQ_SCOPE_FIELD=Application depends_on: seq: condition: service_healthy healthcheck: test: ["CMD", "curl", "-f", "http://localhost:5555/health"] interval: 30s timeout: 10s retries: 3 restart: always volumes: seq-data: ``` -------------------------------- ### Run .NET Integration Tests with Explicit Seq URL Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/INTEGRATION_TESTS-EN.md Configures and runs .NET integration tests by explicitly setting the Seq server URL via an environment variable. This is useful if the Seq server is running on a non-default address. ```bash export SEQ_URL="http://localhost:5341" dotnet test ``` -------------------------------- ### Run Specific .NET Integration Tests Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/INTEGRATION_TESTS-EN.md Executes integration tests filtered by a specific name or pattern, useful for targeting particular test files or classes. This bypasses the default 'Skip' attribute. ```bash # Run specific test file dotnet test --filter "FullyQualifiedName~SeqApiClientSignalManagementIntegrationTests" ``` -------------------------------- ### Filter .NET Tests by Fully Qualified Name Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/INTEGRATION_TESTS-EN.md An alternative method using the .NET CLI to run tests by filtering on their fully qualified names, which can be more specific than just class names. ```bash dotnet test --filter "FullyQualifiedName~IntegrationTests" ``` -------------------------------- ### Example: Filtering Seq Events via appsettings.json Source: https://github.com/weselow/seq-mcp-server/blob/master/README-EN.md This JSON configuration snippet shows how to configure project scope filtering directly within the application's appsettings.json file. This provides a persistent configuration for the Seq MCP server. ```json { "Seq": { "Url": "http://localhost:8080", "ApiKey": "your-api-key", "ProjectScope": "MyProject", "ScopeField": "Application" } } ``` -------------------------------- ### C# Seq Availability Check in Integration Tests Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/INTEGRATION_TESTS.md Shows a C# integration test example that checks for Seq server availability before executing test logic. If Seq is not available, the test is skipped, preventing failures due to external dependencies. This uses a helper class `SeqTestHelper` to abstract the availability check. ```csharp using SeqMcp.Tests.Helpers; [Fact] public async Task MyIntegrationTest() { // Skip test if Seq is not available if (await SeqTestHelper.ShouldSkipIntegrationTest()) { return; } // Test logic... } ``` -------------------------------- ### Automatic Signal Cleanup in C# Integration Tests Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/INTEGRATION_TESTS-EN.md Demonstrates the use of `IAsyncLifetime` in C# integration tests for automatic cleanup of resources, specifically deleting created signals. The `DisposeAsync` method ensures cleanup even if errors occur. ```csharp public class SeqApiClientSignalManagementIntegrationTests : IAsyncLifetime { public Task InitializeAsync() => Task.CompletedTask; public async Task DisposeAsync() { // Automatic cleanup of created signals if (!string.IsNullOrEmpty(_createdSignalId)) { await client.DeleteSignalAsync(_createdSignalId); } } } ``` -------------------------------- ### Seq Get Applications Source: https://github.com/weselow/seq-mcp-server/blob/master/README-EN.md Retrieves a list of applications that are logging to Seq. It accepts an optional 'limit' parameter for the maximum number of applications. The output is a JSON object containing a list of applications with their names and event counts, along with the total count. ```json { "Applications": [ { "Name": "WebApp", "EventCount": 15420 }, { "Name": "BackgroundService", "EventCount": 8932 } ], "TotalCount": 2 } ``` -------------------------------- ### Seq MCP Server Initialization Source: https://context7.com/weselow/seq-mcp-server/llms.txt Illustrates how to initialize the Seq MCP Server with dependency injection, MCP protocol registration, and production-optimized HttpClient. ```APIDOC ## Seq MCP Server Initialization ### Description Complete server setup with dependency injection, MCP protocol registration, and production-optimized HttpClient. ### Method Not Applicable (Server Initialization) ### Endpoint Not Applicable (Server Initialization) ### Request Body Not Applicable ### Response Not Applicable ### Request Example ```csharp // Program.cs - Server initialization with all features var builder = WebApplication.CreateBuilder(args); // Configure Seq connection (priority: appsettings.json > ENV) var seqUrl = builder.Configuration["Seq:Url"] ?? Environment.GetEnvironmentVariable("SEQ_URL") ?? "http://localhost:8080"; var seqApiKey = Environment.GetEnvironmentVariable("SEQ_API_KEY"); var seqConfig = new SeqServerConfig(seqUrl, seqApiKey, null, null); // Register singleton HttpClient with connection pooling (10 concurrent connections) builder.Services.AddSingleton(sp => { var handler = new SocketsHttpHandler { PooledConnectionLifetime = TimeSpan.FromMinutes(5), MaxConnectionsPerServer = 10, ConnectTimeout = TimeSpan.FromSeconds(15) }; var client = new HttpClient(handler) { Timeout = TimeSpan.FromSeconds(30), BaseAddress = new Uri(seqConfig.ServerUrl) }; if (!string.IsNullOrEmpty(seqConfig.ApiKey)) { client.DefaultRequestHeaders.Add("X-Seq-ApiKey", seqConfig.ApiKey); } return client; }); // Register MCP server with HTTP/SSE transport builder.Services.AddMcpServer() .WithHttpTransport() .WithTools() .WithResources() .WithPrompts(); var app = builder.Build(); app.MapMcp(); // Exposes /sse and /mcp/v1 endpoints await app.RunAsync(); ``` ``` -------------------------------- ### Dockerfile for Seq-MCP Server Source: https://context7.com/weselow/seq-mcp-server/llms.txt This Dockerfile outlines a multi-stage build process for the Seq-MCP server. It first builds the .NET application using the SDK image and then copies the published output to an ASP.NET Core runtime image, setting up the necessary configurations for deployment. ```dockerfile # Dockerfile - Multi-stage build FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build WORKDIR /src COPY ["src/SeqMcp/SeqMcp.csproj", "src/SeqMcp/"] RUN dotnet restore "src/SeqMcp/SeqMcp.csproj" COPY . . RUN dotnet publish "src/SeqMcp/SeqMcp.csproj" -c Release -o /app/publish FROM mcr.microsoft.com/dotnet/aspnet:9.0 WORKDIR /app COPY --from=build /app/publish . EXPOSE 5555 ENTRYPOINT ["dotnet", "SeqMcp.dll"] ``` -------------------------------- ### Initialize Seq MCP Server with DI and HTTP/SSE Transport Source: https://context7.com/weselow/seq-mcp-server/llms.txt Sets up the Seq MCP Server by configuring dependency injection, registering the MCP protocol with HTTP/SSE transport, and creating a singleton HttpClient with optimized connection pooling. It reads Seq connection details from configuration or environment variables. ```csharp var builder = WebApplication.CreateBuilder(args); // Configure Seq connection (priority: appsettings.json > ENV) var seqUrl = builder.Configuration["Seq:Url"] ?? Environment.GetEnvironmentVariable("SEQ_URL") ?? "http://localhost:8080"; var seqApiKey = Environment.GetEnvironmentVariable("SEQ_API_KEY"); var seqConfig = new SeqServerConfig(seqUrl, seqApiKey, null, null); // Register singleton HttpClient with connection pooling (10 concurrent connections) builder.Services.AddSingleton(sp => { var handler = new SocketsHttpHandler { PooledConnectionLifetime = TimeSpan.FromMinutes(5), MaxConnectionsPerServer = 10, ConnectTimeout = TimeSpan.FromSeconds(15) }; var client = new HttpClient(handler) { Timeout = TimeSpan.FromSeconds(30), BaseAddress = new Uri(seqConfig.ServerUrl) }; if (!string.IsNullOrEmpty(seqConfig.ApiKey)) { client.DefaultRequestHeaders.Add("X-Seq-ApiKey", seqConfig.ApiKey); } return client; }); // Register MCP server with HTTP/SSE transport builder.Services.AddMcpServer() .WithHttpTransport() .WithTools() .WithResources() .WithPrompts(); var app = builder.Build(); app.MapMcp(); // Exposes /sse and /mcp/v1 endpoints await app.RunAsync(); ``` -------------------------------- ### Building and Running Seq MCP Server Docker Image Source: https://github.com/weselow/seq-mcp-server/blob/master/README-EN.md Instructions for building a custom Docker image for the Seq MCP Server and running it as a container. Covers image building, container execution with port mapping and environment variables, and log checking. ```bash # Build image docker build -t seq-mcp-server:latest . # Run container docker run -d \ --name seq-mcp \ -p 5555:5555 \ -e SEQ_URL=http://your-seq-server:80 \ -e SEQ_API_KEY=your-api-key \ seq-mcp-server:latest # Check logs docker logs -f seq-mcp # Check health docker exec seq-mcp curl http://localhost:5555/health ``` -------------------------------- ### Local Docker Image Testing Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/CICD.md Demonstrates how to build a Docker image locally, run it as a container, check its logs, and then stop and remove the container. It configures a SEQ_URL environment variable for the container. ```bash # Build Docker image docker build -t seq-mcp-server:local . # Run container docker run -d \ --name seq-mcp-test \ -e SEQ_URL=http://host.docker.internal:5341 \ -p 5555:5555 \ seq-mcp-server:local # Check logs docker logs seq-mcp-test # Stop and remove docker stop seq-mcp-test docker rm seq-mcp-test ``` -------------------------------- ### GET /health - Health Check Endpoint Source: https://context7.com/weselow/seq-mcp-server/llms.txt Monitor server status and Seq connectivity with response time metrics. ```APIDOC ## GET /health - Health Check Endpoint ### Description Monitor server status and Seq connectivity with response time metrics. ### Method GET ### Endpoint /health ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```bash curl http://localhost:5555/health ``` ### Response #### Success Response (200 OK) Returns a JSON object with server status and Seq connectivity details. #### Response Example ```json { "status": "healthy", "version": "1.0.0.0", "uptimeSeconds": 3600, "seqConnection": { "isHealthy": true, "message": "Connected to Seq server", "responseTimeMs": 45 }, "metrics": { "total_requests": 150, "uptime_seconds": 3600, "seq_response_time_ms": 45 } } ``` #### Error Response (503 Service Unavailable) Returned when the server is unhealthy or cannot connect to Seq. #### Response Example ```json { "status": "unhealthy", "seqConnection": { "isHealthy": false, "message": "Connection failed: Connection refused" } } ``` ``` -------------------------------- ### Local .NET Project Testing Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/CICD.md Provides commands to restore dependencies, build, test, and check formatting for a .NET project locally. It also shows how to build with warnings treated as errors. ```bash # Restore dependencies dotnet restore # Build dotnet build --configuration Release # Run tests dotnet test --configuration Release --verbosity normal # Check formatting dotnet format --verify-no-changes # Build with warnings as errors dotnet build --configuration Release /p:TreatWarningsAsErrors=true ``` -------------------------------- ### Modify MCP Server Port in appsettings.json Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/configuration-en.md Example of how to change the MCP server's listening port by editing the appsettings.json file. This setting is overridden by the PORT environment variable. ```json { "McpServer": { "Port": 7777 // Change to desired port } } ``` -------------------------------- ### GET /health - Health Check Endpoint Source: https://github.com/weselow/seq-mcp-server/blob/master/README-EN.md This endpoint provides the current status and availability of the Seq MCP Server and its connection to the Seq server. ```APIDOC ## GET /health ### Description Provides the server's health status, version, uptime, and Seq server connection details. ### Method GET ### Endpoint `/health` ### Parameters None ### Request Example ```bash curl http://localhost:5555/health ``` ### Response #### Success Response (200 OK) - **status** (string) - Indicates if the server is 'healthy' or 'unhealthy'. - **version** (string) - The server version. - **uptimeSeconds** (integer) - The server's uptime in seconds. - **seqConnection** (object) - Details about the Seq server connection. - **isHealthy** (boolean) - True if connected to Seq, false otherwise. - **message** (string) - A message describing the Seq connection status. - **responseTimeMs** (integer) - The response time from the Seq server in milliseconds. - **metrics** (object) - Performance metrics. - **total_requests** (integer) - Total number of health check requests. - **uptime_seconds** (integer) - Server uptime in seconds. - **seq_response_time_ms** (integer) - Seq server response time in milliseconds. #### Response Example (Healthy) ```json { "status": "healthy", "version": "1.0.0.0", "uptimeSeconds": 3600, "seqConnection": { "isHealthy": true, "message": "Connected to Seq server", "responseTimeMs": 45 }, "metrics": { "total_requests": 150, "uptime_seconds": 3600, "seq_response_time_ms": 45 } } ``` #### Response Example (Unhealthy) ```json { "status": "unhealthy", "version": "1.0.0.0", "uptimeSeconds": 3600, "seqConnection": { "isHealthy": false, "message": "Connection failed: Connection refused", "responseTimeMs": 1000 }, "metrics": { "total_requests": 150, "uptime_seconds": 3600, "seq_response_time_ms": 1000 } } ``` ``` -------------------------------- ### Find Process Using a Port Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/INTEGRATION_TESTS-EN.md Identifies the process ID (PID) that is using a specific network port (e.g., 5341). This helps in troubleshooting port conflicts. ```bash # Ensure port is not occupied lsof -i :5341 ``` -------------------------------- ### Stop Seq Server with Docker Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/INTEGRATION_TESTS-EN.md Stops and removes the Seq server Docker container named 'seq-test'. This command cleans up the container after integration tests are completed. ```bash # Docker docker stop seq-test docker rm seq-test ``` -------------------------------- ### Dotnet CLI Commands for Running Tests Source: https://context7.com/weselow/seq-mcp-server/llms.txt A collection of dotnet CLI commands for executing tests within the project. This includes running all tests, collecting code coverage, filtering tests by name or category, and setting up an integration test environment by running a Seq server. ```bash # Run all tests dotnet test # Run with coverage dotnet test --collect:"XPlat Code Coverage" # Run specific test class dotnet test --filter "FullyQualifiedName~SeqApiClientTests" # Integration tests (requires running Seq) docker run -d --name seq-test -e ACCEPT_EULA=Y -p 5341:80 datalust/seq dotnet test --filter "Category=Integration" # Test statistics: # - 35 unit tests (always run) # - 13 integration tests (require Seq server) # - 94.4% method coverage, 41.9% line coverage ``` -------------------------------- ### Run All Tests with .NET CLI Source: https://github.com/weselow/seq-mcp-server/blob/master/README-EN.md This command executes all unit and integration tests for the .NET project. It's the standard way to ensure the project's codebase is functioning correctly. No external dependencies are required beyond the .NET SDK. ```bash dotnet test ``` -------------------------------- ### Remove Skip Attribute from C# Test Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/INTEGRATION_TESTS-EN.md Shows how to remove the `Skip` attribute from a C# test method. This is necessary to enable tests that are conditionally excluded, such as integration tests requiring a running Seq server. ```csharp // Before [Fact(Skip = "Requires running Seq server at http://localhost:5341")] // After [Fact] ``` -------------------------------- ### Kubernetes Deployment for seq-mcp-server Source: https://github.com/weselow/seq-mcp-server/blob/master/README.md This Kubernetes Deployment configuration defines how to deploy the seq-mcp-server application. It specifies the number of replicas, labels, container image, exposed port, environment variables (including fetching the API key from secrets), and probes for liveness and readiness. Resource requests and limits for CPU and memory are also defined. ```yaml apiVersion: apps/v1 kind: Deployment metadata: name: seq-mcp-server spec: replicas: 2 selector: matchLabels: app: seq-mcp template: metadata: labels: app: seq-mcp spec: containers: - name: seq-mcp image: your-registry/seq-mcp-server:latest ports: - containerPort: 5555 env: - name: SEQ_URL value: "http://seq-service:80" - name: SEQ_API_KEY valueFrom: secretKeyRef: name: seq-credentials key: api-key livenessProbe: httpGet: path: /health port: 5555 initialDelaySeconds: 10 periodSeconds: 30 readinessProbe: httpGet: path: /health port: 5555 initialDelaySeconds: 5 periodSeconds: 10 resources: limits: cpu: 500m memory: 512Mi requests: cpu: 250m memory: 256Mi ``` -------------------------------- ### Claude Desktop Configuration for Seq MCP Server Source: https://github.com/weselow/seq-mcp-server/blob/master/README-EN.md This JSON configuration snippet is for Claude Desktop, defining how to connect to the Seq MCP server. It specifies the URL and includes optional headers for project filtering, which is the recommended approach for dynamic filtering. ```json { "mcpServers": { "seq": { "url": "http://localhost:5555/sse", "headers": { "X-Seq-Project-Scope": "MyWebApp", // OPTIONAL: project filter - configure for your application "X-Seq-Scope-Field": "Application" // OPTIONAL: filtering field (default "Application") } } } } ``` -------------------------------- ### Publish Seq MCP Server Application Source: https://github.com/weselow/seq-mcp-server/blob/master/README-EN.md This command publishes the Seq MCP application using the .NET CLI. It builds the project in 'Release' configuration and outputs the published files to the './publish' directory. ```bash dotnet publish src/SeqMcp/SeqMcp.csproj -c Release -o ./publish ``` -------------------------------- ### Configure Matrix Builds in GitHub Actions Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/CICD.md This snippet demonstrates how to configure matrix builds in GitHub Actions for multi-platform testing. It defines a matrix strategy that will run jobs across different operating systems (ubuntu-latest, windows-latest, macos-latest) and .NET versions ('8.0.x', '9.0.x'). ```yaml strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] dotnet: ['8.0.x', '9.0.x'] ``` -------------------------------- ### README Badges for GitHub Workflows Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/CICD.md Markdown snippets to display the status of CI, Docker Build and Push, Security, and CodeQL workflows as badges in a README.md file. These badges provide a visual indicator of the workflow status. ```markdown ![CI](https://github.com/YOUR_USERNAME/seq-mcp-server/workflows/CI/badge.svg) ![Docker](https://github.com/YOUR_USERNAME/seq-mcp-server/workflows/Docker%20Build%20and%20Push/badge.svg) ![Security](https://github.com/YOUR_USERNAME/seq-mcp-server/workflows/Security%20and%20Code%20Quality/badge.svg) ![CodeQL](https://github.com/YOUR_USERNAME/seq-mcp-server/workflows/CodeQL/badge.svg) ``` -------------------------------- ### Run Tests with Code Coverage using .NET CLI Source: https://github.com/weselow/seq-mcp-server/blob/master/README-EN.md This command runs all tests and generates a code coverage report. This is useful for identifying which parts of the codebase are adequately tested and which areas might need more test coverage. Requires the .NET SDK. ```bash dotnet test --collect:"XPlat Code Coverage" ``` -------------------------------- ### Running Tests with Dotnet CLI Source: https://github.com/weselow/seq-mcp-server/blob/master/README.md These bash commands are used to execute tests for the seq-mcp-server project. The first command runs all tests, while the second command runs tests with code coverage collection enabled using the 'XPlat Code Coverage' collector. ```bash # Запуск всех тестов dotnet test ``` ```bash # Запуск с покрытием dotnet test --collect:"XPlat Code Coverage" ``` -------------------------------- ### Seq MCP Server Configuration via Environment Variables Source: https://github.com/weselow/seq-mcp-server/blob/master/README-EN.md This section details the environment variables used to configure the Seq MCP server's connection to Seq and its own port. It clarifies the purpose of each variable and notes that SEQ_URL takes priority over SEQ_SERVER_URL. ```bash # Seq server connection (both variants supported) export SEQ_URL="http://localhost:8080" # Default: http://localhost:8080 export SEQ_SERVER_URL="http://localhost:8080" # Alternative name (for compatibility) export SEQ_API_KEY="your-api-key" # Optional, for authenticated Seq instances # MCP server port export PORT="5555" # Default: 5555 # Project filtering (optional) export SEQ_PROJECT_SCOPE="MyProject" # Optional: filter by project name export SEQ_SCOPE_FIELD="Application" # Default: "Application" ``` -------------------------------- ### Docker Image Usage (Bash) Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/CICD.md Demonstrates how to pull and run the Seq MCP Server Docker image. It shows commands for pulling the latest image from GitHub Container Registry and running it as a detached container, including essential environment variables for Seq URL and API key, and port mapping. ```bash # Pull latest image docker pull ghcr.io/YOUR_USERNAME/seq-mcp-server:latest # Run container docker run -d \ -e SEQ_URL=http://seq-server:5341 \ -e SEQ_API_KEY=your-api-key \ -p 5555:5555 \ ghcr.io/YOUR_USERNAME/seq-mcp-server:latest ``` -------------------------------- ### Docker Workflow Configuration (YAML) Source: https://github.com/weselow/seq-mcp-server/blob/master/docs/CICD.md Defines the Docker build and push workflow for the Seq MCP Server. This workflow is triggered by pushes to main/master branches and tags. It sets up Docker Buildx, logs into the GitHub Container Registry, builds the Docker image with appropriate tags and labels, and pushes the image. It skips registry login on pull requests. ```yaml # .github/workflows/docker.yml name: Docker Build and Push on: push: branches: [ master, main ] tags: 'v*' pull_request: branches: [ master, main ] workflow_dispatch: jobs: build-and-push: runs-on: ubuntu-latest permissions: contents: read packages: write steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} if: github.event_name != 'pull_request' - name: Extract Docker metadata id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository_owner }}/seq-mcp-server tags: | # (optional) matrix of tags, can be uncommented if needed type=raw,value=latest,enable={{is_default_branch}} type=raw,value=develop,enable={{is_default_branch}} type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} type=sha - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - name: Output image digest run: echo "Image digest - ${{ steps.docker_build.outputs.digest }}" ```