4 releases
new 0.4.27 | May 1, 2025 |
---|---|
0.4.26 | May 1, 2025 |
0.4.25 | Apr 30, 2025 |
#989 in GUI
56 downloads per month
34KB
110 lines
tauri-plugin-mcp
A Tauri plugin for interacting with MCP servers.
Install
This plugin requires a Rust version of at least 1.77.2
src-tauri/Cargo.toml
[dependencies]
tauri-plugin-mcp = { version = "0.4.27" }
# or
tauri-plugin-mcp = { git = "https://github.com/moeru-ai/airi", tag = "0.4.27" }
You can install the JavaScript Guest bindings using your preferred JavaScript package manager:
pnpm add @proj-airi/tauri-plugin-mcp
# or use @antfu/ni
ni @proj-airi/tauri-plugin-mcp
Usage
First, you need to register the plugin with Tauri:
src-tauri/src/lib.rs
fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_mcp::Builder.build())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
import { callTool, connectServer, disconnectServer, listTools } from '@proj-airi/tauri-plugin-mcp'
// Sample: Connect to a container running Airi Android
await connectServer('docker', 'run -i --rm -e ADB_HOST=host.docker.internal ghcr.io/lemonnekogh/airi-android:v0.1.0')
console.log(await listTools())
// [
// {
// description: 'Get the battery level of the device',
// inputSchema: {
// required: [],
// title: 'battery_level',
// type: 'object',
// },
// name: 'battery_level',
// },
// ]
console.log(await callTool('battery_level', {}))
// {
// content: [
// {
// type: 'text',
// text: '100',
// },
// ],
// isError: false,
// }
await disconnectServer()
Development
Source code of JavaScript bindings is located in packages/tauri-plugin-mcp.
These files are generated from tauri-plugin
crate:
permissions/autogenerated
permissions/schemas
TODO List
- Move to a single repository
- Server connection
- stdio
- SSE
- Tools
- List tools
- Simple: Names only
- With description, parameters, returns
- Call tool
- Simple: Name only
- With parameters
- Returns
- Image returns
- List tools
- Prompts...
- Resources...
- JavaScript package to call commands conveniently
Dependencies
~21–57MB
~1M SLoC