Documentation

MCP Server

Access Loly Framework documentation and tools directly from your AI assistant using the Model Context Protocol (MCP).

What is MCP?

The Model Context Protocol (MCP) is a standard protocol that allows AI assistants to access external tools and resources. The Loly MCP server provides your AI assistant with:

  • Access to complete Loly Framework documentation
  • Code examples for common patterns
  • API reference information
  • Code generation and validation tools

Installation

The Loly MCP server is available at:

https://loly-framework.onrender.com/api/mcp

The MCP server is hosted and ready to use. Simply configure your AI assistant with the URL above.

Setting up in Cursor

To use the Loly MCP server in Cursor:

  1. Open Cursor Settings
  2. Navigate to Features → Model Context Protocol
  3. Click "Add Server"
  4. Enter the following configuration:
Cursor MCP Configuration
{
  "mcpServers": {
    "loly": {
      "url": "https://loly-framework.onrender.com/api/mcp",
      "headers": {
        "Content-Type": "application/json"
      }
    }
  }
}

Replace https://loly-framework.onrender.com with your actual server URL. For remote HTTP servers, use the url configuration directly.

Note: For remote HTTP servers, use the url configuration. The command with @modelcontextprotocol/server-fetch is not needed for HTTP endpoints.

Automatic Setup with AI Assistant

You can ask your AI assistant (Cursor, Windsurf, or any MCP-compatible assistant) to automatically configure the Loly MCP server for you. Simply copy and paste the following prompt:

Quick Setup Prompt:

Copy this prompt to your AI assistant
Please configure the Loly Framework MCP server in my Cursor/Windsurf configuration.

MCP Server Details:
- Server Name: loly
- Server URL: https://loly-framework.onrender.com/api/mcp
- Transport: HTTP (remote server)

Configuration to add to mcp.json:
{
  "mcpServers": {
    "loly": {
      "url": "https://loly-framework.onrender.com/api/mcp",
      "headers": {
        "Content-Type": "application/json"
      }
    }
  }
}

Instructions:
1. Locate or create the MCP configuration file (usually at ~/.cursor/mcp.json or in your Cursor/Windsurf settings)
2. Add the "loly" server configuration to the "mcpServers" object
3. If the file already has other MCP servers, merge this configuration with the existing ones
4. Ensure the JSON is valid and properly formatted
5. Save the file and restart Cursor/Windsurf for the changes to take effect

The MCP server provides access to:
- Loly Framework documentation search
- Code examples and patterns
- API reference information
- Code generation and validation tools

How to use:

  1. Copy the prompt above
  2. Paste it into your AI assistant chat (Cursor, Windsurf, etc.)
  3. The assistant will automatically configure the MCP server for you
  4. Restart your editor to activate the MCP connection

Setting up in Windsurf

To use the Loly MCP server in Windsurf:

  1. Open Windsurf Settings
  2. Navigate to Extensions → MCP Servers
  3. Click "Add Server"
  4. Enter the following configuration:
Windsurf MCP Configuration
{
  "mcpServers": {
    "loly": {
      "url": "https://loly-framework.onrender.com/api/mcp",
      "headers": {
        "Content-Type": "application/json"
      }
    }
  }
}

Available Tools

The Loly MCP server provides the following tools:

search_loly_docs

Search the Loly Framework documentation for specific topics, APIs, or concepts.

{
  "name": "search_loly_docs",
  "arguments": {
    "query": "API routes"
  }
}

get_loly_example

Get code examples for specific Loly Framework features or patterns.

{
  "name": "get_loly_example",
  "arguments": {
    "category": "routing",
    "topic": "dynamic"
  }
}

generate_loly_code

Generate Loly Framework code based on a description.

{
  "name": "generate_loly_code",
  "arguments": {
    "description": "Create a page that displays a list of posts",
    "type": "page"
  }
}

get_loly_api_reference

Get detailed API reference for a specific Loly Framework API.

{
  "name": "get_loly_api_reference",
  "arguments": {
    "api": "ApiContext"
  }
}

validate_loly_code

Validate Loly Framework code syntax and structure.

{
  "name": "validate_loly_code",
  "arguments": {
    "code": "export async function GET(ctx: ApiContext) { return ctx.Response({}); }"
  }
}

Available Resources

The following documentation resources are available:

  • loly://docs/getting-started
  • loly://docs/routing
  • loly://docs/api-routes
  • loly://docs/websockets
  • loly://docs/rendering
  • loly://docs/middlewares
  • loly://docs/security
  • loly://docs/configuration
  • loly://docs/api-reference

Usage Examples

Example: Initialize Connection

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "initialize",
  "params": {
    "protocolVersion": "2024-11-05",
    "capabilities": {},
    "clientInfo": {
      "name": "cursor",
      "version": "1.0.0"
    }
  }
}

Example: List Available Tools

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/list"
}

Example: Call a Tool

{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "search_loly_docs",
    "arguments": {
      "query": "API routes"
    }
  }
}

Example: Read a Resource

{
  "jsonrpc": "2.0",
  "id": 4,
  "method": "resources/read",
  "params": {
    "uri": "loly://docs/getting-started"
  }
}

Troubleshooting

Server not responding

Verify that the MCP endpoint URL in your configuration is correct and that the server is accessible from your network.

Connection refused

Verify that your server is listening on the correct port and that there are no firewall rules blocking the connection.

Invalid request errors

Ensure that your requests follow the JSON-RPC 2.0 format and include the required Content-Type: application/json header.

Tool not found errors

Use the tools/list method to see all available tools and verify you're using the correct tool name.

"No server info found" error

This error typically occurs when using @modelcontextprotocol/server-fetch with a remote HTTP server. For remote HTTP servers, use the url configuration directly instead of command with server-fetch. Make sure to restart Cursor after changing the configuration.