- Added functionality to update the default LLM provider for users via a new endpoint in UserController. - Introduced LlmProvider enum to manage available LLM options: Auto, Gemini, OpenAI, and Claude. - Updated User and UserEntity models to include DefaultLlmProvider property. - Enhanced database context and migrations to support the new LLM provider configuration. - Integrated LLM services into the application bootstrap for dependency injection. - Updated TypeScript API client to include methods for managing LLM providers and chat requests.
4.3 KiB
4.3 KiB
MCP Quick Start Guide
Prerequisites
- .NET 8 SDK
- Node.js 18+
- At least one LLM API key (Gemini, OpenAI, or Claude)
Setup Steps
1. Configure LLM API Keys
Add your API key to appsettings.Development.json or user secrets:
{
"Llm": {
"Claude": {
"ApiKey": "YOUR_CLAUDE_API_KEY_HERE"
}
}
}
Or use .NET user secrets (recommended):
cd src/Managing.Api
dotnet user-secrets set "Llm:Claude:ApiKey" "YOUR_API_KEY"
Or use environment variables:
export Llm__Claude__ApiKey="YOUR_API_KEY"
dotnet run --project src/Managing.Api
2. Build the Backend
cd src
dotnet build Managing.sln
3. Run the Backend
cd src/Managing.Api
dotnet run
The API will be available at https://localhost:7001 (or configured port).
4. Generate API Client (if needed)
If the LLM endpoints aren't in the generated client yet:
# Make sure the API is running
cd src/Managing.Nswag
dotnet build
This will regenerate ManagingApi.ts with the new LLM endpoints.
5. Run the Frontend
cd src/Managing.WebApp
npm install # if first time
npm run dev
The app will be available at http://localhost:5173 (or configured port).
6. Test the AI Chat
- Login to the application
- Look for the floating chat button in the bottom-right corner
- Click it to open the AI chat
- Try these example queries:
- "Show me my backtests"
- "Find my best performing strategies"
- "What are my BTC backtests?"
- "Show backtests with a score above 80"
Getting LLM API Keys
Anthropic Claude (Recommended - Best for MCP)
- Go to Anthropic Console
- Sign in or create an account
- Navigate to API Keys and create a new key
- Copy and add to configuration
- Note: Requires payment setup
Google Gemini (Free Tier Available)
- Go to Google AI Studio
- Click "Get API Key"
- Create a new API key
- Copy and add to configuration
OpenAI
- Go to OpenAI Platform
- Create a new API key
- Copy and add to configuration
- Note: Requires payment setup
Anthropic Claude
- Go to Anthropic Console
- Create an account and API key
- Copy and add to configuration
- Note: Requires payment setup
Architecture Overview
User Browser
↓
AI Chat Component (React)
↓
LlmController (/api/Llm/Chat)
↓
LlmService (Auto-selects provider)
↓
Gemini/OpenAI/Claude Provider
↓
MCP Service (executes tools)
↓
BacktestTools (queries data)
Troubleshooting
No providers available
- Check that at least one API key is configured
- Verify the API key is valid
- Check application logs for provider initialization
Tool calls not working
- Verify
IBacktesterservice is registered - Check user has backtests in the database
- Review logs for tool execution errors
Frontend errors
- Ensure API is running
- Check browser console for errors
- Verify
ManagingApi.tsincludes LLM endpoints
Build errors
- Run
dotnet restorein src/ - Ensure all NuGet packages are restored
- Check for version conflicts in project files
Example Queries
Simple Queries
"Show me my backtests"
"What's my best strategy?"
"List all my BTC backtests"
Filtered Queries
"Find backtests with a score above 85"
"Show me backtests from the last 30 days"
"List backtests with low drawdown (under 10%)"
Complex Queries
"What are my best performing ETH strategies with a winrate above 70%?"
"Find backtests using RSI indicator sorted by Sharpe ratio"
"Show me my top 5 backtests by growth percentage"
Next Steps
- Add more MCP tools for additional functionality
- Customize the chat UI to match your brand
- Implement chat history persistence
- Add streaming support for better UX
- Create custom tools for your specific use cases
Support
For issues or questions:
- Check the logs in
Managing.Apiconsole - Review browser console for frontend errors
- Verify API keys are correctly configured
- Ensure all services are running