Carbon for Salesforce MCP Server
by KirtiJha
README.md
# Carbon for Salesforce MCP Server
A Model Context Protocol (MCP) server that provides direct access to the Carbon for Salesforce repository on IBM GitHub Enterprise. This server enables AI assistants to retrieve source code, explore the repository structure, and access implementation details for Carbon Design System components in Salesforce Lightning Web Components.
## Overview
This MCP server connects to the IBM GitHub Enterprise Carbon for Salesforce repository to provide real-time access to:
- Component source code and implementations
- Repository structure and file organization
- Code examples and patterns
- Documentation and configuration files
The server acts as a bridge between AI assistants and the Carbon for Salesforce codebase, enabling intelligent code assistance, implementation guidance, and development support.
## Features
### Repository Access
- **File Retrieval**: Get the complete content of any file in the repository
- **Directory Browsing**: Explore folder structures and file listings
- **Code Search**: Search across all files using GitHub's search capabilities
- **Repository Metadata**: Access repository information and statistics
### Direct GitHub Integration
- **Real-time Data**: Always up-to-date with the latest repository state
- **Enterprise Access**: Connects to IBM's internal GitHub Enterprise instance
- **Comprehensive Coverage**: Access to all public files and documentation
- **Raw Data Access**: Unprocessed GitHub API responses for maximum flexibility
## Installation
```bash
npm install
npm run build
```
## Configuration
The server requires access to IBM GitHub Enterprise. Set up authentication using either:
1. **Environment Variable** (recommended):
```bash
export IBM_GITHUB_TOKEN="your_github_token_here"
```
2. **Default Token**: The server includes a fallback token for development/testing purposes.
**Note**: For production use, always provide your own GitHub token with appropriate repository access permissions.
## Usage
The server can be used with Claude Desktop or any MCP-compatible client:
```json
{
"mcpServers": {
"carbon-salesforce": {
"command": "node",
"args": ["/path/to/carbon-salesforce-mcp-server/dist/index.js"],
"env": {
"IBM_GITHUB_TOKEN": "your_github_token_here"
}
}
}
}
```
## Repository
This project is hosted at: https://github.ibm.com/kirtijha/carbon-salesforce-mcp-server
## Available Tools
The server provides 4 core tools for repository interaction:
### `carbon_search_files`
Search for files across the Carbon for Salesforce repository.
- **Parameters**:
- `query` (required): Search terms (e.g., "button", "carbon lwc", "filename:button.js")
- `maxResults` (optional): Maximum results to return (default: 10, max: 100)
- **Returns**: Raw GitHub search results with file paths, content snippets, and metadata
### `carbon_get_file`
Retrieve the complete content of a specific file from the repository.
- **Parameters**:
- `path` (required): File path in repository (e.g., "force-app/main/default/lwc/carbonButton/carbonButton.js")
- **Returns**: Raw file content with metadata (encoding, size, etc.)
### `carbon_list_directory`
Browse the contents of any directory in the repository.
- **Parameters**:
- `path` (optional): Directory path (default: "" for root directory)
- **Returns**: Array of files and subdirectories with type, size, and path information
### `carbon_get_repository_info`
Get repository metadata and statistics.
- **Parameters**: None
- **Returns**: Repository details including description, languages, size, last updated, etc.
## Example Queries
Here are some example ways to use the tools:
```javascript
// Search for button components
carbon_search_files({ query: "button", maxResults: 5 })
// Get a specific component file
carbon_get_file({ path: "force-app/main/default/lwc/carbonButton/carbonButton.js" })
// Browse the LWC components directory
carbon_list_directory({ path: "force-app/main/default/lwc" })
// Get repository information
carbon_get_repository_info()
```
## Repository Structure
The Carbon for Salesforce repository typically contains:
- `force-app/main/default/lwc/` - Lightning Web Components
- `force-app/main/default/staticresources/` - Static resources and assets
- `docs/` - Documentation and guides
- `examples/` - Example implementations and patterns
- Configuration files for Salesforce DX and Carbon setup
## Development
### Building the Project
```bash
npm run build # Compile TypeScript
npm run watch # Watch mode for development
npm run dev # Build and start the server
```
### Project Structure
```
src/
├── index.ts # Main server entry point
├── tools/ # MCP tool implementations
│ ├── getFile.ts # File content retrieval
│ ├── listDirectory.ts # Directory browsing
│ ├── searchFiles.ts # Repository search
│ └── getRepositoryInfo.ts # Repository metadata
├── types/ # TypeScript type definitions
└── utils/ # Utility functions and helpers
```
### GitHub Enterprise Configuration
- **Base URL**: `https://github.ibm.com/api/v3`
- **Repository**: `carbon-for-salesforce/carbon-for-salesforce`
- **Authentication**: GitHub Personal Access Token
- **Required Permissions**: Repository read access
## Use Cases
This MCP server is particularly useful for:
1. **Component Discovery**: Find existing Carbon components and their implementations
2. **Code Analysis**: Examine how specific features are implemented
3. **Pattern Research**: Identify common patterns and best practices
4. **Documentation Access**: Retrieve README files, comments, and documentation
5. **Architecture Understanding**: Explore the overall structure of the Carbon for Salesforce project
6. **Implementation Examples**: Find real-world usage examples for components
## Contributing
This server is designed to support Carbon for Salesforce development teams. Contributions and feedback are welcome.
## License
MIT LicenseThis server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo recent community issues