Complete Node.js MCP (Model Context Protocol) server for SAP BTP Cloud Foundry development with GitHub Copilot integration. This project has full development history and context preserved for easy continuation in any repository.
- β
Parse MTA descriptor files (
mta.yaml
) and extract all resources/modules - β Get XSUAA OAuth2 tokens for SAP BTP authentication with caching
- β Query Cloud Foundry API for applications, services, spaces, organizations
- β Enhanced error logging with complete stack traces and context
- β Cross-repository usage (works from any Git repository)
- β GitHub Copilot integration with SAP BTP context awareness
npm install && npm run build
npm run mcp:parse examples/sample-mta.yaml
# Copy wrapper to your project
cp examples/sap-cf-wrapper.sh /path/to/your-sap-project/
chmod +x /path/to/your-sap-project/sap-cf-wrapper.sh
# Use it immediately
cd /path/to/your-sap-project
./sap-cf-wrapper.sh parse mta.yaml
./sap-cf-wrapper.sh token
./sap-cf-wrapper.sh resources
# Copy MCP configuration to your project
cp examples/vscode-mcp.json /path/to/your-project/.vscode/mcp.json
# Copy tasks and instructions to your project (optional)
cp examples/tlm-main-tasks.json /path/to/your-project/.vscode/tasks.json
cp examples/.copilot-instructions-tlm.md /path/to/your-project/.copilot-instructions.md
Note: The MCP server automatically disables console logging when running in MCP mode to prevent interference with the stdio-based MCP protocol. All logs are written to files (combined.log
, error.log
) for debugging purposes.
parse_mta
- Parse MTA descriptor files and extract all resource/module informationget_access_token
- Get OAuth2 tokens from XSUAA service with caching and validationget_cf_resources
- Query Cloud Foundry API for apps, services, spaces, organizations
get_service_binding
- Get CF service binding parameters and credentialsupload_openapi_spec
- Register OpenAPI specifications for generic API callscall_api
- Make authenticated API calls using registered OpenAPI specslist_api_specs
- List all registered OpenAPI specificationsget_api_operations
- Show available operations for a registered API spec
# 1. Parse your MTA file to identify services
npm run mcp:parse ./mta.yaml
# 2. Login to CF (prerequisite)
cf login
# 3. Get service binding for any service (e.g., bookshop-db)
# Use MCP tool: get_service_binding with serviceName: "bookshop-db"
# 4. Upload OpenAPI spec for any SAP service
# Use MCP tool: upload_openapi_spec with Service Manager, Destination, etc.
# 5. Make authenticated API calls
# Use MCP tool: call_api with automatic token handling
Option 1: Interactive Menu
npm run tools:menu
Option 2: Direct Commands
# List MTA files in workspace
npm run mcp:list
# Parse specific MTA file
npm run mcp:parse ./mta.yaml
# Start MCP server
npm run mcp:server
Option 3: VS Code Tasks
- Open Command Palette (
Ctrl+Shift+P
) - Type "Tasks: Run Task"
- Choose "Parse MTA File", "Start MCP Server", or "Build MCP Server"
Ask GitHub Copilot context-aware questions:
- "Parse this MTA file and explain the resources"
- "What XSUAA configuration is needed?"
- "Generate CF API calls for this service"
- "Add a new MCP tool for [functionality]"
The repository includes GitHub Copilot instructions that understand SAP BTP patterns, MTA structures, and CF APIs.
The server can parse mta.yaml
files and extract useful information:
# Example mta.yaml
_schema_version: 3.3.0
ID: my-sap-app
version: 1.0.0
modules:
- name: my-app
type: nodejs
requires:
- name: my-xsuaa
resources:
- name: my-xsuaa
type: org.cloudfoundry.managed-service
parameters:
service: xsuaa
service-plan: application
Provide XSUAA service credentials to get access tokens:
{
"credentials": {
"clientid": "your-client-id",
"clientsecret": "your-client-secret",
"url": "https://your-subdomain.authentication.sap.hana.ondemand.com",
"uaadomain": "authentication.sap.hana.ondemand.com"
}
}
Query CF APIs for various resources:
- Organizations:
resourceType: "organizations"
- Spaces:
resourceType: "spaces"
(requiresparentGuid
) - Applications:
resourceType: "applications"
(requiresparentGuid
orresourceName
) - Services:
resourceType: "services"
(requiresparentGuid
orresourceName
)
LOG_LEVEL
- Set logging level (debug, info, warn, error)NODE_ENV
- Set to 'production' for production loggingVCAP_SERVICES
- Cloud Foundry service bindings (when running in CF)
src/
βββ index.ts # Main MCP server
βββ inspector.ts # Testing utility
βββ types/ # TypeScript type definitions
βββ utils/ # Utility functions (logging, MTA parsing)
βββ services/ # Service classes (XSUAA, CF API)
βββ tools/ # MCP tool implementations
npm run build
- Compile TypeScript to JavaScriptnpm run dev
- Run in development mode with auto-reloadnpm start
- Start the compiled servernpm run inspector
- Test the server functionalitynpm run lint
- Run ESLintnpm run lint:fix
- Fix ESLint issuesnpm test
- Run tests (Jest)npm run clean
- Clean build artifacts
- Create tool definition in
src/tools/
- Implement handler function
- Register in
src/index.ts
- Export from
src/tools/index.ts
All tools return standardized responses:
{
success: boolean;
data?: any; // Success data
error?: string; // Error message
statusCode?: number; // HTTP status (for API calls)
}
This server follows the Model Context Protocol specification and can be used with any MCP-compatible client:
Add to your claude_desktop_config.json
:
{
"mcpServers": {
"sap-cf": {
"command": "node",
"args": ["/path/to/sap-cf-mcp-server/dist/index.js"]
}
}
}
The server uses stdio transport and can be integrated with any MCP client library.
- Never log sensitive information like access tokens or credentials
- Access tokens are cached but not persisted
- Credentials should be provided per-request or via environment variables
- Use HTTPS endpoints for all API calls
- XSUAA - Authentication and authorization
- Destination Service - External system connectivity
- Connectivity Service - On-premise connectivity
- Application Router - Multi-tenant applications
org.cloudfoundry.managed-service
- CF managed servicesorg.cloudfoundry.existing-service
- Existing CF servicesorg.cloudfoundry.user-provided-service
- User-provided services
- Module resolution errors - Ensure you've run
npm install
andnpm run build
- Authentication failures - Verify XSUAA credentials and network connectivity
- API timeouts - Check Cloud Foundry API endpoint accessibility
- MTA parsing errors - Validate YAML syntax and schema version
Enable debug logging:
LOG_LEVEL=debug npm start
Logs are written to:
error.log
- Error messages onlycombined.log
- All log messages- Console - Development mode
This project contains complete development history and context in:
PROJECT_HISTORY.md
- Full development timeline, decisions, and technical context.copilot-instructions.md
- GitHub Copilot integration guidelines and SAP BTP contextdocs/enhanced-error-logging.md
- Error logging implementation and usage
- β Complete MCP server implementation with all tools functional
- β GitHub Copilot integration working seamlessly
- β Cross-repository usage enabled for multiple SAP BTP projects
- β Enhanced error logging with complete stack traces implemented
- β VS Code integration without extension complexity
- β Production-ready with comprehensive error handling
π MCP Server Core:
βββ π§ parse_mta tool β Parse MTA descriptors & extract resources
βββ π get_access_token β XSUAA OAuth2 token management with caching
βββ βοΈ get_cf_resources β Cloud Foundry API client for all resources
π Integration Options:
βββ π₯οΈ CLI Tools β Direct command-line usage and testing
βββ π VS Code Tasks β Integrated development workflow
βββ π€ GitHub Copilot β AI-assisted SAP BTP development
βββ π Shell Wrapper β Simple cross-project integration
- Enhanced Error Logging: Complete error objects with stack traces, codes, and context
- Cross-Repository Design: Use from any Git repository via absolute path references
- GitHub Copilot Integration: Comprehensive AI development assistance with SAP BTP context
- Improved Reliability: Better error handling, validation, and logging throughout
When you move this to a new repository, everything is preserved:
- All functionality works immediately after
npm install && npm run build
- Cross-repository integration examples are in
examples/
directory - Complete development context is documented for AI assistants
- GitHub Copilot instructions provide full SAP BTP context
- All error logging includes complete diagnostic information
- Move to new repository - All context and functionality preserved
- Test with
npm run build && npm run mcp:parse examples/sample-mta.yaml
- Integrate with other SAP BTP projects using examples
- Use GitHub Copilot with full SAP BTP context awareness
- Extend functionality using established patterns
- PROJECT_HISTORY.md: Complete development timeline and technical decisions
- Error logs: Check
error.log
for complete diagnostic information with stack traces - Examples: All integration patterns documented in
examples/
directory - AI Assistant: GitHub Copilot has full project context via
.copilot-instructions.md