mcp-agent-app
Converts GeoJSON geometries into 3D triangulated meshes using a local LLM (Ollama), exposing an MCP tool for mesh generation.
README
mcp-agent-app
A TypeScript service that converts GeoJSON geometries into 3D triangulated meshes using a local LLM (Ollama). It exposes an MCP tool (generate_mesh) and an HTTP API, making mesh generation accessible both to MCP-compatible clients and standard REST consumers.
POST /generate-mesh
│
▼
Express API (src/api/index.ts)
│
▼
generateMeshAgent (src/agents/generate_mesh_agent.ts)
│
▼
Ollama LLM ──────────────────────────────────────────> MeshData
(llama3.2 @ localhost:11434) { vertices, indices, metadata }
MCP server (src/server.ts) exposes the same agent as an MCP tool over stdio
Stack
| Layer | Technology |
|---|---|
| Language | TypeScript 5 (strict, ES2022, ESM) |
| Runtime | Node.js 18+ with tsx for development |
| Web framework | Express 4 |
| MCP SDK | @modelcontextprotocol/sdk v1.29, @modelcontextprotocol/server v2.0 alpha |
| Schema validation | Zod |
| Local LLM | Ollama (llama3.2 at http://localhost:11434) |
Note: The MCP server and HTTP API use Ollama for inference — no Anthropic API key is required for the core mesh generation.
ANTHROPIC_API_KEYis only needed if you extend the agent loop with Claude tool-use.
Project structure
src/
├── server.ts # MCP server — registers and runs the generate_mesh tool
├── agents/
│ └── generate_mesh_agent.ts # Core logic: GeoJSON → Ollama → MeshData
└── api/
└── index.ts # Express HTTP API wrapping the agent
Prerequisites
- Node.js 18+
- Ollama running locally with the
llama3.2model pulled:ollama pull llama3.2 ollama serve # must be running on http://localhost:11434
Setup
npm install
Run (dev, no build step)
npm run dev # starts the Express API on port 3000 (default)
In another terminal:
curl -X POST http://localhost:3000/generate-mesh \
-H "Content-Type: application/json" \
-d '{"geometry": "{\"type\":\"Polygon\",\"coordinates\":[[[0,0],[1,0],[1,1],[0,1],[0,0]]]}"}'
The geometry field accepts either a JSON string or a parsed GeoJSON object (Geometry or Feature).
Expected response shape:
{
"vertices": [0, 0, 0, 1, 0, 0, ...],
"indices": [0, 1, 2, ...],
"metadata": {
"featureType": "Polygon",
"vertexCount": 8,
"triangleCount": 4
}
}
Mesh conventions
| Geometry type | Mesh output |
|---|---|
| Polygon / MultiPolygon | Flat base (z=0) + extruded top (z=10) + side walls |
| LineString | Ribbon mesh, width 0.0001° |
| Point | Small pyramid |
Coordinates map as: longitude → x, latitude → y, elevation → z.
Build & run (production)
npm run build
npm start
Run the MCP server standalone
npm run mcp
# or inspect it interactively:
npx @modelcontextprotocol/inspector npx tsx src/server.ts
The MCP server exposes one tool — generate_mesh — that accepts a GeoJSON geometry or Feature as a JSON string and returns the same MeshData structure as the HTTP API.
NPM scripts
| Script | Description |
|---|---|
npm run dev |
Start API in watch mode via tsx |
npm start |
Run compiled dist/api/index.js |
npm run build |
Compile TypeScript to dist/ |
npm run mcp |
Run the MCP server standalone |
Environment variables
| Variable | Default | Description |
|---|---|---|
PORT |
3000 |
Express server port |
CORS_ORIGINS |
http://localhost:5173 |
Comma-separated list of allowed CORS origins |
Notes
- The MCP server logs to stderr, never stdout — stdout is the stdio protocol channel.
- Ollama responses are validated with a Zod schema; a regex fallback handles markdown-wrapped JSON output.
- The HTTP API allows requests with no
Originheader (server-to-server calls) in addition to the CORS allowlist. - For production: TLS at a reverse proxy, auth + rate limiting in front of
/generate-mesh, and request timeouts viaAbortController. - To swap in a remote MCP server, replace
StdioClientTransportwithStreamableHTTPClientTransportin the MCP manager.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。