gravity-agent-mcp
An Omni-Agent MCP server that provides Khmer cultural context and Web3 blockchain query tools, with security and routing built in.
README
<p align="center"> <img src="Images/gravity-aggent-mcp.png" width="500"> </p>
gravity-agent-mcp
A next-generation Omni-Agent system built on the Model Context Protocol (MCP). gravity-agent-mcp is an intelligent, secure, context-aware assistant that bridges local cultural nuance (Khmer / Cambodian) with automation and Web3 capabilities, exposed to clients like Claude Desktop over a stdio transport.
1. The 7 Core Pillars
| # | Pillar | Status | Where it lives |
|---|---|---|---|
| 1 | Localization & Khmer Culture Agent | ✅ Implemented | src/tools/khmerCulture.ts |
| 2 | Hyper-Personalized Productivity | 🧩 Stub (see note) | src/tools/ (to add) |
| 3 | Decentralized / Web3 Agent | ✅ Implemented | src/tools/web3.ts |
| 4 | Cross-Platform Automation Agent | 📘 Playbook | docs/automation-playbook.md |
| 5 | Security & Privacy Guard | ✅ Implemented | src/middleware/security.ts |
| 6 | Intelligent Routing | ✅ Implemented | src/router.ts |
| 7 | Zero-Configuration | ✅ One-line config | claude_desktop_config.json |
Note: Pillars 2/4 are not yet shipped as live tools.
create_calendar_event(productivity) andkhmer_greetingwere scaffolding and were removed during the modular refactor; the Automation Agent is currently documented as an orchestration playbook rather than a meta-tool. Add them assrc/tools/*.tsmodules to complete the set.
2. Tech Stack
- Language: TypeScript (strict) / Node.js ≥ 18
- Framework:
@modelcontextprotocol/sdk - Transport: JSON-RPC 2.0 over Stdio
- Client: Claude Desktop (or any MCP-compatible client)
3. Project Structure
gravity-agent-mcp/
├── src/
│ ├── index.ts # Entry point: Server init + Stdio transport
│ ├── router.ts # Pillar 6 — dispatch (switch-case) + tool registry
│ ├── core/
│ │ └── types.ts # Shared contract (ToolMeta, ToolResult, ToolHandler…)
│ ├── middleware/
│ │ └── security.ts # Pillar 5 — withSecurityGuard() interceptor
│ └── tools/
│ ├── khmerCulture.ts # Pillar 1 — get_khmer_culture_context
│ └── web3.ts # Pillar 3 — web3_blockchain_query
├── docs/
│ └── automation-playbook.md# Pillar 4 — orchestration guide
├── build/ # Compiled output (generated by tsc)
├── package.json
└── tsconfig.json
The entry point (src/index.ts) does only three things: initialize the
Server, attach ListTools/CallTool handlers (delegating to src/router.ts),
and connect over Stdio. All tool logic, guarding, and routing live in src/.
4. Tools
| Tool | Category | Sensitive? | Description |
|---|---|---|---|
get_khmer_culture_context |
culture | No | Returns localized Cambodian context for a topic (legal_business_registration, khmer_etiquette, phnom_penh_zones). |
web3_blockchain_query |
web3 | Yes | Inspects a wallet address on Ethereum/Solana; returns simulated native + token balances. Address format is regex-validated. |
Sensitive tools pass through the Security & Privacy Guard, which logs the intercept and runs a (simulated) confirmation gate before executing.
5. Setup
Prerequisites
- Node.js ≥ 18 and npm.
Install & build
npm install # install dependencies (SDK + TypeScript)
npm run build # compile src/ → build/ (tsc)
Run (stdio)
npm start # node build/index.js
The server reads JSON-RPC requests from stdin and writes responses to stdout. All diagnostics (server/security/routing logs) go to stderr so the JSON-RPC stream on stdout stays clean — this is required for stdio MCP.
6. Connect to Claude Desktop (Zero-Config, Pillar 7)
Edit your claude_desktop_config.json (macOS:
~/Library/Application Support/Claude/claude_desktop_config.json;
Windows: %APPDATA%\Claude\claude_desktop_config.json). Add a mcpServers
entry pointing at the compiled build/index.js with an absolute path:
{
"mcpServers": {
"gravity-agent-mcp": {
"command": "node",
"args": [
"/absolute/path/to/gravity-agent-mcp/build/index.js"
]
}
}
}
Common pitfalls (these cause the "pipe broke" error / no tool icon):
- Pointing
argsatindex.tsinstead of the compiledbuild/index.js(Node can't run TypeScript directly).- Using a relative path — Claude Desktop launches from a different cwd, so always use an absolute path.
- Any
console.log/process.stdout.writein tool code corrupts the JSON-RPC stream. This project logs only viaconsole.error.- Forgetting to run
npm installbeforenpm run build(missing SDK).
Restart Claude Desktop after editing the config; the tools/plug icon appears once the server handshakes successfully.
7. Example: call a tool over JSON-RPC
Send newline-delimited JSON-RPC messages on stdin:
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"cli","version":"1.0"}}}
{"jsonrpc":"2.0","method":"notifications/initialized"}
{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"get_khmer_culture_context","arguments":{"topic":"khmer_etiquette"}}}
Expected tools/call result (truncated):
{
"content": [
{ "type": "text", "text": "{ \"topic\": \"khmer_etiquette\", \"title\": \"…\", \"dos\": […], \"donts\": […] }" }
]
}
For web3_blockchain_query, the server logs a [SECURITY] Intercepted … (sensitive: true)
line to stderr and runs the simulated confirmation before returning balances.
8. Development notes
- Add a tool: create
src/tools/<name>.tsexportingdefinition: ToolMetaandexecute(args), then add acaseto theswitchinsrc/router.ts(wrap the call inwithSecurityGuard). Export itsdefinitionfromtoolDefinitionsforListTools. - Security policy: mark a tool sensitive by setting
category: "web3"or"productivity"inSENSITIVE_CATEGORIES(src/core/types.ts). SetSECURITY_MODE.interactiveConfirmation = trueinsrc/middleware/security.tsto require a real client "Allow" prompt instead of the simulation. - Build output:
build/is generated; it is safe to delete and regenerate withnpm run build.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。