Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[Makefile]
indent_style = tab
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
node_modules/
dist/
*.tsbuildinfo

mottainai.*.json
.mottainai/

.DS_Store
*.local
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
*.log

.env
.env.*
!.env.example

.vscode/*
!.vscode/extensions.json
.idea/

coverage/

.codegraph
.claude/worktrees/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 yohn.jp

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
56 changes: 55 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,55 @@
# mottainai
# Mottainai

**Mottainai** ("wasteful" / "what a waste" in Japanese) is a proxy gateway
that sits between an LLM client and one or more upstream
[MCP](https://modelcontextprotocol.io/) servers, and **compresses tool
definitions and tool call results before they reach the model context**.

> **Status: pre-1.0 (`0.x`).** This repository is being imported from a
> private predecessor in a series of small, dependency-ordered PRs so each
> one stays reviewable and keeps the build green. This first PR is the
> foundation layer only (compression primitives, envelope/logging/telemetry,
> state-store basics) — the proxy, upstream connections, and CLI entry point
> land in follow-up PRs. Full architecture docs land once the pieces they
> describe exist in this repo.

## How it fits together

```text
┌───────────────────────────┐
LLM client ⇄ │ mottainai │ ⇄ upstream MCP servers
(Claude Code, │ (this project, one stdio │ (codegraph, fff-mcp,
Codex, etc.) │ MCP endpoint) │ GitHub MCP, ...)
└───────────────────────────┘
```

Every upstream tool will be exposed under a prefixed name
(`<upstream>__<tool>`) to avoid collisions. Tool call results pass through a
compression pipeline before being returned to the client; the pre-compression
original is kept for a short time and can be retrieved on demand instead of
being lost.

## Installation

Requires Node.js >= 22.13, [pnpm](https://pnpm.io/) 11.18.0, and
[ripgrep](https://github.com/BurntSushi/ripgrep) (`rg`) on `PATH`.

```bash
git clone https://github.com/yohn-jp/mottainai.git
cd mottainai
pnpm install
pnpm run build
```

## Development

```bash
pnpm install
pnpm run build # tsc -> dist/
pnpm test # node --import tsx --test "src/**/*.test.ts"
pnpm run typecheck # tsc --noEmit
```

## License

[MIT](LICENSE)
19 changes: 19 additions & 0 deletions mottainai.config.json.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": 2,
"mcpServers": {
"codegraph": {
"command": "codegraph",
"args": ["serve", "--mcp", "--path", "."]
},
"fff": {
"command": "fff-mcp",
"args": ["."]
},
"github": {
"transport": "streamableHttp",
"url": "https://api.githubcopilot.com/mcp/",
"capabilities": ["github"],
"enabled": false
}
}
}
56 changes: 56 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "@yohn-jp/mottainai",
"version": "0.1.0",
"description": "MCP proxy gateway: aggregates upstream MCP servers behind one endpoint and compresses their tool definitions and results before they reach the LLM.",
"type": "module",
"main": "./dist/index.js",
"exports": {
".": "./dist/index.js"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
},
"files": [
"dist",
"README.md",
"LICENSE"
],
"scripts": {
"build": "tsc -p tsconfig.build.json",
"test": "node --import tsx --test \"src/**/*.test.ts\"",
"typecheck": "tsc --noEmit",
"prepublishOnly": "npm run build"
},
"dependencies": {
"@modelcontextprotocol/sdk": "^1.11.0",
"tree-sitter": "^0.22.4",
"tree-sitter-javascript": "^0.23.1",
"tree-sitter-typescript": "^0.23.2",
"zod": "^3.24.4"
},
"devDependencies": {
"@types/node": "^22.15.3",
"tsx": "^4.19.4",
"typescript": "^5.8.3"
},
"engines": {
"node": ">=22.13"
},
"packageManager": "pnpm@11.18.0",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/yohn-jp/mottainai.git"
},
"homepage": "https://github.com/yohn-jp/mottainai#readme",
"bugs": {
"url": "https://github.com/yohn-jp/mottainai/issues"
},
"keywords": [
"mcp",
"model-context-protocol",
"mcp-server",
"llm",
"agent",
"gateway",
"proxy",
"tool-compression"
]
}
Loading