# MCP Server for Cursor Integration A Managed Context Provider (MCP) server that integrates Cursor with Coda.io documentation. This server provides context-aware responses by querying your Coda.io documentation tables. ## Features - Integration with Coda.io API - Caching system for improved performance - RESTful API endpoints - Support for multiple Coda tables - Health check and cache management endpoints ## Prerequisites - Node.js (v14 or higher) - A Coda.io account with API access - A Coda.io document with relevant tables ## Setup 1. Clone the repository 2. Install dependencies: ```bash npm install ``` 3. Create a `.env` file based on `.env.example`: ```bash cp .env.example .env ``` 4. Update the `.env` file with your Coda.io credentials: - `CODA_API_TOKEN`: Your Coda.io API token - `CODA_DOC_ID`: Your Coda.io document ID ## Running the Server Development mode: ```bash npm run dev ``` Production mode: ```bash npm start ``` ## Tunneling with ngrok To expose your local server to the internet using ngrok: 1. Install ngrok: ```bash npm install -g ngrok ``` 2. Start your MCP server (in a separate terminal): ```bash npm start ``` 3. Create a tunnel to your local server: ```bash ngrok http 3000 ``` 4. Ngrok will provide you with a public URL (e.g., `https://xxxx-xxxx-xxxx.ngrok-free.app`) 5. Update your `mcp.json` file with the ngrok URL: ```json { "mcpServers": { "Coda MCP": { "url": "https://xxxx-xxxx-xxxx.ngrok-free.app/context", "method": "POST", "headers": { "Content-Type": "application/json" } } } } ``` Note: The ngrok URL will change each time you restart ngrok unless you have a paid account. Make sure to update your `mcp.json` file with the new URL when it changes. ## API Endpoints ### Get Context ``` POST /context Body: { "query": "your search query" } ``` ### Health Check ``` GET /health ``` ### Cache Management ``` POST /cache/clear GET /cache/stats ``` ## Coda.io Integration The server expects the following tables in your Coda.io document: - Jira Tickets - API Documentation - Architecture Decisions You can modify the table names in `src/services/mcp.service.js` to match your Coda.io document structure. ## Error Handling The server includes comprehensive error handling for: - API request failures - Invalid queries - Cache management - Server errors ## Contributing Feel free to submit issues and enhancement requests!