mimoe-agent

mimoe-agent

MCP server for the mimOE AI Agent, enabling on-device tools like device discovery, network insight, and persistent note storage via natural language.

Category
访问服务器

README

mimOE AI Agent

A small AI agent built for the mimOE edge runtime. It has two layers:

  1. The mim (src/) — a Node.js microservice deployed inside mimOE that runs the agent loop, exposes tools via MCP, and streams responses via SSE.
  2. Python clients (mimoe_client_*.py) — terminal chat interfaces that connect to mimOE from the outside, demonstrating two different integration approaches.

All inference runs entirely on-device — no cloud calls.


Approach

Two ways to connect to mimOE

This project intentionally provides two Python clients to show the difference between connecting at the LLM layer vs. the agent layer:

mimoe_client_direct.py mimoe_client_mim.py
Connects to mimOE LLM directly Deployed mim
Endpoint /mimik-ai/openai/v1 /api/my-agent/v1/chat/completions
Agent logic Runs in the Python client Runs inside the mim on mimOE
Tools get_current_time, calculate discoverLocal, getDeviceInfo, saveNote, ...
Protocol OpenAI JSON SSE stream
Requires mim deployed No Yes
Framework OpenAI Python SDK requests + SSE parsing

Framework choices

Mim (Node.js): mimik's own @mimik/agent-kit and @mimik/mcp-kit — purpose-built for the mimOE runtime. They give zero-friction access to the local inference endpoint (port injected via global.context), a first-class MCP server for tool definitions, and native access to mimOE platform APIs (mesh discovery, persistent storage).

Client A — Direct LLM (mimoe_client_direct.py): OpenAI Python SDK with base_url pointing to localhost:8083. mimOE speaks the OpenAI chat completions protocol verbatim, so swapping cloud → local is a single config line. The agent loop, tool execution, and conversation history all live in the Python script.

Client B — Via Mim (mimoe_client_mim.py): requests library with stream=True to consume the SSE events the mim emits. The Python client is just a thin terminal UI — the mim handles the full agent loop including tool calls.

How the components connect

─── Client A (Direct LLM) ───────────────────────────────────────────

  mimoe_client_direct.py
       │  HTTP POST /mimik-ai/openai/v1/chat/completions
       ▼
  mimOE LLM  (smollm2-360m / qwen3-1.7b)
       │
       └─ tool_calls? → execute locally (time, calculate) → loop
          final text?  → print to terminal


─── Client B (Via Mim) ──────────────────────────────────────────────

  mimoe_client_mim.py
       │  HTTP POST /api/my-agent/v1/chat/completions
       ▼
  my-agent mim  (src/index.js → src/agent.js)
       │
       ├──► mimOE LLM  (/mimik-ai/openai/v1)
       └──► MCP tools  (src/tools.js)
               - discoverLocal   (/mimik-mesh/insight/v1)
               - getDeviceInfo   (global.context.info)
               - saveNote / getNote / listNotes / deleteNote
                                 (global.context.storage)
       │
       └─ streams SSE events back → client prints to terminal


─── Mim internal loop (src/) ────────────────────────────────────────

  POST /chat/completions
       │
       ▼
  src/index.js  ← router, extracts messages / context / sessionId
       │
       ▼
  src/agent.js  ← @mimik/agent-kit Agent
       │           agentic loop: LLM → tool_calls → results → LLM → ...
       │
       ├──► mimOE LLM  (127.0.0.1:{httpPort}/mimik-ai/openai/v1)
       └──► src/tools.js  ← @mimik/mcp-kit MCP server

Prerequisites

  • mimOE Studio installed and running
  • A model loaded in the Model View (e.g. SmolLM2-360M or Qwen3-1.7B)
  • Node.js 18+ (for building and deploying the mim)
  • Python 3.9+ (for running the clients)

Quick start — Python clients

pip install -r requirements.txt

# Client A: talk directly to the mimOE LLM (no mim required)
python mimoe_client_direct.py

# Client B: talk to the deployed mim (mim must be running)
python mimoe_client_mim.py

Environment variables (optional — defaults work out of the box):

Variable Used by Default
MIMOE_ENDPOINT mimoe_client_direct.py http://localhost:8083/mimik-ai/openai/v1
INFERENCE_API_KEY mimoe_client_direct.py 1234
INFERENCE_MODEL mimoe_client_direct.py smollm2-360m
MIM_BASE_URL mimoe_client_mim.py http://localhost:8083/api/my-agent/v1

Deploy the mim

# First-time: install deps, build bundle, deploy
./scripts/init.sh
./scripts/deploy.sh --build

# Subsequent deploys (no rebuild needed)
./scripts/deploy.sh

# Tear down and redeploy from scratch
./scripts/deploy.sh --build --redeploy

The mim will appear under Standalone mims in mimOE Studio once deployed.

Mim environment variables

Copy .env and fill in the keys from mimOE Studio:

Variable Where to find it Default
MCM_API_KEY mimOE Studio → Settings required
INFERENCE_API_KEY mimOE Studio → Model View → API 1234
INFERENCE_MODEL Model name as shown in mimOE qwen3-1.7b
INSIGHT_API_KEY mimOE Studio → Settings required

Store keys in ~/.mimoe/mimoe-api-key.env; the deploy script sources it automatically.


Mim API

Base URL: http://localhost:8083/api/my-agent/v1

Chat — streams SSE events:

POST /chat/completions
Content-Type: application/json

{
  "messages": [{ "role": "user", "content": "What devices are on my network?" }],
  "context": { "userName": "David" },       ← optional: injected into system prompt
  "x-session-id": "session-001"             ← optional header: scoped memory
}

MCP tool introspection:

POST /mcp
{ "jsonrpc": "2.0", "id": 1, "method": "tools/list" }

Healthcheck:

GET /healthcheck

See test/local.http for ready-to-run examples (VS Code REST Client).


Project structure

mimoe_client_direct.py   Python client — connects directly to mimOE LLM
mimoe_client_mim.py      Python client — connects to the deployed mim via SSE
requirements.txt         Python dependencies (openai, requests)
src/
  index.js    HTTP router — exposes /chat/completions, /mcp, /healthcheck
  agent.js    Agent loop — wires @mimik/agent-kit to the local inference endpoint
  tools.js    MCP tool definitions (device discovery, note storage)
  polyfills.js
scripts/
  init.sh          One-time setup (npm install, build, mimOE runtime)
  start-mimoe.sh   Start the local mimOE instance
  deploy.sh        Build, upload, and start the mim on mimOE
config/
  default.yml          Mim package config
  start-example.json   Environment variable template
test/
  local.http   REST Client requests for manual testing

Technical decisions

Why not LangChain / LlamaIndex for the mim? Both add abstraction layers between the code and the HTTP call. mimOE already exposes an OpenAI-compatible endpoint and provides its own agent and MCP SDKs with direct access to platform features (mesh discovery, on-device storage) that a generic framework cannot reach. Fewer dependencies, same result.

Why MCP for tools? The Model Context Protocol gives the agent a clean, declarative way to expose tools. The same /mcp endpoint can be consumed by any MCP-compatible client. It also keeps tool logic isolated from agent orchestration logic.

Why SSE for the chat endpoint? The agent loop can involve multiple LLM round-trips and tool executions. SSE lets callers see tool-call progress incrementally rather than waiting for the full loop to complete.

Why two Python clients? To show the architectural choice explicitly: the agent logic can live in the client (direct LLM) or in the server (via mim). Both are valid. The mim approach moves the agent onto the edge device; the direct approach keeps it on the caller.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选