Skip to content

feat(mcp): Add Model Context Protocol configuration for SourceLoop CLI integration - #80

Closed
rohit-sourcefuse wants to merge 1 commit into
mainfrom
feat/cli-integration-support
Closed

rohit-sourcefuse wants to merge 1 commit into
mainfrom
feat/cli-integration-support

Conversation

@rohit-sourcefuse

Copy link
Copy Markdown

Summary

  • Add MCP (Model Context Protocol) configuration to enable AI-assisted development through Claude Code
  • Create .claude/mcp.json with SourceLoop CLI MCP server configuration
  • Add .claude/README.md with comprehensive documentation for developers and AI usage

Why This Change Is Needed

This PR is part of the unified CLI integration for React projects. The SourceLoop CLI (@sourceloop/cli) now includes React commands:

  • sl react:generate - Generate components, hooks, contexts, etc.
  • sl react:scaffold - Scaffold new React projects
  • sl react:config - Update environment and config.json
  • sl react:info - Display project information

For these commands to work properly with AI assistants like Claude Code, the React boilerplate needs MCP configuration. This allows AI to:

  • Automatically detect SourceLoop CLI capabilities when opened in Claude Code
  • Generate React artifacts using natural language commands
  • Update configuration files intelligently
  • Provide context-aware assistance

Changes Made

  1. .claude/mcp.json: MCP server configuration

    • Configures @sourceloop/cli as the MCP server
    • Sets 300-second timeout for complex operations
    • Enables AI assistants to discover and use SourceLoop CLI commands
  2. .claude/README.md: Developer documentation

    • Explains what MCP is and its benefits
    • Provides usage examples for Claude Code
    • Documents manual CLI usage patterns
    • Includes configuration customization guidance

Related PRs

Test Plan

  • .claude/mcp.json is valid JSON
  • MCP configuration follows the standard format
  • Documentation is clear and comprehensive
  • Test with Claude Code to verify AI can detect and use SourceLoop CLI commands
  • Verify sl react:generate works with MCP integration
  • Verify sl react:config can update environment files

Impact

  • Breaking Changes: None
  • New Dependencies: None (uses existing @sourceloop/cli as MCP server)
  • Documentation: Added in .claude/README.md

🤖 Generated with Claude Code

Add MCP support to enable AI-assisted development through Claude Code.

This configuration allows AI assistants to:
- Generate React components, hooks, contexts, etc.
- Scaffold new features
- Update environment and configuration files
- Provide project-specific assistance

The .claude directory includes:
- mcp.json: MCP server configuration for @sourceloop/cli
- README.md: Documentation for developers and AI usage

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings November 12, 2025 11:48
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds Model Context Protocol (MCP) configuration to enable AI-assisted development through Claude Code integration with the SourceLoop CLI. The configuration allows AI assistants to automatically detect and use SourceLoop CLI commands for React development tasks.

Key Changes:

  • Configure MCP server to run @sourceloop/cli via npx with 300-second timeout
  • Document MCP usage patterns for both AI-assisted and manual CLI workflows

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
.claude/mcp.json Adds MCP server configuration pointing to @sourceloop/cli with command execution via npx
.claude/README.md Provides documentation explaining MCP functionality, usage examples, and configuration options

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .claude/README.md
- Environment variables
- Command arguments

For more information, visit: https://docs.anthropic.com/claude/docs/mcp

Copilot AI Nov 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MCP documentation URL may be outdated. Based on Anthropic's current documentation structure, the correct URL should be https://modelcontextprotocol.io/ or https://docs.anthropic.com/en/docs/build-with-claude/mcp. Please verify and update the link to ensure developers can access accurate MCP documentation.

Suggested change
For more information, visit: https://docs.anthropic.com/claude/docs/mcp
For more information, visit: https://modelcontextprotocol.io/

Copilot uses AI. Check for mistakes.
Comment thread .claude/mcp.json
"@sourceloop/cli",
"mcp"
],
"timeout": 300

Copilot AI Nov 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The timeout value of 300 seconds (5 minutes) seems excessive for typical CLI operations. Unless complex scaffolding operations genuinely require this duration, consider reducing to a more reasonable value like 60-120 seconds to prevent hanging operations and improve responsiveness.

Suggested change
"timeout": 300
"timeout": 120

Copilot uses AI. Check for mistakes.
Comment thread .claude/README.md
- Timeout values
- Environment variables
- Command arguments

Copilot AI Nov 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation mentions customizing 'Environment variables', but the .claude/mcp.json file doesn't include any environment variable configuration. Either add an example of how to configure environment variables in the MCP config (using an env field) or remove this bullet point to avoid confusion.

Suggested change
Example of configuring environment variables in `.claude/mcp.json`:
```json
{
"timeout": 60,
"env": {
"API_BASE_URL": "https://api.example.com",
"NODE_ENV": "production"
}
}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants