Features/mcp server - #56
Conversation
45fe381 to
e319b57
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new opencertserver.mcp server project intended to expose CA functionality via MCP/JSON-RPC over stdio, alongside a new Reqnroll-based test suite for MCP behaviors. The PR also centralizes NuGet package version management and removes the old shared.proj imports across many projects.
Changes:
- Introduce
src/opencertserver.mcp(server host, stdio transport, MCP core DTOs/options, tool registration helper). - Add
tests/opencertserver.mcp.testswith Reqnroll features/steps to validate MCP tool registration and tool behaviors. - Migrate multiple projects to Central Package Management (
Directory.Packages.props) and simplify csproj package references / removeshared.proj.
Reviewed changes
Copilot reviewed 74 out of 80 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/opencertserver.tpm.tests/opencertserver.tpm.tests.csproj | Switches to central package versions and normalizes csproj formatting. |
| tests/opencertserver.mcp.tests/TestSharedState.cs | Adds shared state container for Reqnroll step definitions (used across MCP test scenarios). |
| tests/opencertserver.mcp.tests/Support/McpServerFixture.cs | Introduces test fixture to host an in-memory CA + MCP server for scenario execution. |
| tests/opencertserver.mcp.tests/StepDefinitions/McpServerToolsSteps.cs | Step definitions for tool registration/listing checks. |
| tests/opencertserver.mcp.tests/StepDefinitions/McpServerRevocationSteps.cs | Step definitions for CRL/OCSP/revocation-status tool scenarios. |
| tests/opencertserver.mcp.tests/StepDefinitions/McpServerMetadataSteps.cs | Step definitions for get_server_metadata validation. |
| tests/opencertserver.mcp.tests/StepDefinitions/McpServerCertificateQuerySteps.cs | Step definitions for list/search/get/get-ca-certs tool scenarios. |
| tests/opencertserver.mcp.tests/StepDefinitions/McpServerCertificateOperationsSteps.cs | Step definitions for sign/revoke tool scenarios and inventory assertions. |
| tests/opencertserver.mcp.tests/StepDefinitions/CommonToolsSteps.cs | Shared steps for asserting success/failure + common error-message checks. |
| tests/opencertserver.mcp.tests/opencertserver.mcp.tests.csproj | Adds the MCP test project and references to MCP + CA projects. |
| tests/opencertserver.mcp.tests/Features/McpServerTools.feature.cs | Generated Reqnroll test runner for tool-registration feature. |
| tests/opencertserver.mcp.tests/Features/McpServerTools.feature | Feature spec for tool registration expectations. |
| tests/opencertserver.mcp.tests/Features/McpServerRevocation.feature | Feature spec for CRL/OCSP/revocation-status expectations. |
| tests/opencertserver.mcp.tests/Features/McpServerMetadata.feature.cs | Generated Reqnroll test runner for metadata feature. |
| tests/opencertserver.mcp.tests/Features/McpServerMetadata.feature | Feature spec for server metadata output. |
| tests/opencertserver.mcp.tests/Features/McpServerCertificateQuery.feature.cs | Generated Reqnroll test runner for certificate query feature. |
| tests/opencertserver.mcp.tests/Features/McpServerCertificateQuery.feature | Feature spec for list/search/get/get-ca-certs behaviors. |
| tests/opencertserver.mcp.tests/Features/McpServerCertificateOperations.feature.cs | Generated Reqnroll test runner for sign/revoke feature. |
| tests/opencertserver.mcp.tests/Features/McpServerCertificateOperations.feature | Feature spec for sign/revoke tool behaviors and inventory effects. |
| tests/opencertserver.lambda.tests/opencertserver.lambda.tests.csproj | Removes shared.proj import and moves to central package versions. |
| tests/opencertserver.est.server.tests/opencertserver.est.server.tests.csproj | Removes shared.proj import; switches test dependencies to central versions/TestHost. |
| tests/opencertserver.cli.tests/opencertserver.cli.tests.csproj | Removes explicit TF/package versions; relies on repo-level build props + central packages. |
| tests/opencertserver.certserver.tests/opencertserver.certserver.tests.csproj | Removes shared.proj import; migrates package refs to central versions. |
| tests/opencertserver.ca.tests/opencertserver.ca.tests.csproj | Removes shared.proj import; migrates package refs to central versions. |
| tests/opencertserver.acme.aspnetclient.tests/opencertserver.acme.aspnetclient.tests.csproj | Removes shared.proj import; migrates package refs to central versions. |
| tests/opencertserver.acme.abstractions.tests/opencertserver.acme.abstractions.tests.csproj | Removes shared.proj import; migrates package refs to central versions. |
| tests/CertesSlim.tests/Pkcs/CertificationRequestBuilderTests.cs | Adjusts nullability annotations in assertions. |
| tests/CertesSlim.tests/IAcmeContextExtensionsTests.cs | Cleans usings and updates nullability annotations for test data. |
| tests/CertesSlim.tests/Helper.v2.cs | Updates nullability annotation for DirectoryMeta test helper. |
| tests/CertesSlim.tests/Helper.cs | Fixes nullability warnings with null-forgiving and MemberExpression assumptions. |
| tests/CertesSlim.tests/CertesSlim.tests.csproj | Migrates package refs to central versions and normalizes formatting. |
| tests/CertesSlim.tests/Acme/Resource/DirectoryTests.cs | Cleans usings and updates nullability for test construction. |
| tests/CertesSlim.tests/Acme/Resource/AccountTests.cs | Adds null-forgiving where deserialize can return null. |
| tests/CertesSlim.tests/Acme/EntityContextTests.cs | Adjusts nullability for AcmeHttpResponse test setup. |
| tests/CertesSlim.tests/Acme/AcmeHttpClientTests.cs | Cleans usings + adjusts nullability in mocked responses. |
| tests/CertesSlim.tests/Acme/AcmeContextTests.cs | Cleans usings + adjusts nullability in mocked responses. |
| src/opencertserver.tss.net/opencertserver.tss.net.csproj | Removes shared.proj import (keeps custom warning/trim settings). |
| src/opencertserver.tpm/TssTpmKeyProvider.cs | Minor refactors (var usage) in simulator initialization/signing logic. |
| src/opencertserver.tpm/TpmCaProfileFactory.cs | Minor refactors (var usage) in self-signed CA certificate creation. |
| src/opencertserver.tpm/TpmCaCertificateStore.cs | Minor refactor (var usage) when iterating stale certificates. |
| src/opencertserver.tpm/opencertserver.tpm.csproj | Removes shared.proj import. |
| src/opencertserver.mcp/Transport/McpStdioTransport.cs | Adds stdio JSON-RPC transport implementation for MCP. |
| src/opencertserver.mcp/RegisterTools.cs | Adds extension to register all MCP tools on the server. |
| src/opencertserver.mcp/README.md | Adds minimal README for MCP project. |
| src/opencertserver.mcp/Program.cs | Adds MCP server entrypoint that hosts stdio transport. |
| src/opencertserver.mcp/opencertserver.mcp.csproj | Adds MCP server executable project and references CA projects. |
| src/opencertserver.mcp/McpToolResult.cs | Defines tool invocation result wrapper (success/error). |
| src/opencertserver.mcp/McpToolDefinition.cs | Defines tool metadata and handler delegate. |
| src/opencertserver.mcp/McpToolContext.cs | Provides tool handler context + DI scope access. |
| src/opencertserver.mcp/McpServerOptions.cs | Adds MCP server configuration options. |
| src/opencertserver.mcp/McpServerExtensions.cs | Adds DI helper to register MCP server. |
| src/opencertserver.mcp/McpServer.cs | Adds core MCP server implementation (tool registry, invoke, stdio start/stop). |
| src/opencertserver.mcp/McpInstruments.cs | Adds OpenTelemetry metrics/tracing helpers for tool invocations. |
| src/opencertserver.mcp/McpErrorCode.cs | Defines MCP/JSON-RPC + CA-specific error codes. |
| src/opencertserver.mcp/McpCertificateStatus.cs | Defines status enum for revocation checks. |
| src/opencertserver.mcp/McpCertificateSearchResult.cs | Adds paginated search result DTO for MCP. |
| src/opencertserver.mcp/McpCertificateItem.cs | Adds certificate DTO returned by MCP tools. |
| src/opencertserver.mcp/GlobalUsings.cs | Adds global usings for MCP project. |
| src/opencertserver.lambda/opencertserver.lambda.csproj | Removes shared.proj import; migrates package ref to central versions. |
| src/opencertserver.est.server/opencertserver.est.server.csproj | Removes shared.proj import; migrates package refs to central versions. |
| src/opencertserver.est.client/opencertserver.est.client.csproj | Removes shared.proj import. |
| src/opencertserver.cli/opencertserver.cli.csproj | Removes explicit TF/package version and migrates to central package versioning. |
| src/opencertserver.certserver/opencertserver.certserver.csproj | Removes shared.proj import. |
| src/opencertserver.ca/opencertserver.ca.csproj | Removes shared.proj import; migrates package refs to central versions. |
| src/opencertserver.ca/CaProfileSet.cs | Adds GetProfiles() to enumerate all CA profiles asynchronously. |
| src/opencertserver.ca.utils/opencertserver.ca.utils.csproj | Removes shared.proj import. |
| src/opencertserver.ca.utils/Ca/IStoreCaProfiles.cs | Extends interface to support enumerating all CA profiles. |
| src/opencertserver.ca.utils/Ca/CertificateSearchResult.cs | Adds a CA-level paginated certificate search result DTO. |
| src/opencertserver.ca.server/opencertserver.ca.server.csproj | Removes shared.proj import; migrates package refs to central versions. |
| src/opencertserver.ca.server/Extensions.cs | Rewrites extension declarations into standard C# extension methods and updates registrations. |
| src/opencertserver.acme.server/opencertserver.acme.server.csproj | Removes shared.proj import; migrates package refs to central versions. |
| src/opencertserver.acme.aspnetclient/opencertserver.acme.aspnetclient.csproj | Removes shared.proj import. |
| src/opencertserver.acme.abstractions/opencertserver.acme.abstractions.csproj | Removes shared.proj import. |
| src/CertesSlim/CertesSlim.csproj | Removes shared.proj import; migrates package refs to central versions. |
| opencertserver.slnx | Adds MCP server + MCP tests projects; removes shared.proj solution entry. |
| opencertserver.sln.DotSettings | Updates ReSharper nullable-warning suppression setting. |
| Directory.Packages.props | Introduces central package version management and pins common dependency versions. |
| Directory.Build.props | Minor formatting adjustment (license expression indentation). |
Files not reviewed (5)
- tests/opencertserver.mcp.tests/Features/McpServerCertificateOperations.feature.cs: Language not supported
- tests/opencertserver.mcp.tests/Features/McpServerCertificateQuery.feature.cs: Language not supported
- tests/opencertserver.mcp.tests/Features/McpServerMetadata.feature.cs: Language not supported
- tests/opencertserver.mcp.tests/Features/McpServerRevocation.feature.cs: Language not supported
- tests/opencertserver.mcp.tests/Features/McpServerTools.feature.cs: Language not supported
Comments suppressed due to low confidence (1)
tests/opencertserver.mcp.tests/StepDefinitions/McpServerToolsSteps.cs:107
- ThenTheToolDescriptionContains is a no-op, so any scenario using this step would not actually validate the tool’s description content. Either implement the assertion (by selecting a tool definition and checking Description contains the keyword) or remove the step to avoid false-positive tests.
e319b57 to
40e1d90
Compare
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Agent-Logs-Url: https://github.com/jjrdk/opencertserver/sessions/1ea518d7-d5ca-4f6b-bf92-dc7ec8ba2a7a Co-authored-by: jjrdk <149390+jjrdk@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/jjrdk/opencertserver/sessions/f0f56ac7-fbb1-47fa-8d82-34013e54de37 Co-authored-by: jjrdk <149390+jjrdk@users.noreply.github.com>
Agent-Logs-Url: https://github.com/jjrdk/opencertserver/sessions/20b31552-098f-4b83-9a21-dfe16a81708f Co-authored-by: jjrdk <149390+jjrdk@users.noreply.github.com>
Co-authored-by: jjrdk <149390+jjrdk@users.noreply.github.com>
Agent-Logs-Url: https://github.com/jjrdk/opencertserver/sessions/19f0538d-6a1f-4eb6-a600-5a8c0f162c15 Co-authored-by: jjrdk <149390+jjrdk@users.noreply.github.com>
Agent-Logs-Url: https://github.com/jjrdk/opencertserver/sessions/a87cdba1-2d4b-42a5-89af-b74ff463471f Co-authored-by: jjrdk <149390+jjrdk@users.noreply.github.com>
Agent-Logs-Url: https://github.com/jjrdk/opencertserver/sessions/9a4ba216-f8d1-4163-a828-95d8a4da8a9a Co-authored-by: jjrdk <149390+jjrdk@users.noreply.github.com>
Agent-Logs-Url: https://github.com/jjrdk/opencertserver/sessions/56d60780-f4ca-4da6-a1b6-a19e28b763b7 Co-authored-by: jjrdk <149390+jjrdk@users.noreply.github.com>
Agent-Logs-Url: https://github.com/jjrdk/opencertserver/sessions/557b7cc7-62fe-4bcf-a83e-3b0bf00a9f32 Co-authored-by: jjrdk <149390+jjrdk@users.noreply.github.com>
Agent-Logs-Url: https://github.com/jjrdk/opencertserver/sessions/557b7cc7-62fe-4bcf-a83e-3b0bf00a9f32 Co-authored-by: jjrdk <149390+jjrdk@users.noreply.github.com>
Agent-Logs-Url: https://github.com/jjrdk/opencertserver/sessions/557b7cc7-62fe-4bcf-a83e-3b0bf00a9f32 Co-authored-by: jjrdk <149390+jjrdk@users.noreply.github.com>
Agent-Logs-Url: https://github.com/jjrdk/opencertserver/sessions/14364963-0972-4ab1-82d2-3cad3305f1d5 Co-authored-by: jjrdk <149390+jjrdk@users.noreply.github.com>
Agent-Logs-Url: https://github.com/jjrdk/opencertserver/sessions/ad3229b5-b185-4651-91f9-37ffdf641efa Co-authored-by: jjrdk <149390+jjrdk@users.noreply.github.com>
50b13fe to
f290d49
Compare
- Add CA service registration to Program.cs - Fix McpServer logger initialization with ILoggerFactory - Fix JsonDocument disposal in McpStdioTransport (3 locations) - Fix HandleToolsCall to properly handle JsonElement parameters - Remove dead code in error data handling - Add ParameterHelper utility for safe parameter extraction - Fix all tool parameter parsing to handle JsonElement - Fix issuer field in ListCertificatesTool and SearchCertificatesTool - Update SearchCertificatesTool description to reflect current behavior - Fix GetCertificateTool to return actual revocation status - Fix GetCaCertificatesTool serial number format - Fix SignCertificateTool to support PEM CSR and use DateTimeOffset - Add hex validation to GetRevocationStatusTool and CheckOcspStatusTool - Update test fixture to pass loggerFactory Agent-Logs-Url: https://github.com/jjrdk/opencertserver/sessions/2c86380d-f0cb-4e7b-9f68-d6a4398aebe6 Co-authored-by: jjrdk <149390+jjrdk@users.noreply.github.com>
Agent-Logs-Url: https://github.com/jjrdk/opencertserver/sessions/2c86380d-f0cb-4e7b-9f68-d6a4398aebe6 Co-authored-by: jjrdk <149390+jjrdk@users.noreply.github.com>
- Fix includeFullChain boolean parsing in GetCaCertificatesTool to use ParameterHelper.GetBoolean() for JsonElement compatibility - Implement actual filtering in SearchCertificatesTool instead of ignoring filter parameters: - subjectCN/subjectContains: substring match on DN - issuerContains: substring match on issuer DN - serialNumber/thumbprint: substring match - notBeforeAfter/before, notAfterAfter/before: date range filtering - status: Good/Revoked via IsRevoked check - keyAlgorithms: acknowledged as not yet supported (requires loading cert) - Update tool schema descriptions to reflect filtering is now active
…initions
The root cause of 8 test failures was that Reqnroll's Table constructor
takes column headers only — Copilot's generated code passed data values
as headers (e.g. `new Table({"serialNumber", "ZZZZ"})`) instead of
using AddRow(), resulting in zero data rows and empty parameter dicts
flowing to every tool handler.
Fixes applied:
- McpServerParameterHandling.feature: add Key/Value header rows to all
parameter tables so Reqnroll generates proper Table + AddRow() code
- ParameterHandlingSteps.cs: fix array placeholder to quote serial numbers
(e.g. ["{serial}"] instead of [{serial}]) for valid JSON deserialization;
add missing Given/Then step definitions for Background and error-message
checks
- TestSharedState.cs: add lost IssuedSerialNumber property (deleted in
Copilot commit)
- opencertserver.mcp.tests.csproj: suppress IL trim/AOT warnings not
applicable to test projects
- McpServerFixture.cs, CommonToolsSteps.cs: clean up whitespace
- Add Issuer property to CertificateItemInfo and propagate to CertificateItem - Update ListCertificatesTool and SearchCertificatesTool to use real issuer from store - Add CollectionBehavior to disable test parallelization (static shared state) - Clean up diagnostic code and fix Reqnroll table serialization issues
Copilot PR Review Comments - Resolution SummaryAll inline review comments from Transport Layer (McpStdioTransport.cs)
Entry Point (Program.cs)
MCP Server (McpServer.cs)
Tools (
|
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 33137670 | Triggered | RSA Private Key | fa0bd4e | tests/CertesSlim.tests/Keys.cs | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
- Add Issuer property to CertificateItemInfo and propagate to CertificateItem - Update ListCertificatesTool and SearchCertificatesTool to use real issuer from store - Add CollectionBehavior to disable test parallelization (static shared state) - Clean up diagnostic code and fix Reqnroll table serialization issues
Add MCP server project