mirror of
https://github.com/aljazceru/mentor-mcp-server.git
synced 2025-12-17 22:14:29 +01:00
feat: Initial implementation of mentor-mcp-server
Implements a Model Context Protocol (MCP) server that provides AI-powered mentorship and feedback tools. Core Features: - TypeScript implementation with ES modules - MCP server setup with stdio transport - Deepseek API integration with rate limiting and retry logic - Secure environment configuration management - Comprehensive utility functions for file and prompt handling Tools: - second-opinion: Provides critical analysis of user requests - Input validation - Rate limiting - Error handling - Sanitized inputs - Structured prompt templates Infrastructure: - Atomic design directory structure - Type-safe implementation - Proper error handling - Security measures (input sanitization, rate limiting) - Development scripts and configuration Security Features: - API key protection - Input sanitization - Rate limiting - Error message sanitization - Secure file path validation This implementation follows MCP best practices and provides a foundation for adding additional tools: - code-review - design-critique - writing-feedback - brainstorm-enhancements
This commit is contained in:
27
src/config.ts
Normal file
27
src/config.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import dotenv from 'dotenv';
|
||||
import type { ServerConfig, APIConfig } from './types/index.js';
|
||||
|
||||
// Load environment variables
|
||||
dotenv.config();
|
||||
|
||||
function requireEnv(name: string): string {
|
||||
const value = process.env[name];
|
||||
if (!value) {
|
||||
throw new Error(`Missing required environment variable: ${name}`);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
const apiConfig: APIConfig = {
|
||||
apiKey: requireEnv('DEEPSEEK_API_KEY'),
|
||||
baseUrl: process.env.DEEPSEEK_API_BASE_URL || 'https://api.deepseek.com/v1',
|
||||
model: process.env.DEEPSEEK_MODEL || 'deepseek-coder',
|
||||
maxRetries: parseInt(process.env.DEEPSEEK_MAX_RETRIES || '3', 10),
|
||||
timeout: parseInt(process.env.DEEPSEEK_TIMEOUT || '30000', 10),
|
||||
};
|
||||
|
||||
export const config: ServerConfig = {
|
||||
serverName: process.env.SERVER_NAME || 'mentor-mcp-server',
|
||||
serverVersion: process.env.SERVER_VERSION || '1.0.0',
|
||||
api: apiConfig,
|
||||
};
|
||||
Reference in New Issue
Block a user