Skip to main content

MCP server exposing GLiNER2 entity extraction, classification, and JSON parsing.

Project description

gliner2-mcp

MCP server that exposes GLiNER2 entity extraction, classification, and JSON extraction as tools.

Quickstart

  1. Install dependencies:
uv sync
  1. Run the MCP server:
uv run gliner2-mcp

Environment configuration

This server is configured via environment variables (optionally loaded from .env).

Variable Default Description
GLINER2_MODEL_ID fastino/gliner2-base-v1 GLiNER2 model id or path.
GLINER2_DEVICE empty Device override passed to from_pretrained when supported.
GLINER2_MAX_TEXT_LENGTH 0 Maximum input length. 0 disables the limit.
GLINER2_MCP_LOG_LEVEL INFO Log level for server logging.
GLINER2_MCP_ENV_FILE empty Path to an env file to load before reading the variables above.

If GLINER2_MCP_ENV_FILE is not set, the server will load .env from the working directory when it exists.

MCP tools

  • extractEntities(text, labels) returns a mapping of label to entity spans.
  • classifyText(text, schema) returns a mapping of field name to chosen label or list of labels.
  • extractJson(text, schema) returns a JSON object that matches the provided schema.

Available Models

GLiNER2 family models on Hugging Face

Development

uv sync --dev
uv run ruff check .

Testing

Run the default test suite (unit + contract tests):

uv sync --extra dev
uv run --extra dev pytest -q

Run real-model integration tests (downloads/loads actual GLiNER2 weights):

GLINER2_MCP_RUN_INTEGRATION=1 uv run --extra dev pytest -q -m integration

Recommended pre-release check:

uv run --extra dev pytest -q
GLINER2_MCP_RUN_INTEGRATION=1 uv run --extra dev pytest -q -m integration

License

MIT. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gliner2_mcp-0.1.0.tar.gz (98.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gliner2_mcp-0.1.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file gliner2_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: gliner2_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 98.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gliner2_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f78254b286b5866ca34920d9a7f6a033a05f238b64b4e404516208c056336655
MD5 794cd9141643523c8001dc78fc6ea691
BLAKE2b-256 e41126b9e9497cba7ad3539f742c2597d275402bbdd09fd7d469bdcd21d58edd

See more details on using hashes here.

File details

Details for the file gliner2_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gliner2_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gliner2_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e174052f3ff8081f2a711ce8e7eec2a79a3b36c80f16c95e6c72edaf5b02f662
MD5 ed6fa0ec0e7a9048fc27b9e8f677847c
BLAKE2b-256 0a655dd960a84c56ba4b2aa737c0bb58ee5ae9a860b1aae74a7962853ee93471

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page