Skip to content

AI MCP Integration

MCP (Model Context Protocol) is an open protocol created by Anthropic that enables AI tools to connect to external systems in a standardized way. Microi MCP Server (Open Source Repository) allows AI tools to directly connect to the Microi platform, query database schemas in real-time, read engine code, and execute engines remotely.

What is Microi MCP

Microi MCP Server enables AI tools like GitHub Copilot, Cursor, and Claude Code to directly operate the Microi platform — no more manually copying and pasting table structures or API docs. AI can retrieve your database schema and business code in real-time.

AI Capabilities

ToolFunctionRead/Write
microi_get_statusCheck backend connection statusRead-only
microi_get_db_schemaGet database schema (table names, fields, types, descriptions)Read-only
microi_list_enginesList all API enginesRead-only
microi_get_engine_codeGet API engine JavaScript source codeRead-only
microi_save_engine_codeSave API engine codeRead-write
microi_create_engineCreate a new API engineRead-write
microi_run_engineExecute API engine remotelyRead-write
microi_list_eventsList all V8 form eventsRead-only
microi_get_event_codeGet V8 event source codeRead-only
microi_save_event_codeSave V8 event codeRead-write

Prerequisites

  • Microi backend service deployed
  • An AI programming tool installed (GitHub Copilot / Cursor / Claude Code)

Most users don't need manual MCP configuration

After installing the Microi VS Code Extension, MCP is automatically configured and ready to use out of the box.

After installing the extension, it automatically:

  • Generates .vscode/mcp.json (GitHub Copilot) and .cursor/mcp.json (Cursor)
  • Auto-refreshes tokens, no password storage needed
  • Injects AI instruction files (.github/copilot-instructions.md, CLAUDE.md, .cursorrules)

Workflow: Install extension → Configure server connection → Pull code → MCP is ready.

The following content is for users who don't use the VS Code extension or need SSE remote deployment.

Manual Configuration: Local stdio Mode

The AI tool automatically launches the MCP Server process on each startup.

Installation

bash
git clone https://gitee.com/microi-net/microi.mcp.git
cd microi.mcp
npm install
npm run build

GitHub Copilot (VS Code)

Add to .vscode/mcp.json in your project:

json
{
  "servers": {
    "microi": {
      "type": "stdio",
      "command": "node",
      "args": ["/path/to/microi.mcp/dist/index.js"],
      "env": {
        "MICROI_API_URL": "https://your-api-url",
        "MICROI_USERNAME": "username",
        "MICROI_PASSWORD": "password",
        "MICROI_OS_CLIENT": ""
      }
    }
  }
}

Cursor

Create .cursor/mcp.json in your project root:

json
{
  "mcpServers": {
    "microi": {
      "command": "node",
      "args": ["/path/to/microi.mcp/dist/index.js"],
      "env": {
        "MICROI_API_URL": "https://your-api-url",
        "MICROI_USERNAME": "username",
        "MICROI_PASSWORD": "password",
        "MICROI_OS_CLIENT": ""
      }
    }
  }
}

Claude Code (CLI)

bash
claude mcp add microi -- \
  env MICROI_API_URL=https://your-api-url \
  env MICROI_USERNAME=username \
  env MICROI_PASSWORD=password \
  node /path/to/microi.mcp/dist/index.js

Security Notice

Configuration files contain sensitive information. Add .vscode/mcp.json and .cursor/mcp.json to .gitignore to prevent committing to Git.

Deploy MCP Server as a Docker container so everyone connects to the same SSE endpoint.

Docker Deployment

bash
cd microi.mcp
cp .env.example .env
# Edit .env with backend URL and admin credentials
docker compose up -d

Nginx Reverse Proxy

Recommended to mount under your existing API domain:

nginx
# MCP SSE endpoint
location /mcp/sse {
    proxy_pass http://127.0.0.1:3000/sse;
    proxy_http_version 1.1;
    proxy_set_header Connection '';
    proxy_buffering off;
    proxy_cache off;
    proxy_read_timeout 86400s;
}

# MCP message endpoint
location /mcp/messages {
    proxy_pass http://127.0.0.1:3000/messages;
    proxy_http_version 1.1;
}

# MCP health check
location /mcp/health {
    proxy_pass http://127.0.0.1:3000/health;
}

Verify Deployment

bash
curl https://api.example.com/mcp/health
# Should return {"status":"ok","server":"microi-mcp-server","version":"1.0.0"}

Connect AI Tools via SSE

GitHub Copilot (.vscode/mcp.json):

json
{
  "servers": {
    "microi": {
      "url": "https://api.example.com/mcp/sse",
      "headers": {
        "X-Microi-Username": "username",
        "X-Microi-Password": "password",
        "X-Microi-OsClient": ""
      }
    }
  }
}

Cursor (.cursor/mcp.json):

json
{
  "mcpServers": {
    "microi": {
      "url": "https://api.example.com/mcp/sse",
      "headers": {
        "X-Microi-Username": "username",
        "X-Microi-Password": "password",
        "X-Microi-OsClient": ""
      }
    }
  }
}

Environment Variables

VariableRequiredDescriptionExample
MICROI_API_URLMicroi backend API URLhttps://api.microi.net
MICROI_USERNAMELogin username (required without Token)admin
MICROI_PASSWORDLogin password (required without Token)password
MICROI_OS_CLIENTNoApplication identifier (multi-tenant)myApp
MICROI_TOKENDirect Token (takes priority over username/password)Bearer xxx

Usage Examples

After configuring MCP, you can directly operate the platform in AI conversations:

You: Show me all tables in the current database
AI: (calls microi_get_db_schema) The current database has 42 tables...

You: Create an API engine to query the order list
AI: (calls microi_get_db_schema to understand schema → generates code → calls microi_create_engine)
    API engine created with Key: get-order-list...

You: Execute it and show me the results
AI: (calls microi_run_engine) Returned 20 order records...

Relationship with Skills and VS Code Extension

SolutionCapabilitiesUse Case
VS Code ExtensionV8 API knowledge + database schema + code push/pull + debuggingDaily development
MCP Server (this document)Real-time database query, read/save engine code, remote executionAI real-time platform operations
SkillsScenario-specific coding best practices and code templatesCoding standards, in-depth guidance

Recommended: Use all three together

VS Code Extension provides API knowledge and schema → MCP provides real-time data query and remote execution → Skills provide coding best practices.

MIT License.