Skip to main content

Model Context Protocol (MCP) Overview

LanOnasis provides a comprehensive Model Context Protocol (MCP) server for AI agent and IDE integrations, enabling real-time memory operations, API key management, and secure access control.

What is MCP?

The Model Context Protocol is a standardized protocol for AI assistants to interact with external tools and services. LanOnasis MCP server provides:

  • Memory Operations: Create, search, update, and manage memories via MCP tools
  • API Key Management: Secure vendor API key storage and rotation
  • Real-time Communication: SSE (Server-Sent Events) and WebSocket support
  • Multi-Protocol Support: HTTP REST, WebSocket, SSE, and stdio transports
  • Enterprise Security: Authentication, authorization, and audit logging

Production Endpoint

Base URL: https://mcp.lanonasis.com

Protocols Available:

  • SSE: https://mcp.lanonasis.com/sse - Server-Sent Events for real-time streaming
  • WebSocket: wss://mcp.lanonasis.com/ws - WebSocket for bidirectional communication
  • HTTP REST: https://mcp.lanonasis.com/api/v1/mcp/* - REST API endpoints
  • Stdio: For local development and CLI integration

Quick Start

1. Authentication

Obtain a token via the Central Auth Gateway:

# Using Device Flow (headless)
lanonasis auth login

# Or via PKCE in browser
# Visit: https://api.lanonasis.com/auth/pkce

2. Connect to MCP Server

Using CLI:

# Auto-connect (uses best available mode)
lanonasis mcp connect

# Force remote mode
lanonasis mcp connect --remote

# Force WebSocket mode
lanonasis mcp connect --websocket

# Local development
lanonasis mcp connect --local

Using SDK:

import { MCPClient } from '@lanonasis/mcp-client';

const client = new MCPClient({
endpoint: 'https://mcp.lanonasis.com',
apiKey: 'your-api-key',
transport: 'sse' // or 'websocket', 'http'
});

await client.connect();

3. Use MCP Tools

// List available tools
const tools = await client.listTools();

// Call a tool
const result = await client.callTool('create_memory', {
title: 'My Memory',
content: 'Memory content here',
type: 'knowledge'
});

Available Tools

Memory Tools

ToolDescriptionParameters
create_memoryCreate a new memory with vector embeddingtitle, content, type, tags, metadata
get_memoryRetrieve a memory by IDmemory_id
update_memoryUpdate an existing memorymemory_id, title?, content?, tags?
delete_memoryDelete a memorymemory_id
list_memoriesList memories with filterslimit?, offset?, type?, tags?
search_memoriesSemantic search across memoriesquery, limit?, threshold?, type?
bulk_delete_memoriesDelete multiple memoriesmemory_ids[]

API Key Tools

ToolDescriptionParameters
create_api_keyCreate a new API keyname, type, environment, project_id
list_api_keysList API keys for organizationproject_id?, environment?
get_api_keyGet API key detailskey_id
rotate_api_keyRotate an API keykey_id
revoke_api_keyRevoke an API keykey_id

System Tools

ToolDescriptionParameters
health_checkCheck MCP server health-
get_statsGet memory statisticsuser_id?
list_topicsList memory topicsuser_id?

Transport Protocols

Server-Sent Events (SSE)

Best for: Real-time streaming, one-way communication

const client = new MCPClient({
endpoint: 'https://mcp.lanonasis.com',
transport: 'sse'
});

Features:

  • Automatic reconnection
  • Heartbeat/ping-pong
  • Event streaming
  • Low latency

WebSocket

Best for: Bidirectional communication, interactive applications

const client = new MCPClient({
endpoint: 'wss://mcp.lanonasis.com/ws',
transport: 'websocket'
});

Features:

  • Full duplex communication
  • Lower overhead than HTTP
  • Real-time updates
  • Connection pooling

HTTP REST

Best for: Simple integrations, webhooks, serverless functions

curl -X POST https://mcp.lanonasis.com/api/v1/mcp/message \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"method": "tools/call",
"params": {
"name": "create_memory",
"arguments": {
"title": "My Memory",
"content": "Content here"
}
}
}'

Stdio

Best for: Local development, CLI tools, desktop applications

# Start local MCP server
lanonasis mcp-server start --stdio

# Connect via stdio
# (automatically handled by CLI)

Authentication

All MCP requests require authentication:

API Key Authentication

# Header
X-API-Key: your-api-key

# Or Bearer token
Authorization: Bearer your-token

Token Scopes

Tokens can have different scopes:

  • memory:read - Read memories
  • memory:write - Create/update memories
  • memory:delete - Delete memories
  • apikeys:read - Read API keys
  • apikeys:write - Manage API keys
  • mcp:access - Access MCP resources

Error Handling

MCP follows JSON-RPC 2.0 error format:

{
"jsonrpc": "2.0",
"id": "request-id",
"error": {
"code": -32603,
"message": "Internal error",
"data": {
"details": "Additional error information"
}
}
}

Common Error Codes

CodeDescription
-32600Invalid Request
-32601Method Not Found
-32602Invalid Params
-32603Internal Error
-32000Server Error
-32001Authentication Required
-32002Permission Denied
-32003Rate Limit Exceeded

Rate Limiting

MCP endpoints are rate-limited:

  • Free Tier: 60 requests/minute
  • Pro Tier: 300 requests/minute
  • Enterprise: Custom limits

Rate limit headers:

X-RateLimit-Limit: 300
X-RateLimit-Remaining: 299
X-RateLimit-Reset: 1640995200

Best Practices

  1. Use Connection Pooling: Reuse connections when possible
  2. Handle Reconnections: Implement automatic reconnection logic
  3. Monitor Rate Limits: Check rate limit headers and back off when needed
  4. Use Appropriate Transport: Choose transport based on your use case
  5. Cache Tool Definitions: Cache tools/list results to reduce API calls
  6. Batch Operations: Use bulk operations when possible
  7. Error Handling: Always handle errors gracefully with retries