vision-agent-mcp
MCP Server for Vision Agent Tools
Documentation
VisionAgent MCP Server
> Beta β v0.1
> This project is early access and subject to breaking changes until v1.0.
VisionAgent MCP Server v0.1 - Overview
Modern LLM βagentsβ call external tools through the **Model Context Protocol (MCP). VisionAgent MCP** is a lightweight, side-car MCP server that runs locally on STDIN/STDOUT, translating each tool call from an MCP-compatible client (Claude Desktop, Cursor, Cline, etc.) into an authenticated HTTPS request to Landing AIβs VisionAgent REST APIs. The response JSON, plus any images or masks, is streamed back to the model so that you can issue natural-language computer-vision and document-analysis commands from your editor without writing custom REST code or loading an extra SDK.
πΈ Demo
https://github.com/user-attachments/assets/2017fa01-0e7f-411c-a417-9f79562627b7
π§° Supported Use Cases (v0.1)
| Capability | Description |
|---|---|
| `agentic-document-analysis` | Parse PDFs / images to extract text, tables, charts, and diagrams taking into account layouts and other visual cues. Web Version here. |
| `text-to-object-detection` | Detect free-form prompts (βall traffic lightsβ) using OWLv2 / CountGD / Florence-2 / Agentic Object Detection (Web Version here); outputs bounding boxes. |
| `text-to-instance-segmentation` | Pixel-perfect masks via Florence-2 + Segment-Anything-v2 (SAM-2). |
| `activity-recognition` | Recognise multiple activities in video with start/end timestamps. |
| `depth-pro` | High-resolution monocular depth estimation for single images. |
> Run `npm run generate-tools` whenever VisionAgent releases new endpoints. The script fetches the latest OpenAPI spec and regenerates the local tool map automatically.
πΊ Table of Contents
1. Quick Start
7. Contributing
π Quick Start
Get Your VisionAgent API Key
If you do not have a VisionAgent API key, create an account and obtain your API key.
# 1 Install
npm install -g vision-tools-mcp
# 2 Configure your MCP client with the following settings:
{
"mcpServers": {
"VisionAgent": {
"command": "npx",
"args": ["vision-tools-mcp"],
"env": {
"VISION_AGENT_API_KEY": "",
"OUTPUT_DIRECTORY": "/path/to/output/directory",
"IMAGE_DISPLAY_ENABLED": "true" # or false, see below
}
}
}
}3. Open your MCP-aware client.
4. Download *street.png* (from the assets folder in this directory, or you can choose any test image).
5. Paste the prompt below (or any prompt):
Detect all traffic lights in /path/to/mcp/vision-agent-mcp/assets/street.pngIf your client supports inline resources, youβll see bounding-box overlays; otherwise, the PNG is saved to your output directory, and the chat shows its path.
Prerequisites
| Software | Minimum Version |
|---|---|
| Node.js | 20 (LTS) |
| VisionAgent account | Any paid or free tier (needs API key) |
| MCP client | Claude Desktop / Cursor / Cline / *etc.* |
βοΈ Configuration
| ENV var | Required | Default | Purpose |
|---|---|---|---|
| `VISION_AGENT_API_KEY` | Yes | β | Landing AI auth token. |
| `OUTPUT_DIRECTORY` | No | β | Where rendered images / masks / depth maps are stored. |
| `IMAGE_DISPLAY_ENABLED` | No | `true` | `false` β skip rendering |
Sample MCP client entry (`.mcp.json` for VS Code / Cursor)
{
"mcpServers": {
"VisionAgent": {
"command": "npx",
"args": ["vision-tools-mcp"],
"env": {
"VISION_AGENT_API_KEY": "912jkefief09jfjkMfoklwOWdp9293jefklwfweLQWO9jfjkMfoklwDK",
"OUTPUT_DIRECTORY": "/Users/me/documents/mcp/test",
"IMAGE_DISPLAY_ENABLED": "false"
}
}
}
}For MCP clients without image display capabilities, like Cursor, set IMAGE_DISPLAY_ENABLED to False. For MCP clients with image display capabilities, like Claude Desktop, set IMAGE_DISPLAY_ENABLED to true to visualize tool outputs. Generally, MCP clients that support resources (see this list: https://modelcontextprotocol.io/clients) will support image display.
π‘ Example Prompts
| Scenario | Prompt (after uploading file) |
|---|---|
| Invoice extraction | *βExtract vendor, invoice date & total from this PDF using `agentic-document-analysis`.β* |
| Pedrestrian Recognition | *βLocate every pedestrian in street.jpg via `text-to-object-detection`.β* |
| Agricultural segmentation | *βSegment all tomatoes in kitchen.png with `text-to-instance-segmentation`.β* |
| Activity recognition (video) | *βIdentify activities occurring in match.mp4 via `activity-recognition`.β* |
| Depth estimation | *βProduce a depth map for selfie.png using `depth-pro`.β* |
π Architecture & Flow
ββββββββββββββββββββββ 1. human prompt βββββββββββββββββββββ
β MCP-capable client βββββββββββββββββββββββββββββΆβ VisionAgent MCP β
β (Cursor, Claude) β β (this repo) β
ββββββββββββββββββββββ βββββββββββ²ββββββββββ
β² 6. rendered PNG / JSON β 2. JSON tool call
β β
β 5. preview path / data 3. HTTPS β
β βΌ
local disk ββββββββββββ Landing AI VisionAgent
βββββββββββββββ Cloud APIs
4. JSON / media blob1. Prompt β tool-callβThe client converts your natural-language prompt into a structured MCP call.
2. ValidationβThe server validates args with Zod schemas derived from the live OpenAPI spec.
3. ForwardβAn authenticated Axios request hits the VisionAgent endpoint.
4. ResponseβJSON + any base64 media are returned.
5. VisualizationβIf enabled, masks / boxes / depth maps are rendered to files.
6. Return to chatβThe MCP client receives data + file paths (or inline previews).
π§βπ» Developer Guide
Hereβs how to dive into the code, add new endpoints, or troubleshoot issues.
Installation & Build
1. Clone the repository:
git clone https://github.com/landing-ai/vision-agent-mcp.git2. Navigate into the project directory:
cd vision-agent-mcp3. Install dependencies:
npm install4. Build the project:
npm run buildEnvironment Variables
- `VISION_AGENT_API_KEY` - Required API key for VisionAgent authentication
- `OUTPUT_DIRECTORY` - Optional directory for saving processed outputs (supports relative and absolute paths)
- `IMAGE_DISPLAY_ENABLED` - Set to `"true"` to enable image visualization features
Client Configuration
After building, configure your MCP client with the following settings:
{
"mcpServers": {
"VisionAgent": {
"command": "node",
"args": [
"/path/to/build/index.js"
],
"env": {
"VISION_AGENT_API_KEY": "",
"OUTPUT_DIRECTORY": "../../output",
"IMAGE_DISPLAY_ENABLED": "true"
}
}
}
}> Note: Replace `/path/to/build/index.js` with the actual path to your built `index.js` file, and set your environment variables as needed. For MCP clients without image display capabilities, like Cursor, set IMAGE_DISPLAY_ENABLED to False. For MCP clients with image display capabilities, like Claude Desktop, set IMAGE_DISPLAY_ENABLED to true to visualize tool outputs. Generally, MCP clients that support resources (see this list: https://modelcontextprotocol.io/clients) will support image display.
π Scripts & Commands
| Script | Purpose |
|---|---|
| `npm run build` | Compile TypeScript β `build/` (adds executable bit). |
| `npm run start` | Build *and* run (`node build/index.js`). |
| `npm run typecheck` | Type-only check (`tsc --noEmit`). |
| `npm run generate-tools` | Fetch latest OpenAPI and regenerate `toolDefinitionMap.ts`. |
| `npm run build:all` | Convenience: `npm run build` + `npm run generate-tools`. |
> Pro Tip: If you modify any files under `src/` or want to pick up new endpoints from VisionAgent, run `npm run build:all` to recompile + regenerate tool definitions.
π Project Layout
vision-agent-mcp/
βββ .eslintrc.json # ESLint config (optional)
βββ .gitignore # Ignore node_modules, build/, .env, etc.
βββ jest.config.js # Placeholder for future unit tests
βββ mcp-va.md # Draft docs (incomplete)
βββ package.json # npm metadata, scripts, dependencies
βββ package-lock.json # Lockfile
βββ tsconfig.json # TypeScript compiler config
βββ .env # Your environment variables (not committed)
β
βββ src/ # TypeScript source code
β βββ generateTools.ts # Dev script: fetch OpenAPI β generate MCP tool definitions (Zod schemas)
β βββ index.ts # Entry point: load .env, start MCP server, handle signals
β βββ toolDefinitionMap.ts # Auto-generated MCP tool definitions (donβt edit by hand)
β βββ toolUtils.ts # Helpers to build MCP tool objects (metadata, descriptions)
β βββ types.ts # Core TS interfaces (MCP, environment config, etc.)
β β
β βββ server/ # MCP server logic
β β βββ index.ts # Create & start the MCP server (Server + Stdio transport)
β β βββ handlers.ts # `handleListTools` & `handleCallTool` implementations
β β βββ visualization.ts # Post-process & save image/video outputs (masks, boxes, depth maps)
β β βββ config.ts # Load & validate .env, export SERVER_CONFIG & EnvConfig
β β
β βββ utils/ # Generic utilities
β β βββ file.ts # File handling (base64 encode images/PDFs, read streams)
β β βββ http.ts # Axios wrappers & error formatting
β β
β βββ validation/ # Zod schema generation & argument validation
β βββ schema.ts # Convert JSON Schema β Zod, validate incoming tool args
β
βββ build/ # Compiled JavaScript (generated after `npm run build`)
β βββ index.js
β βββ generateTools.js
β βββ toolDefinitionMap.js
β βββ β¦ # Mirror of `src/` structure
β
βββ output/ # Runtime artifacts (bounding boxes, masks, depth maps, etc.)
β
βββ assets/ # Static assets (e.g., demo.gif)
βββ demo.gifπ Key Components
1. `src/generateTools.ts`
2. `src/toolDefinitionMap.ts`
3. `src/server/handlers.ts`
4. `src/server/visualization.ts`
5. `src/utils/file.ts`
6. `src/utils/http.ts`
7. `src/validation/schema.ts`
8. `src/index.ts`
vision-tools-api MCP Server (v0.1.0) running on stdio, proxying to https://api.va.landing.aiπ§ Error Handling & Logs
- Validation Errors
If you send invalid or missing parameters, the server returns:
{
"id": 3,
"error": {
"code": -32602,
"message": "Validation error: missing required parameter βimagePathβ"
}
}- Network Errors
Axios errors (timeouts, 5xx) are caught and returned as:
{
"id": 4,
"error": {
"code": -32000,
"message": "VisionAgent API error: 502 Bad Gateway"
}
}- Internal Exceptions
Uncaught exceptions in handlers produce:
{
"id": 5,
"error": {
"code": -32603,
"message": "Internal error: Unexpected token in JSON at position 345"
}
}π Troubleshooting
Authentication failed
- Verify `VISION_AGENT_API_KEY` is correct and active.
- Free tiers have rate limitsβcheck your dashboard.
- Ensure outbound HTTPS to `api.va.landing.ai` isnβt blocked by a proxy/VPN.
βTool not foundβ in chat
The local tool map may be stale. Run:
npm run generate-tools
npm startNode < 20 error
The code uses the Blob & FormData APIs natively introduced in Node 20.
Upgrade via `nvm install 20` (mac/Linux) or download from nodejs.org if on Windows.
For other issues, refer to the MCP documentation: https://modelcontextprotocol.io/quickstart/user
Also not that specific clients will have their own helpful documentation. For example, if you are using the OpenAI Agents SDK, refer to their documentation here: https://openai.github.io/openai-agents-python/mcp/
π€ Contributing
We love PRs!
1. Fork β `git checkout -b feature/my-feature`.
2. `npm run typecheck` (no errors)
3. Open a PR explaining what and why.
π Security & Privacy
- The MCP server runs locally, so no files are forwarded anywhere except Landing AIβs API endpoints you explicitly call.
- Output images/masks are written to `OUTPUT_DIRECTORY` only on your machine.
- No telemetry is collected by this project.
> *Made with β€οΈ by the LandingAI Team.*
Frequently asked questions
What is vision-agent-mcp?
vision-agent-mcp is MCP Server for Vision Agent Tools
How do I install vision-agent-mcp?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is vision-agent-mcp open source?
Yes β it is hosted on GitHub at https://github.com/landing-ai/vision-agent-mcp and has 19 stars.
Related MCP tools
The official TypeScript SDK for Model Context Protocol servers and clients Trusted by 10500+ developers. Trusted by 10500+ developers.
Visual testing tool for MCP servers TypeScript-based implementation. Trusted by 7300+ developers. Trusted by 7300+ developers.
It's like v0 but in your Cursor/WindSurf/Cline. 21st dev Magic MCP server for working with your frontend like Magic TypeScript-based implementation.
Model Context Protocol Server for Mobile Automation and Scraping (iOS, Android, Emulators, Simulators and Real Devices) TypeScript-based implementation.
Https://github.com/user-attachments/assets/364b6705-14d4-4e6d-bea7-fb9f12664fab for the Model Context Protocol. Enhance AI assistants with powerful integrations
MCP server that provides tools and resources for interacting with n8n API TypeScript-based implementation. Trusted by 1400+ developers.
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP