Linka MCP Next
A lightweight, modular MCP server for the Linka ecosystem, providing read-only runtime diagnostics, teach artifact management, and controlled actions via a clear contract layer.
README
Linka MCP Next
Clean MCP base for the next Linka generation.
This repository is intentionally separate from the existing Linka desktop runtime. It starts with a small stdio MCP server and keeps the first surface area narrow:
- no Electron shell
- no mobile UI
- no native input helpers
- no historical bridge or teach runtime copied over wholesale
The goal is to provide a maintainable MCP foundation that can grow from a clear contract instead of inheriting the full desktop stack.
If you want to connect it to a live Linka desktop runtime, set LINKA_RUNTIME_URL to the desktop app's local status endpoint, for example:
export LINKA_RUNTIME_URL=http://127.0.0.1:3000
You can also tune the lightweight cache with LINKA_RUNTIME_CACHE_TTL_MS:
export LINKA_RUNTIME_CACHE_TTL_MS=1000
Teach diagnostics use the same runtime URL and a dedicated timeout:
export LINKA_TEACH_TIMEOUT_MS=2000
What it exposes
linka-status: runtime and environment snapshotlinka-manifest: static project manifestlinka-migration: prioritized migration guidance from the old repolinka-bridge-status: bridge state, connected clients, and recent activitylinka-session-diagnostics: pairing, session, and activity diagnosticslinka-health-check: runtime-adapter health summarylinka-control-policy: policy map for future controlled actionslinka-control-plan-action: dry-run-only action planning toollinka-teach-status: Teach exposure and mode snapshotlinka-teach-latest: latest known Teach artifact summarylinka-teach-list-artifacts: compact Teach artifact listinglinka-teach-library-summary: Teach library overviewlinka-teach-get-artifact: bounded Teach artifact detail by idlinka-teach-diagnostics: Teach capability and diagnostics bundlelinka-teach-explain-artifact: read-only explanation of a Teach artifactlinka-teach-run-artifact-dry-run: dry-run execution plan for a Teach artifactlinka-teach-start: confirmation-gated Teach recording startlinka-teach-stop: confirmation-gated Teach recording stop
Contract Layer
Runtime and Teach diagnostics are versioned contracts, not ad hoc payloads.
- Runtime status schema:
src/contracts/runtime-status.schema.json - Teach status schema:
src/contracts/teach-status.schema.json - Teach artifacts schema:
src/contracts/teach-artifacts.schema.json - Teach artifact detail schema:
src/contracts/teach-artifact-detail.schema.json - Teach library schema:
src/contracts/teach-library.schema.json - Teach explain-artifact schema:
src/contracts/teach-explain-artifact.schema.json - Teach run-artifact dry-run schema:
src/contracts/teach-run-artifact-dry-run.schema.json - Teach start action schema:
src/contracts/teach-start-action.schema.json - Teach stop action schema:
src/contracts/teach-stop-action.schema.json - System overview schema:
src/contracts/system-overview.schema.json - Version fields:
runtimeContractVersionandteachContractVersion - Teach artifacts version field:
teachArtifactsContractVersion - Teach artifact detail version field:
teachArtifactDetailContractVersion - Teach library version field:
teachLibraryContractVersion - Teach explain-artifact version field:
teachExplainArtifactContractVersion - Teach run-artifact dry-run version field:
teachRunArtifactDryRunContractVersion - Teach start action version field:
teachStartActionContractVersion - Teach stop action version field:
teachStopActionContractVersion - System overview version field:
systemOverviewContractVersion
The HTTP adapters validate incoming /api/status, /api/teach/status, /api/teach/artifacts, and /api/teach/artifacts/:id payloads before exposing them through MCP. Validation failures become warnings, malformed payloads are normalized into safe null-filled snapshots, and MCP responses continue to resolve instead of crashing.
Versioning policy:
- Contract versions start at
1.0.0 - Compatible additive changes keep the current major version
- Breaking field removals or type changes require a new major version
- MCP resources and diagnostics include the active contract version alongside the snapshot
Resources
Resources are read-only and intended for agent context, not actions.
linka://runtime/statuslinka://runtime/bridgelinka://runtime/sessionslinka://runtime/healthlinka://runtime/sessionlinka://teach/statuslinka://teach/latestlinka://teach/artifactslinka://teach/librarylinka://teach/capabilitieslinka://system/overview
Requirements
- Node.js 20 or newer
Install
npm install
Run
npm start
The server runs over stdio, which is the simplest shape for MCP clients that spawn local tools.
Test
npm test
To run lint and tests together:
npm run check
Connecting to live Linka
The MCP base auto-selects an adapter:
- If
LINKA_RUNTIME_URLis set, it uses the HTTP runtime adapter and fetchesGET /api/status. - If
LINKA_RUNTIME_URLis not set, it uses the stub adapter. - Both tools and resources share the same in-memory cache, so repeated reads within the TTL do not re-fetch Linka.
linka://runtime/sessionis the authoritative session snapshot for active session state.- Teach uses
GET /api/teach/statuswhenLINKA_RUNTIME_URLis set. - Teach artifact listing uses
GET /api/teach/artifactswhenLINKA_RUNTIME_URLis set. - Teach artifact detail uses
GET /api/teach/artifacts/:idwhenLINKA_RUNTIME_URLis set. - If the Teach endpoint is missing or fails, the MCP layer falls back to a stub snapshot with warnings.
- The Teach HTTP adapter uses
LINKA_TEACH_TIMEOUT_MSwhen set.
Example:
LINKA_RUNTIME_URL=http://127.0.0.1:3000 npm start
Limitations:
- The HTTP adapter is read-only for observation, but
linka-teach-startandlinka-teach-stopcan now perform controlled Teach recording mutations when confirmation is supplied. - The HTTP adapter depends on the Linka desktop runtime exposing
/api/status. - If Linka is offline or the endpoint is unavailable, the adapter returns degraded diagnostics instead of crashing.
- The cache is intentionally lightweight and process-local.
- Resources expose context only; they do not mutate runtime state.
- Some session fields are derived from existing runtime state; if the runtime cannot prove them, they are returned as
null. - Teach is also read-only and only describes the current capability surface.
- Teach artifact listing is read-only and compact; it does not read markdown or screenshot contents by default.
- Teach artifact detail is read-only and bounded; it does not expose raw screenshots or binary data.
- Teach fields may still be
nullwhen the runtime cannot prove them. - Teach artifact listing fields may still be
nullwhen the runtime cannot prove them. - Teach artifact detail previews are capped at 20 actions.
- Contract validation is warning-only so the MCP layer stays available even if the desktop runtime drifts.
- The schema files are the source of truth for required, optional, and nullable fields.
- Backward-compatible additions are allowed; removals or type changes must go through a new contract version.
- Control-plane planning still exists, and the Teach start/stop tools are the first confirmation-gated control actions.
linka-control-policyexposes the future action policy map and confirmation levels.linka-control-plan-actionreturns the safe plan, required confirmation level, cache invalidation targets, and an in-memory audit id without executing anything.- Teach archive and Teach run execution remain out of scope.
Architecture
src/
config.js runtime metadata and defaults
manifest.js manifest, status, and migration snapshots
adapters/ runtime adapter stubs and future runtime bridges
contracts/ JSON schemas and contract validation helpers
runtime/ cache and snapshot sharing
control/ control-policy, dry-run planning, and audit scaffolding
teach/ Teach cache and read-only catalogs
resources.js MCP resource catalog
tools.js MCP tool catalog and responses
server.js MCP registration and transport wiring
index.js process entrypoint
tests/
*.test.js pure-function and module-load tests
Tool contract
linka-status: reports runtime metadata such as Node version, PID, and platformlinka-manifest: reports the base repo contract and boundarieslinka-migration: reports the recommended migration order from the desktop repolinka-bridge-status: reports bridge message counts, connected clients, and warningslinka-session-diagnostics: reports pairing/session state and last activitylinka-health-check: reports whether the runtime adapter looks healthy or degradedlinka-control-policy: reports the current control policy map for future actionslinka-control-plan-action: reports what would be required to safely perform a future control actionlinka://runtime/status: read-only runtime snapshot for agent contextlinka://runtime/bridge: read-only bridge snapshot for agent contextlinka://runtime/sessions: read-only session snapshot for agent contextlinka://runtime/health: read-only health snapshot for agent contextlinka://runtime/session: complete active session snapshot for agent contextlinka-teach-status: reports whether Teach is exposed to MCP and what mode it is inlinka-teach-latest: reports the latest known Teach artifact summarylinka-teach-list-artifacts: reports the compact Teach artifact listinglinka-teach-library-summary: reports the Teach library overviewlinka-teach-get-artifact: reports a bounded detail view for one Teach artifact idlinka-teach-diagnostics: reports Teach capabilities, artifacts, and limitationslinka-teach-explain-artifact: reports a safe, read-only explanation of a known Teach artifactlinka-teach-run-artifact-dry-run: reports a dry-run execution plan for a Teach artifactlinka://teach/status: read-only Teach status for agent contextlinka://teach/latest: read-only Teach artifact summary for agent contextlinka://teach/artifacts: read-only Teach artifact listing for agent contextlinka://teach/library: read-only Teach library overview for agent contextlinka://teach/capabilities: read-only Teach capability map for agent contextlinka://system/overview: consolidated runtime + Teach system snapshot for agent context, including the Teach library summarylinka-control-policyandlinka-control-plan-actionare planning-only scaffolding for Phase 7A; they do not execute actionslinka-teach-explain-artifactreuses the existing artifact detail cache and only derives an explanation from metadata and bounded action previewslinka-teach-run-artifact-dry-runreuses the artifact detail cache and explanation metadata to plan future execution, but it never executes, mutates, or sends input
Why this repo exists
The existing Linka repository is a full desktop product with Electron, native input backends, pairing, bridge flows, and macOS-first teach capture. That is useful reference material, but it is not the cleanest starting point for an MCP-native base.
This repo stays focused on the next layer:
- MCP tool registration
- structured responses
- small, testable helpers
- explicit migration boundaries
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。