Skip to main content
OpenIDEA has a built-in MCP server that AI agents use to work with the open project (see MCP server). A plugin can add its own tools to it: declare each tool with a JSON Schema for its input, and implement the calls in code. This is the mcp-provider export and the mcp host interface (mcp.wit, API 1.4).

Declare a tool

find-notes.schema.json:
The schema is validated at install and by openidea-plugin check. A plugin with tools needs code (wasm).

Implement the calls

Implement openidea_plugin::McpProvider and register the mcp export:
This example uses serde_json, so add it to Cargo.toml.
  • tool is the local name (find_notes), arguments the JSON text of the input, already checked against the schema (at most 1 MiB). ctx is the project’s invocation context.
  • Return text. For structured results, return JSON encoded as text. Results are at most 4 MiB.
  • The WIT export is mcp-provider.call(tool, arguments, ctx); the world plugin-mcp includes the base plugin world, and the export-only mcp-tools world composes with it.

How calls run

  • Enabled tools are listed on every request, so disabling or uninstalling the plugin withdraws them immediately.
  • A call runs in the plugin’s own instance with its own grants, CPU fuel and the 5-second command budget. The MCP client grants no extra permissions: a call to a host function the plugin lacks a capability for returns Error::Denied.
  • A tool has the project’s invocation context but is not a user command or event: APIs reserved to commands and events (dialogs, start_run, opening tabs, …) return invalid.
  • A destructive call that the user rejects or cancels, or that has no window to ask in, fails.
  • If two enabled plugins normalise to the same tool name, both tools are withheld.
  • The built-in server currently serves local projects; tool calls for remote projects get its “not supported for remote projects yet” response.

Pointing an agent at the server

host::mcp_stdio_command() (WIT mcp.stdio-command, no capability) returns the argv of the stdio bridge for the invoking project, for example ["/path/openidea", "--mcp-stdio", "--project", "/project"]. A plugin that launches or configures an agent can pass it on. It returns None while the server is off, without a project window, or on a remote host without its own running server. It never exposes the server’s HTTP URL or token.

Testing

Call McpProvider::call directly against the SDK’s mock host in cargo test. The data-tools fixture declares read-only, writing and destructive tools and is used by the host’s tests.