mcp-server logo

mcp-server

by gleanwork

A Model Context Protocol (MCP) server implementation for Glean's search and chat capabilities. This server provides a standardized interface for AI models to interact with Glean's content search and conversational AI features.

View on GitHub

Last updated: N/A

@gleanwork/mcp-server

MCP Server

MCP Server

CI Build

CI Build

npm version

npm version

License

License

A Model Context Protocol (MCP) server implementation for Glean's search and chat capabilities. This server provides a standardized interface for AI models to interact with Glean's content search and conversational AI features.

Features

  • Search Integration: Access Glean's powerful content search capabilities
  • Chat Interface: Interact with Glean's AI assistant
  • MCP Compliant: Implements the Model Context Protocol specification

Tools

  • glean_search

    Search Glean's content index using the Glean Search API. This tool allows you to query Glean's content index with various filtering and configuration options.

    For complete parameter details, see Search API Documentation

  • glean_chat

    Interact with Glean's AI assistant using the Glean Chat API. This tool allows you to have conversational interactions with Glean's AI, including support for message history, citations, and various configuration options.

    For complete parameter details, see Chat API Documentation

Configuration

API Tokens

You'll need Glean API credentials, and specifically a user-scoped API token. API Tokens require the following scopes: chat, search. You should speak to your Glean administrator to provision these tokens.

Configure Environment Variables

  1. Set up your Glean API credentials:

    export GLEAN_SUBDOMAIN=your_subdomain
    export GLEAN_API_TOKEN=your_api_token
    
  2. (Optional) For global tokens that support impersonation:

    export [email protected]
    

Client Configuration

You can use the built-in configuration tool to automatically set up Glean for your MCP client:

# Configure for Cursor
npx @gleanwork/mcp-server configure --client cursor --token your_api_token --domain your_subdomain

# Configure for Claude Desktop
npx @gleanwork/mcp-server configure --client claude --token your_api_token --domain your_subdomain

# Configure for Windsurf
npx @gleanwork/mcp-server configure --client windsurf --token your_api_token --domain your_subdomain

Alternatively, you can use an environment file:

npx @gleanwork/mcp-server configure --client cursor --env path/to/.env.glean

The environment file should contain:

GLEAN_SUBDOMAIN=your_subdomain
GLEAN_API_TOKEN=your_api_token

After configuration:

  • For Cursor: Restart Cursor and the agent will have access to Glean tools
  • For Claude Desktop: Restart Claude and use the hammer icon to access Glean tools
  • For Windsurf: Open Settings > Advanced Settings, scroll to Cascade section, and press refresh

MCP Client Configuration

To configure this MCP server in your MCP client (such as Claude Desktop, Windsurf, Cursor, etc.), add the following configuration to your MCP client settings:

{
  "mcpServers": {
    "glean": {
      "command": "npx",
      "args": ["-y", "@gleanwork/mcp-server"],
      "env": {
        "GLEAN_SUBDOMAIN": "<glean instance subdomain>",
        "GLEAN_API_TOKEN": "<glean api token>"
      }
    }
  }
}

Replace the environment variable values with your actual Glean credentials.

Debugging

Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the MCP Inspector, which is available as a package script:

npm run inspector

The Inspector will provide a URL to access debugging tools in your browser.

Contributing

Please see CONTRIBUTING.md for development setup and guidelines.

License

MIT License - see the LICENSE file for details

Support