Skip to content

Commit b7eea8d

Browse files
committed
docs: Add CLAUDE.md for project guidance and architecture overview
1 parent 9364d79 commit b7eea8d

1 file changed

Lines changed: 97 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
NetContextServer is a .NET 9.0 Model Context Protocol (MCP) server that provides AI coding assistants with deep understanding of .NET codebases. It consists of three main projects:
8+
- `NetContextServer`: MCP server implementation
9+
- `NetContextClient`: CLI interface for server interaction
10+
- `NetContextServer.Tests`: Comprehensive test suite
11+
12+
## Essential Commands
13+
14+
### Development
15+
```bash
16+
# Build the solution
17+
dotnet build
18+
19+
# Run tests
20+
dotnet test
21+
22+
# Run the server
23+
dotnet run --project src/NetContextServer/NetContextServer.csproj
24+
25+
# Run the client with a command
26+
dotnet run --project src/NetContextClient/NetContextClient.csproj -- [command]
27+
28+
# Run a specific test
29+
dotnet test --filter "FullyQualifiedName~TestName"
30+
31+
# Run tests with coverage
32+
dotnet test --collect:"XPlat Code Coverage"
33+
```
34+
35+
### Publishing
36+
```bash
37+
# Publish for Windows
38+
dotnet publish -c Release -r win-x64 --self-contained
39+
40+
# Publish for Linux
41+
dotnet publish -c Release -r linux-x64 --self-contained
42+
43+
# Publish for macOS
44+
dotnet publish -c Release -r osx-x64 --self-contained
45+
```
46+
47+
## Architecture Overview
48+
49+
### Service Layer Pattern
50+
The codebase follows a clean service-based architecture where business logic is encapsulated in services under `src/NetContextServer/Services/`. Each service has a corresponding interface and handles a specific domain concern.
51+
52+
### MCP Tool Implementation
53+
Tools are organized under `src/NetContextServer/Tools/` and grouped by functionality:
54+
- **FileTools**: Project/file operations (`ListProjects`, `ListSourceFiles`, `ReadFile`)
55+
- **SearchTools**: Text and semantic search (`SearchCode`, `SemanticSearch`)
56+
- **PackageTools**: NuGet package analysis (`AnalyzePackages`)
57+
- **CoverageTools**: Test coverage analysis (`GetCoverage`)
58+
- **ThinkTools**: Structured reasoning (`Think`)
59+
60+
Each tool class inherits from `ModelContextTool<TArgs, TResult>` and implements the MCP protocol.
61+
62+
### Key Services and Their Responsibilities
63+
- **FileService**: File system operations with security validation
64+
- **CodeSearchService**: Text-based code search using regex
65+
- **SemanticSearchService**: AI-powered semantic search with Azure OpenAI embeddings
66+
- **PackageAnalyzerService**: NuGet dependency analysis and update recommendations
67+
- **CoverageAnalysisService**: Multi-format coverage report parsing (Coverlet, LCOV, Cobertura)
68+
69+
### State Management
70+
User patterns and preferences are persisted in `%LocalAppData%/NetContextServer/state.json` through the `StateService`.
71+
72+
### Security Model
73+
- Path validation ensures operations stay within allowed directories
74+
- File size limits prevent resource exhaustion
75+
- Sensitive files (.env, secrets) are protected from access
76+
- All file operations validate against these security constraints
77+
78+
## Testing Approach
79+
80+
Tests are organized using xUnit with fixture-based integration testing:
81+
- **Unit Tests**: Test individual services in isolation
82+
- **Integration Tests**: Use `NetContextServerFixture` for full tool testing
83+
- **Test Utilities**: `TestOutputLogger` for debugging test execution
84+
85+
When adding new features:
86+
1. Add unit tests for service logic
87+
2. Add integration tests for MCP tool implementations
88+
3. Use the existing fixture pattern for consistency
89+
90+
## Configuration and Environment
91+
92+
The server supports various configuration options through:
93+
- Environment variables for Azure OpenAI integration
94+
- Command-line arguments for server initialization
95+
- Local state file for user preferences
96+
97+
When working with semantic search features, ensure Azure OpenAI credentials are configured in environment variables.

0 commit comments

Comments
 (0)