-
Notifications
You must be signed in to change notification settings - Fork 1
feat: import foundation layer (compression primitives, envelope, state store) #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| }, | ||
| "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" | ||
| ] | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.