Skip to content

dustingelegonya/zed-mainframe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zed Mainframe Extension

Zed extension that exposes mainframe-mcp as a context server for the Agent Panel, enabling AI agents to access the mainframe knowledge graph.

Features

  • Native MCP context server integration with Zed's Agent Panel
  • 7 MCP tools: upsert_entity, get_entity, search_entities, search_similar, get_graph_stats, add_relationship, get_related_entities
  • Configurable via settings.json (path, args, env)
  • Includes zed-ninja skill for Zed editor expertise

Prerequisites

  1. mainframe-mcp binary at ~/.local/bin/mainframe-mcp:

    cd /path/to/mainframe
    CGO_ENABLED=1 go build -tags "fts5" -o ~/.local/bin/mainframe-mcp ./cmd/mainframe-mcp
  2. PostgreSQL with mainframe database:

    cd /path/to/mainframe/mainframe
    docker compose -f local-dev.yml up -d mainframe-postgres
  3. Rust with WASM target:

    rustup target add wasm32-wasip1

Installation

As Dev Extension

  1. Open Zed
  2. Cmd+Shift+P"zed: Install Dev Extension"
  3. Select this directory

Build from Source

make build
# or: cargo build --release --target wasm32-wasip1

Configuration

The extension uses built-in defaults but can be overridden via ~/.config/zed/settings.json:

{
  "context_servers": {
    "mainframe": {
      "command": {
        "path": "/custom/path/to/mainframe-mcp",
        "args": ["--postgres-only", "--postgres", "postgres://user:pass@host:5432/db"]
      }
    }
  }
}

Defaults

Setting Default Value
Binary /Users/dust/.local/bin/mainframe-mcp
Args --postgres-only --postgres postgres://mainframe:mainframe-local@localhost:5432/mainframe?sslmode=disable

Usage

  1. Open a project in Zed
  2. Open Agent Panel (Cmd+Shift+A)
  3. Check Settings → Context Servers → mainframe shows green
  4. Ask the agent: "Use mainframe to get graph stats"

Makefile Helpers

make doctor      # Health check (toolchain, binary, postgres, extension)
make logs        # Tail Zed logs filtered for mainframe/MCP
make logs-errors # Show recent errors only
make test-mcp    # Test MCP server initialization
make build       # Build WASM extension
make clean       # Clean build artifacts

Troubleshooting

Run diagnostics first

make doctor

Extension not loading

  • Check Zed logs: make logs-errors
  • Verify binary: ls -la ~/.local/bin/mainframe-mcp

Context server timeout (60s)

Common causes:

  • Binary path incorrect (check make doctor)
  • PostgreSQL not running
  • Binary outputting to stdout instead of stderr

Test directly:

make test-mcp

Extension not updating after code changes

WASM may be stale. Force rebuild in Zed:

  • Cmd+Shift+P"zed: Rebuild Extension" → select mainframe

WASM Sandbox Limitations

Extensions run in a sandboxed WASM environment where std::env::var() does NOT work. The extension uses hardcoded defaults with settings.json override pattern.

Development

# Build
make build

# Watch logs while testing
make logs

# Check health
make doctor

Extension Structure

zed-mainframe/
├── src/lib.rs         # Extension code
├── Cargo.toml         # Rust dependencies
├── extension.toml     # Zed extension manifest
├── Makefile           # Helper commands
├── skills/            # Bundled Claude skills
│   └── zed-ninja/     # Zed editor expertise
└── README.md

License

MIT

About

Zed extension for mainframe knowledge graph MCP server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •