OpenMoca.Mcp.Server
0.7.0
dotnet add package OpenMoca.Mcp.Server --version 0.7.0
NuGet\Install-Package OpenMoca.Mcp.Server -Version 0.7.0
<PackageReference Include="OpenMoca.Mcp.Server" Version="0.7.0" />
<PackageVersion Include="OpenMoca.Mcp.Server" Version="0.7.0" />
<PackageReference Include="OpenMoca.Mcp.Server" />
paket add OpenMoca.Mcp.Server --version 0.7.0
#r "nuget: OpenMoca.Mcp.Server, 0.7.0"
#:package OpenMoca.Mcp.Server@0.7.0
#addin nuget:?package=OpenMoca.Mcp.Server&version=0.7.0
#tool nuget:?package=OpenMoca.Mcp.Server&version=0.7.0
moca-mcp: the MOCA MCP server
The MCP server for MOCA knowledge packages, in one
download with nothing else to install. Connect a .moca file to Claude
Desktop, Claude Code, VS Code, Cursor or any MCP client, and ask questions
about it with citations you can check.
It is built on the .NET MOCA Reader. Every result is a citation record: the text plus its package, version, digest, signature status, reviews, freshness and evidence.
Install
Download the file for your computer from the latest release and unzip it:
| Computer | File |
|---|---|
| Windows (Intel or AMD) | moca-mcp-win-x64.zip |
| Windows on Arm | moca-mcp-win-arm64.zip |
| Mac with Apple silicon | moca-mcp-osx-arm64.zip |
| Mac with an Intel processor | moca-mcp-osx-x64.zip |
| Linux (x64 or Arm) | moca-mcp-linux-x64.zip, moca-mcp-linux-arm64.zip |
It holds one program, moca-mcp (moca-mcp.exe on Windows). It needs no
.NET, Node.js or anything else installed.
Or, with .NET 10: dotnet tool install -g OpenMoca.Mcp.
The first run: unsigned builds
The builds are not code-signed yet, so your computer warns you the first time. Signing is planned.
- macOS says the developer cannot be verified. In Finder, right-click
moca-mcp, choose Open, then Open again. Or, in Terminal:xattr -d com.apple.quarantine /path/to/moca-mcp. - Windows SmartScreen says it protected your PC. Choose More info, then Run anyway.
Each release lists the SHA-256 of every file, so you can check what you downloaded.
Check a download came from this repository
Each zip, and the moca-mcp program inside it, has a build provenance
attestation: a signed record that this repository's release workflow built
it from the tagged source. With the GitHub CLI,
check the zip you downloaded:
gh attestation verify moca-mcp-osx-arm64.zip --repo openmoca/moca-mcp-dotnet \
--signer-workflow openmoca/moca-mcp-dotnet/.github/workflows/release.yml
Use the name of your file. The same command works on the program itself
(moca-mcp or moca-mcp.exe). It prints the workflow and commit the file
came from, and fails if the file is not one this workflow built.
Connect a package
Claude Desktop keeps its servers in claude_desktop_config.json. To open
it, go to Settings, then Extensions (under Desktop app). At the
bottom of that page, choose Manage, then Edit Config under
Local MCP servers. The file is in ~/Library/Application Support/Claude/
on a Mac and %APPDATA%\Claude\ on Windows.
Add the server, save, and quit and restart Claude. This serves every package in a folder (see A folder of packages):
{
"mcpServers": {
"moca": {
"command": "/path/to/moca-mcp",
"args": ["--library", "/path/to/packages",
"--trust-root", "/path/to/trust-root.json",
"--audience", "public"]
}
}
}
- If the file has no
mcpServersyet, add it as shown, inside the outer{ }and beside any settings already there, with a comma between them. - To serve one package, put its path in place of
"--library", "/path/to/packages". - Use full paths. On Windows, the command is
moca-mcp.exe, and each\is written twice:"C:\\Users\\you\\moca\\moca-mcp.exe".
Other clients take the same command and arguments.
Claude Code, in one line:
claude mcp add acme-support -- /path/to/moca-mcp /path/to/acme-support.moca --trust-root /path/to/trust-root.json
VS Code, with GitHub Copilot: in .vscode/mcp.json, or with MCP: Add
Server from the Command Palette. Then use it from Copilot Chat in agent mode.
{
"servers": {
"moca": {
"type": "stdio",
"command": "/path/to/moca-mcp",
"args": ["--library", "/path/to/packages",
"--trust-root", "/path/to/trust-root.json",
"--audience", "public"]
}
}
}
Cursor: in ~/.cursor/mcp.json for every project, or .cursor/mcp.json
in one, with the same mcpServers entry as Claude Desktop.
JetBrains IDEs, Cline and any other MCP client that runs local servers:
add moca-mcp as a local (stdio) server, with the same command and
arguments.
Then ask: "Using acme-support, how long do customers have to ask for a refund? Cite the page."
ChatGPT and Claude.ai on the web call MCP servers from their own cloud, so they cannot reach a server on your computer: they need a hosted MCP server.
A folder of packages
Keep your packages in one folder, packed (.moca) or unpacked, and serve the
whole folder:
moca-mcp --library ~/moca --trust-root ~/moca/trust-root.json
- Only the manifests are read at start, so a folder of hundreds of packages starts at once. Each package is read and verified the first time a question needs it, then kept in memory for the session.
- Ask about one package at a time. The assistant lists the packages with
moca_list_packages, then names the ones it wants inmoca_search. Listing reads every package, within the memory budget: what the assistant may be told about a package depends on its terms and audience, which are known only once it is read. - Indexes are found by name.
acme.mocai, oracme.<model>.mocai, besideacme.mocaor theacmefolder, is used for that package. Either can be a folder, or a Zip with.zipon the end, as downloaded. - Versions are handled for you. When a package supersedes another, both load together, so the older one is always reported as superseded.
- Composed packages find their members in the same folder.
--watchpicks up packages you add, change or remove while it runs.
Search by meaning
With a standard embedding model installed, packages whose index was built with it are searched by words and meaning together (hybrid): a question finds the page that answers it even when they share no words.
moca-mcp models list # the standard models, and which are installed
moca-mcp models add bge-small-en-v1.5 # download once, checked against its pinned SHA-256
| Model | Size | Best for |
|---|---|---|
bge-small-en-v1.5 |
33 MB | English, a good default |
all-MiniLM-L6-v2 |
22 MB | English, the smallest and fastest |
nomic-embed-text-v1.5 |
131 MB | English, long pages |
multilingual-e5-small |
117 MB | Many languages, French included |
Models go in ~/.moca/models (or --models, or MOCA_MODELS) and load the
first time a search needs them. Build an index with the same model using
moca-index build <package> -o <package>.mocai --model bge-small-en-v1.5
and put it beside the package. A package whose model is not installed is
still searched by words, and moca_list_packages names the model to add.
Usage
moca-mcp [package...] [--library folders...] [--trust-root file] [--audience public,internal] [options]
| Option | Does |
|---|---|
<package> |
A package folder or .moca file, loaded at start. Write package=index to search through a sidecar index |
--library <folders...> |
Folders of packages, loaded on first use |
--trust-root <file> |
Verifies publisher and review attestations. Without it, nothing is reported as signed or reviewed, and no package can supersede or contest another |
--require-signature |
Serve only packages with a valid package attestation under --trust-root. Recommended whenever you give a trust root: without it, an unsigned package, or one whose signature fails, is served too |
--destination <where> |
Where the model that reads the answers runs, for the creator's terms: provider (a third party's model, the default), host (your own service) or device (the person's own device) |
--conditions <list> |
Conditions the model's provider meets, for the creator's terms: noTraining, noRetention |
--audience <list> |
The audiences served, such as public. The assistant cannot widen it. Pages with no audience label are left out |
--allow-unlabelled |
With --audience, also serve pages that have no audience label |
--include-excluded |
Also serve out-of-force, superseded and deprecated content, flagged as such |
--allow-unsigned-relations |
Apply supersedes and conflictsWith from unsigned packages. Only for a library of your own packages |
--members <folders...> |
Where a composed package's members are, if not in the library |
--overlay <layer=file...> |
Structure overlays, as the application or organisation layer |
--watch |
Follow changes to the library folders |
--preload |
Load the library at start, not on first use |
--max-packages <n> |
Most packages a library lists (default 1,000) |
--max-depth <n> |
How deep to look in a library folder (default 3) |
--models <folder> |
Where the standard embedding models are installed (default ~/.moca/models) |
--max-loaded-mb <n> |
Memory budget in megabytes (default 1,000). Each loaded package counts its files plus about 30 KB a page. The least recently used package is unloaded beyond it, and a call loads no more packages than fit, apart from the first it needs |
--max-loaded-pages <n> |
Memory budget in pages kept loaded at once (default 25,000), beside --max-loaded-mb |
Invalid packages are skipped and reported on standard error, with why. The assistant is told nothing about them: to it, they are not there.
Tools and resources
| Tool | Returns |
|---|---|
moca_list_packages |
The packages the assistant may be told of, by id then version: id, version, title, description, publisher, tags, digest, signature, capabilities, page count and search mode. A closed package (below) has only id, version, title, publisher, signed and closedBy |
moca_search |
Citation records, compact by default; detail: "full" for whole records. packages limits it to some packages; mode is lexical, semantic or hybrid. Out-of-force, superseded and deprecated content is left out unless the host starts the server with --include-excluded: the assistant cannot ask for it |
moca_structure |
Structure answers: concept, requires, required_by, parts, narrower, broader, related, sequence or nodes, each naming its layer. nodes gives 20 at a time (limit up to 100) and nextOffset when there are more |
moca_get_node |
One citation record with the page's full text. An id without a version (<package id>#<path>) gives the newest loaded version that may be served, and names the others in otherVersions; a ref (<package id>@<version>#<path>) gives that version |
moca_package_info |
One package's manifest, digest, signers, attestations, members, profiles, the creator's terms and the Reader's findings: why it is, or is not, trusted. A closed package gives only what the list gives |
Every tool is marked read-only, and no tool takes a file path: the assistant
can only choose among the packages you serve. Input is bounded and checked
before anything runs. Every page of a loaded package is also a resource at
moca://node/<URL-encoded versioned reference>, listed 100 at a time. The
audience filter, the default retrieval policy and the creator's terms apply to
tools and resources alike.
Answers are bounded: a text longer than 100,000 bytes is cut and its record
marked truncated, and an answer stops adding records past 400,000 bytes,
saying truncated.
The creator's terms
A package's manifest can say how its creator lets AI use the work, for example "no third party's model" or "no training" (package spec §4.14). Everything the server returns goes to an AI assistant, so the server applies those terms to all of it (Reader contract §15.4).
Set the destination. The terms depend on where the model runs. An MCP
client is a model, so by default the server treats it as a third party's
model with no conditions (provider). Say where yours runs:
| Your model | Start the server with |
|---|---|
| A third party's service (the default) | nothing, or --destination provider |
| A third party's service that does not train on or keep what it is sent | --destination provider --conditions noTraining,noRetention |
| Your own service | --destination host |
| The person's own device | --destination device |
A host using the library sets the same in MocaMcpOptions.Terms. The
assistant cannot change it.
What the assistant is given. From a package the terms allow: search results, nodes and resources with their text, structure labels and definitions, and the package's details. Package text, such as titles, publisher names and page text, is always in its own JSON field, never inside the server's own sentences.
What it is not given. A package is closed when its terms do not allow
the destination. Its text, labels, definitions, description, tags, manifest
and findings are withheld. The assistant can be told only that it exists:
moca_list_packages and moca_package_info give exactly its id, version,
title, publisher, signed and closedBy (the terms that close it), so the
assistant can tell the person why it cannot answer from it. A search that
left results out says so in termsNote.
A creator can also say that a model it closed the work to may not be told the
work exists (ai.allowed.mention: false). That package is hidden: every
tool and resource answers as if the server did not have it, it is left out of
lists before they are paged, and no note or count includes it. The server does not
even say that something was left out.
None of this changes what an app shows a person.
Content stays out of the assistant's view, not out of the server: the server log still names every package it loads. The server never sends package text to an embedding model; it embeds only the assistant's queries.
Terms are the creator's labels, not locks: the server applies them, and the model you connect has its own terms for what it does with the text.
Package text is returned as data inside citation records. Tool descriptions tell the model to quote and cite it, not follow it (Reader contract §12).
Build on it
OpenMoca.Mcp.Server is the server as a .NET library, for your own host:
var moca = await MocaMcpServer.CreateAsync(
new MocaMcpOptions { Audiences = ["public"] },
new FolderPackageSource(new FolderPackageSourceOptions { Folders = ["/srv/moca"] }));
var server = McpServer.Create(new StdioServerTransport("moca"), moca.ServerOptions);
moca.Attach(server);
await server.RunAsync();
- Your own embedder:
MocaMcpOptions.Embedderstakes any ReaderIEmbedder, such as a hosted model through Microsoft.Extensions.AI. - Your own package source: implement
IPackageSource(list packages from their manifests, open one when it is needed, report changes). The server verifies every package it opens, wherever it came from. - Search hooks:
MocaMcpOptions.SearchHookstakes the Reader's ingress and egress hooks, which may narrow or reorder a search, never widen it. - Dependency injection:
services.AddMocaMcp(options).WithPackageSource<MySource>(), thenMocaMcpServerFactory. - Logging: any
ILogger.
Privacy Policy
moca-mcp collects nothing and sends nothing anywhere.
- No network calls. The server reads only the packages, library folders,
trust root, overlays, sidecar indexes and installed models you name or set
up.
moca-mcp models addis the one command that downloads: the model files you ask for, from Hugging Face, checked against their pinned SHA-256. It never fetches anything a package names, and it has no telemetry, analytics or update check. - Your questions stay with you. Searches and the nodes returned go only to the MCP client that asked, over stdio on your own machine. The server keeps no record of them.
- Logs are local and about packages only. It writes to standard error which packages it loaded, their digests, and any problems found in them, never the queries.
The AI assistant you connect it to has its own privacy terms: what it does with the text it receives is governed by them, not by this server.
Develop
Clone moca-spec beside this repository
(or set MOCA_SPEC_DIR), then:
dotnet build moca-mcp-dotnet.slnx
dotnet test --project tests/OpenMoca.Mcp.Tests
Expected answers. tests/parity holds calls over moca-spec's examples
and the answers every build must give: tool definitions, results, resources
and refusals. The tests start the built server and compare. When a tool or a
parameter changes on purpose, add a case, record the answers, and read the
difference before committing it:
dotnet test --project tests/OpenMoca.Mcp.Tests -- --filter-method "*Record_expected_answers" --explicit only
Scale. bench/ measures the library scan, loading, memory and search
time the default limits rest on; see bench/README.md.
The tool and resource definitions are in src/OpenMoca.Mcp/definitions.json.
Release
Push a vX.Y.Z tag. The release workflow builds the six self-contained files,
attests their build provenance, attaches them with their SHA-256 sums to a
GitHub release, and publishes the
OpenMoca.Mcp .NET tool and the OpenMoca.Mcp.Server library to NuGet
through trusted publishing; no NuGet API key is kept anywhere. Tag only once the
OpenMoca.Reader version in Directory.Packages.props is on NuGet.
Standards
| Standard | Where | How strongly |
|---|---|---|
| Model Context Protocol 2025-06-18 | the server, over stdio | follow (one revision behind the latest, 2026-07-28) |
| JSON Schema | tool input schemas, checked before anything runs | follow |
| MOCA (moca-spec) 0.7 | reading, verifying, searching and citing packages, through OpenMoca.Reader | follow |
| ONNX via ONNX Runtime | search by meaning with the standard models | follow |
| SLSA provenance v1, in an in-toto statement signed with Sigstore | the release files (GitHub artifact attestations) | follow |
Built with the help of AI assistants; every change is reviewed and accepted by the maintainer.
Licence
Apache-2.0. See LICENSE and NOTICE. "OpenMOCA" is a trade mark; see the trade mark policy.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.13)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.13)
- ModelContextProtocol.Core (>= 2.3.0)
- OpenMoca.Reader.Onnx (>= 0.7.0)
- OpenMoca.Reader.Sigstore (>= 0.7.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.