Skip to main content
Glama
Glean Connector MCP Server

Glean Connector MCP Server

by gleanwork

@gleanwork/connector-mcp

Experimental npm version CI License: MIT

An MCP server for AI-assisted Glean connector development. Add it to your IDE's MCP config and use Claude Code, Cursor, or any MCP-compatible AI assistant to scaffold, schema-map, generate, and test Glean connectors — without leaving your editor.

Prerequisites

  • Node.js ≥ 20

  • Python + uv (for run_connector and Copier scaffolding)

  • A Glean API token

Related MCP server: Glean MCP Server

Setup

Claude Code

Add to .claude/mcp.json in your project (or ~/.claude/mcp.json globally):

{
  "mcpServers": {
    "local": {
      "command": "npx",
      "args": [
        "-y",
        "@gleanwork/connector-mcp"
      ],
      "type": "stdio"
    }
  }
}

For setup instructions for Cursor, VS Code, Windsurf, Goose, Codex, JetBrains, Gemini CLI, OpenCode, and more, see docs/setup.md.

Environment Variables

These are set in the MCP server config, not in your connector project.

Variable

Required

Description

GLEAN_PROJECT_PATH

No

Default project directory; overridden by create_connector

GLEAN_CONNECTOR_TEMPLATE_PATH

No

Path to a custom Copier template (defaults to copier-glean-connector in workspace)

GLEAN_WORKER_COMMAND

No

Command to start the Python worker (default: uv run python -m glean.indexing.worker)

GLEAN_WORKER_REQUEST_TIMEOUT

No

Max seconds to wait for a worker JSON-RPC response (default: 30)

GLEAN_WORKER_SHUTDOWN_TIMEOUT

No

Seconds to wait for graceful worker shutdown before SIGKILL (default: 5)

GLEAN_INSTANCE and GLEAN_API_TOKEN belong in your connector project's .env file — create_connector generates a .env.example to get you started.

Quick Start

In your AI assistant, try:

"I want to build a Glean connector for our Salesforce Opportunities data. The API uses OAuth2 bearer tokens and returns paginated JSON. Let's start."

Or call get_started — the assistant will ask what you're connecting and walk you through the rest.

Core Workflow

Six steps from zero to a running connector. The assistant guides you through each one.

Step

What you're doing

Tool

0

Verify prerequisites

check_prerequisites

1

Scaffold the project

create_connector

2

Configure the data source

set_config

3

Define the schema (infer from a sample file or write it)

infer_schema + update_schema

4

Map fields and verify required Glean fields are covered

confirm_mappings + validate_mappings

5

Generate the Python connector code

build_connector

5a

Implement real API calls in data_client.py

get_data_client + update_data_client

6

Run the connector and inspect results

run_connector + inspect_execution

Tool Reference

Project Setup

Tool

Description

get_started

Open the guided workflow; the assistant asks what you're connecting

check_prerequisites

Verify uv, python, mise, copier, and Glean credentials are all configured

create_connector

Scaffold a new connector project and set the active session path

list_connectors

List all connector classes found in the project with their DataClient status

set_config

Write connector config (auth, endpoint, pagination) to .glean/config.json

get_config

Read .glean/config.json

Schema

Tool

Description

infer_schema

Parse a .csv, .json, or .ndjson file and return field analysis

get_schema

Read current .glean/schema.json

update_schema

Write field definitions to .glean/schema.json

analyze_field

Deep-dive on a single field: samples, type, Glean mapping suggestions

Field Mapping

Tool

Description

get_mappings

Show source schema and Glean entity model side-by-side

confirm_mappings

Save field mapping decisions to .glean/mappings.json

validate_mappings

Check mappings for missing required Glean fields

Data Client

Tool

Description

get_data_client

Read data_client.py and connector config — use before asking AI to write real API calls

update_data_client

Write a new data_client.py implementation (replaces the mock with real API calls)

Build & Run

Tool

Description

build_connector

Generate src/{module}/connector.py, models.py, mock_data.json from schema+mappings+config

run_connector

Start async connector execution; returns execution_id immediately

inspect_execution

Poll execution status; returns records, validation issues, logs

manage_recording

Record/replay/list/delete connector data recordings

Project Layout

After create_connector, your project directory looks like:

my-connector/
├── src/
│   └── {module_name}/
│       ├── connector.py    ← generated by build_connector
│       ├── models.py       ← generated TypedDict for source data
│       └── mock_data.json  ← sample data for local testing
├── CLAUDE.md           ← workflow guidance (for Claude Code users)
└── .glean/
    ├── schema.json     ← field schema
    ├── mappings.json   ← field mappings to Glean entity model
    ├── config.json     ← connector configuration
    ├── executions/     ← execution results (written on completion)
    └── recordings/     ← captured API responses for replay

MCP Resource

The server exposes a connector://workflow resource that returns the full authoring guide. Your AI assistant can fetch it at session start for workflow context.

Known Limitations

  • Single project per MCP session. The server tracks one active project at a time. To switch projects, set GLEAN_PROJECT_PATH in the MCP server config or restart the server after running create_connector for the new project.

  • Execution state is in-memory. Active execution history is lost when the MCP server restarts. Completed execution results written to .glean/executions/ persist on disk, but any in-progress executions must be re-run.

Troubleshooting

spawn uv ENOENT

uv is not installed or is not on your PATH. The server requires uv to scaffold connector projects and to run the Python worker.

Install it following the official uv instructions, then verify:

uv --version

If uv is installed but not on the PATH seen by your IDE, add it explicitly in the MCP server env config or set GLEAN_WORKER_COMMAND to the full path of an alternative command.

