# MCP Tools & HTTP Endpoints (Rule)
For tool schemas, request/response formats, and endpoints.
## MCP Tools (5 total)
- **`search`**: Unified search across all documentation sources (alias: `sap_docs_search`)
- **`fetch`**: Retrieve specific documents by ID (alias: `sap_docs_get`)
- **`sap_community_search`**: Search SAP Community posts with full content (max 75k chars per post with intelligent truncation)
- **`sap_help_search`**: Search SAP Help Portal using private APIs
- **`sap_help_get`**: Retrieve full SAP Help page content (max 75k chars with intelligent truncation)
**Note**: Tool names may appear with prefixes depending on MCP client (e.g., `mcp_sap-docs-remote_search`)
## Content Size Limits
- **Maximum**: 75,000 characters (~18,750 tokens) for SAP Help and Community content
- **Algorithm**: Intelligent truncation preserving beginning (60%) and end (20%) with clear notice
- **Configuration**: `CONFIG.MAX_CONTENT_LENGTH` in `src/lib/config.ts`
- **Details**: See `docs/CONTENT-SIZE-LIMITS.md`
## Server Implementations
- **Stdio MCP**: `src/server.ts` - Main MCP server for Claude integration
- **HTTP Test Server**: `src/http-server.ts` - Development server (port 3001)
- Endpoints: `/status`, `/healthz`, `/readyz`, `/mcp`
- **Streamable HTTP**: `src/streamable-http-server.ts` - Production HTTP MCP (port 3122)
- Endpoints: `/mcp`, `/health`
## Response Formats
### **Standard Text Format**
- **Search Results**: `⭐️ **<id>** (Score: <score>)` format
- **Context Detection**: Emoji indicators (🎨 UI5, 🏗️ CAP, 🧪 wdi5)
- **Source Attribution**: Library grouping with clear source identification
### **ChatGPT/JSON Format**
- **Search**: `{ "results": [{ "id", "title", "url", "snippet", "score" }] }`
- **Fetch**: `{ "id", "title", "text", "url", "metadata" }`
- **Structured**: Clean JSON for programmatic access and ChatGPT compatibility
## Integration Points
- **Community**: HTML scraping + LiQL API for post content
- **SAP Help**: Private elasticsearch + metadata + page content APIs
- **Local Docs**: File system access with URL generation
## Configuration
- **Tool Descriptions**: Comprehensive help text in server implementations
- **Input Schemas**: Detailed parameter descriptions and examples
- **Error Handling**: Graceful fallbacks and informative error messages
@file src/lib/BaseServerHandler.ts
@file src/server.ts
@file src/http-server.ts
@file src/streamable-http-server.ts
@file src/lib/localDocs.ts
@file src/lib/sapHelp.ts
@file src/lib/communityBestMatch.ts
@file src/lib/truncate.ts
@file src/lib/config.ts
@file src/lib/types.ts
@file docs/CONTENT-SIZE-LIMITS.md
@file docs/LLM-FRIENDLY-IMPROVEMENTS.md
@file docs/ARCHITECTURE.md
@file docs/DEV.md