# Setup Guide
This guide provides detailed setup instructions for the SAP AI Core Documentation MCP Server.
## Prerequisites
Before you begin, ensure you have the following installed:
- **Node.js**: Version 20.0.0 or higher
- **npm**: Comes with Node.js
- **git**: For cloning repositories and managing submodules
- **nvm** (recommended): For Node.js version management
## Installation Steps
### 1. Clone the Repository
```bash
git clone <repository-url>
cd dlwr-dnl-ai-core-documentation-mcp
```
### 2. Clone SAP AI Core Documentation Submodule
The SAP AI Core documentation is included as a git submodule. Initialize and clone it:
```bash
git submodule add https://github.com/SAP-docs/sap-artificial-intelligence.git docs/sap-artificial-intelligence
git submodule update --init --recursive
```
**Note**: The documentation repository is large and may take several minutes to clone.
### 3. Install Dependencies
```bash
# Ensure you're using Node.js 20+
source ~/.zshrc && nvm use
# Install dependencies
npm install
```
The `prepare` script will automatically build the project after installation.
### 4. Build the Project
If you need to rebuild manually:
```bash
npm run build
```
This compiles TypeScript to JavaScript in the `build/` directory.
### 5. Verify Installation
Check that the build completed successfully:
```bash
ls -la build/
```
You should see:
- `index.js` (entry point)
- `server.js` (main server)
- `indexer/` (document parsing and indexing)
- `tools/` (MCP tool implementations)
- `types/` (TypeScript type definitions)
## Claude Desktop Configuration
### Locate Configuration File
The Claude Desktop configuration file is located at:
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
**Linux**: `~/.config/Claude/claude_desktop_config.json`
### Add MCP Server
Edit the configuration file and add the SAP AI Core MCP server:
```json
{
"mcpServers": {
"sap-ai-core-docs": {
"command": "node",
"args": [
"/absolute/path/to/dlwr-dnl-ai-core-documentation-mcp/build/index.js"
]
}
}
}
```
**Important**: Replace `/absolute/path/to/` with your actual absolute path.
#### Example
If your project is in `/Users/nicolaas/code/work/dlwr-dnl-ai-core-documentation-mcp`:
```json
{
"mcpServers": {
"sap-ai-core-docs": {
"command": "node",
"args": [
"/Users/nicolaas/code/work/dlwr-dnl-ai-core-documentation-mcp/build/index.js"
]
}
}
}
```
### Custom Documentation Path (Optional)
If you want to use a different documentation location:
```json
{
"mcpServers": {
"sap-ai-core-docs": {
"command": "node",
"args": [
"/absolute/path/to/dlwr-dnl-ai-core-documentation-mcp/build/index.js"
],
"env": {
"SAP_AI_CORE_DOCS_PATH": "/custom/path/to/sap-artificial-intelligence"
}
}
}
}
```
### Restart Claude Desktop
After saving the configuration, completely quit and restart Claude Desktop for changes to take effect.
## Verification
### Check Available Tools
In Claude Desktop, the following tools should be available:
1. **search_ai_core_docs**: Search SAP AI Core documentation
2. **get_ai_core_document**: Retrieve specific documents
3. **get_ai_core_topic**: Get topic-specific documentation
4. **list_ai_core_categories**: List all documentation categories
### Test the Server
Ask Claude:
```
List all available SAP AI Core documentation categories
```
or
```
Search SAP AI Core documentation for "model training"
```
### Check Claude Desktop Logs
If the server doesn't appear, check Claude Desktop logs:
**macOS**: `~/Library/Logs/Claude/`
Look for errors related to the MCP server initialization.
## Development Setup
### Watch Mode
For active development, use watch mode to automatically recompile on changes:
```bash
npm run watch
```
### MCP Inspector
Test the server independently using the MCP Inspector:
```bash
npx @modelcontextprotocol/inspector node build/index.js
```
This opens a web interface for testing MCP tools without Claude Desktop.
## Troubleshooting
### Server Not Appearing in Claude Desktop
**Issue**: MCP server doesn't show up in Claude Desktop
**Solutions**:
1. Verify the path in `claude_desktop_config.json` is absolute
2. Check that `build/index.js` exists and is executable
3. Ensure Claude Desktop was fully restarted
4. Check Claude Desktop logs for errors
### Documentation Not Found
**Issue**: "Index not built" or "No documents found" errors
**Solutions**:
1. Verify submodule was cloned:
```bash
ls docs/sap-artificial-intelligence/
```
2. If empty, reinitialize:
```bash
git submodule update --init --recursive
```
3. Check documentation path in server logs
### Build Errors
**Issue**: TypeScript compilation fails
**Solutions**:
1. Verify Node.js version:
```bash
node --version # Should be 20.0.0+
```
2. Clean and rebuild:
```bash
rm -rf build node_modules package-lock.json
npm install
npm run build
```
3. Check for TypeScript errors:
```bash
npx tsc --noEmit
```
### Permission Errors
**Issue**: `EACCES` or permission denied errors
**Solutions**:
1. Ensure `build/index.js` is executable:
```bash
chmod +x build/index.js
```
2. Check directory permissions:
```bash
ls -la build/
```
### Module Not Found Errors
**Issue**: `Cannot find module` errors
**Solutions**:
1. Verify all dependencies are installed:
```bash
npm install
```
2. Check `node_modules` directory exists
3. Rebuild:
```bash
npm run build
```
## Updating
### Update Documentation
To update the SAP AI Core documentation:
```bash
cd docs/sap-artificial-intelligence
git pull origin main
cd ../..
```
After updating, restart the MCP server (restart Claude Desktop).
### Update Dependencies
To update npm dependencies:
```bash
npm update
npm run build
```
### Update MCP Server Code
If you've modified the server code:
```bash
npm run build
# Restart Claude Desktop
```
## Performance Optimization
### Initial Index Build Time
The server builds an index of all documentation on startup:
- **First run**: 5-10 seconds (depending on documentation size)
- **Subsequent runs**: Same (index is rebuilt each time)
### Memory Usage
Expected memory usage:
- **Idle**: ~50MB
- **Active searching**: ~100MB
- **Large result sets**: ~150MB
### Search Performance
- **Average search**: <100ms
- **Complex queries**: <200ms
- **Large result sets**: <500ms
## Advanced Configuration
### Custom Fuse.js Search Options
Edit `src/indexer/document-index.ts` to customize search behavior:
```typescript
this.fuse = new Fuse(this.documents, {
keys: [
{ name: 'metadata.title', weight: 3 }, // Title importance
{ name: 'metadata.headings', weight: 2 }, // Heading importance
{ name: 'fullContent', weight: 1 }, // Content importance
{ name: 'metadata.keywords', weight: 2.5 } // Keyword importance
],
threshold: 0.4, // Lower = stricter matching (0.0 - 1.0)
minMatchCharLength: 3, // Minimum characters to match
ignoreLocation: true // Match anywhere in text
});
```
### Environment Variables
Available environment variables:
- `SAP_AI_CORE_DOCS_PATH`: Custom documentation path
- `NODE_ENV`: Set to `development` for verbose logging
## Support
For issues or questions:
- **Internal**: Contact delaware Netherlands Data & AI team
- **Documentation**: [SAP AI Core Docs](https://help.sap.com/docs/AI_CORE)
- **GitHub**: [SAP AI Core Documentation](https://github.com/SAP-docs/sap-artificial-intelligence)
---
**delaware Netherlands Data & AI Team**