Copier template not found

The server could not locate the copier-glean-connector template. By default it looks for the template alongside this package in the Glean workspace or clones it from github.com/gleanwork over SSH.

Set the GLEAN_CONNECTOR_TEMPLATE_PATH environment variable to the absolute path of a local checkout of the template:

{
  "env": {
    "GLEAN_CONNECTOR_TEMPLATE_PATH": "/path/to/copier-glean-connector"
  }
}

Worker exited / glean.indexing.worker module not found

The Python worker process exited immediately. This usually means one of:

  1. You are not inside a Copier-scaffolded connector project. The run_connector tool must be called after create_connector has set up the project directory with the correct pyproject.toml and dependencies.

  2. The glean-indexing-sdk is not installed in the project's virtual environment. Run uv sync inside the connector project directory to install dependencies.

  3. Wrong working directory. Ensure GLEAN_PROJECT_PATH points to the connector project root, or run create_connector first to set the active session path automatically.

Available Tools

19 tools
analyze_fieldB

Deep-dive on a single field from the current schema: samples, type details, and Glean mapping suggestions.

Inputs: field_name (required).

build_connectorA

Generate Python connector files from schema + mappings + config. Use dry_run: true to preview the generated code without writing files.

Inputs: dry_run, connector_name, datasource_type.

check_prerequisitesB

Check that all required tools and credentials are installed and configured.

Inputs: no named parameters.

confirm_mappingsA

Save field mapping decisions to .glean/mappings.json. Merges with any existing mappings.

Inputs: mappings (required).

create_connectorA

Scaffold a new Glean connector project using the standard template. Call this after get_started. Sets the active project directory for this session.

Inputs: name (required), description, datasource_type, parent_directory, +1 more.

get_configA

Read the current connector configuration from .glean/config.json.

Inputs: no named parameters.

get_data_clientA

Read data_client.py for a module — use before asking AI to implement real API calls.

Inputs: module_name (required).

get_mappingsA

Return the current source schema alongside the Glean entity model so you can decide which source field maps to which Glean field.

Inputs: no named parameters.

get_schemaA

Read the current field schema from .glean/schema.json.

Inputs: no named parameters.

get_startedA

Entry point for building a Glean connector. Returns an opening prompt that orients the AI and asks the user what data source they want to connect. Call this before any other tool.

Inputs: no named parameters.

infer_schemaA

Parse a data file (.csv, .json, .ndjson) and return field analysis: detected types, null rates, cardinality, and sample values. Use this to understand the source data before defining mappings.

Inputs: file_path (required), save.

inspect_executionA

Check execution status and retrieve records. Returns status, records fetched, per-record validation results, and recent logs.

Inputs: execution_id (required), limit, offset.

list_connectorsA

List all connector classes found in this project with their module paths.

Inputs: no named parameters.

manage_recordingB

Manage connector recordings. action: "record" saves fetched data, "replay" runs from a saved file, "list" shows available recordings, "delete" removes one.

Inputs: no named parameters.

run_connectorA

Start async execution of the Python connector. Returns an execution_id immediately. Poll status with inspect_execution.

Inputs: recording_id, connector_name.

set_configA

Write connector configuration to .glean/config.json. Merges with existing config. Code-generation keys (consumed by build_connector): name, display_name, datasource_category, url_regex, icon_url, connector_type. Runtime-only keys (used by the connector at execution time, not during code generation): auth_type, endpoint, api_key_header, page_size, rate_limit_rps.

Inputs: config (required).

update_data_clientC

Write a new data_client.py implementation (replaces the mock with real API calls).

Inputs: code (required), module_name (required).

update_schemaA

Write field definitions to .glean/schema.json. Call this after infer_schema to save the agreed schema, or to make manual edits. Set merge: true to merge incoming fields with the existing schema (fields with the same name are replaced; new names are appended) instead of replacing the entire field list.

Inputs: fields (required), merge.

validate_mappingsA

Check current mappings against Glean's entity model. Reports missing required fields and type mismatches.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

    TDQS

    A3.9/5.0

    Scored across 19 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose, covering different aspects of connector development: scaffolding, schema inference, mapping, configuration, building, execution, and monitoring. No two tools appear to do the same thing.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern in snake_case (e.g., get_schema, create_connector, infer_schema). The only slight deviation is get_started, but it still follows a verb-like prefix, maintaining overall consistency.

    Tool Count5/5

    With 19 tools, the count is appropriate for the complex domain of building a Glean connector. Each tool fulfills a specific need without being overwhelming or sparse.

    Completeness5/5

    The tool surface covers the full lifecycle: from starting a project (get_started, create_connector) through schema inference, mapping, configuration, code generation, execution, and monitoring. Obvious gaps (e.g., testing) are minimal and likely covered by inspect_execution and manage_recording.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that integrates the Glean API to provide search results and chatbot interaction.
      10
      MIT
    • A
      license
      B
      quality
      F
      maintenance
      A Model Context Protocol server that provides AI assistants with access to Glean's enterprise knowledge features, including content search, people directory, and AI chat capabilities.
      3
      8 npm
      62
      MIT
    • -
      license
      Not graded
      quality
      Not graded
      maintenance
      An MCP server that enables developers to summon AI development team agents directly from their IDE to help with tasks like PR reviews, security evaluation, and CI/CD deployment setup.
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      A production-ready MCP server that enables AI assistants to intelligently understand, analyze, edit, navigate, and review software projects with multi-workspace support, Git integration, and semantic search.
      1
      MIT