-
Notifications
You must be signed in to change notification settings - Fork 0
Feat: Added Mcp Integration #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ns, and define MCP tool constants
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Integrates MCP (Model Context Protocol) support for Claude Desktop integration, enabling external tools to interact with the NestJS Todo application through JSON-RPC communication.
- MCP server implementation with JSON-RPC protocol for Claude Desktop integration
- Authentication tools for user registration and login via MCP interface
- Docker containerization setup for isolated MCP server deployment
Reviewed Changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/modules/mcp/tools/auth.tools.ts | Implements authentication tools for MCP with register and login functionality |
| src/modules/mcp/server/mcp.server.ts | Core MCP server with JSON-RPC handlers and tool routing |
| src/modules/mcp/mcp.module.ts | NestJS module configuration for MCP integration |
| src/mcp-server.ts | Bootstrap entry point for standalone MCP server |
| src/core/interface/mcp/mcp-tool.const.ts | Tool definitions and type utilities for MCP tools |
| src/core/interface/mcp/index.ts | Export barrel for MCP interfaces |
| src/core/interface/index.ts | Adds MCP interface exports |
| src/core/error/exception/mcp-tool-not-found.exception.ts | Custom exception for missing MCP tools |
| src/core/error/exception/mcp-category-not-supported.exception.ts | Custom exception for unsupported tool categories |
| src/core/error/exception/index.ts | Exports new MCP exception classes |
| src/core/error/error-code.ts | Error codes for MCP-related exceptions |
| src/app.module.ts | Registers MCP module in main application |
| package.json | Adds MCP SDK dependency and development script |
| docker/docker-compose.yml | Configures separate MCP server container |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| async handleToolCall(toolName: string, args: any) { | ||
| switch (toolName) { | ||
| case McpTool.AUTH_REGISTER.name: | ||
| return await this.register(args); | ||
| case McpTool.AUTH_LOGIN.name: | ||
| return await this.login(args); |
Copilot
AI
Sep 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'args' parameter should be properly typed instead of using 'any'. Consider creating a union type of the expected argument types (CreateUserDto | SignInDto) or using a generic parameter.
| async handleToolCall(toolName: string, args: any) { | |
| switch (toolName) { | |
| case McpTool.AUTH_REGISTER.name: | |
| return await this.register(args); | |
| case McpTool.AUTH_LOGIN.name: | |
| return await this.login(args); | |
| async handleToolCall(toolName: string, args: CreateUserDto | SignInDto) { | |
| switch (toolName) { | |
| case McpTool.AUTH_REGISTER.name: | |
| return await this.register(args as CreateUserDto); | |
| case McpTool.AUTH_LOGIN.name: | |
| return await this.login(args as SignInDto); |
| } catch (error) { | ||
| return { | ||
| content: [ | ||
| { | ||
| type: 'text', | ||
| text: `Error: ${error.message}`, | ||
| }, | ||
| ], | ||
| isError: true, | ||
| }; | ||
| } |
Copilot
AI
Sep 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error handling assumes 'error.message' exists, but 'error' could be any type. Add proper type checking or cast error to Error type to ensure safe property access.
|
bunun testi yazılabiliyor mu acaba? bunu bi araştırabilir misin |
…e, delete, and cancel deletion operations
… for create, delete, and cancel deletion
…d todo operations, remove unused DTOs
📋 PR Description
Integrates MCP (Model Context Protocol) for Claude Desktop integration with NestJS Todo application.
✨ Changes
🏗️ Architecture
MCP Server handles JSON-RPC requests → Auth Tools process commands →
NestJS services execute business logic → Structured responses to Claude Desktop
🧪 Available Tools
auth_register- Register new user with fullname, nickname, passwordauth_login- Authenticate user and return JWT access tokenClaude Desktop Setup Instructions
Prerequisites
docker compose upis workingStep 1: Verify MCP Server is Running
Step 2: Configure Claude Desktop
Find Claude Desktop Config File:
~/.config/claude-desktop/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/claude-desktop/claude_desktop_config.jsonCreate/Edit Config File:
{ "mcpServers": { "nestjs-todo": { "command": "docker", "args": [ "exec", "-i", "docker-mcp-server-1", "node", "dist/mcp-server.js" ] } } }Step 3: Restart Claude Desktop
Step 4: Test MCP Integration
Try these example prompts in Claude Desktop:
Register a New User
Login User
Check Available Tools
Expected Claude Response
Claude should be able to:
auth_register,auth_login)