Skip to main content
Glama

specir-mcp

English | 简体中文

specir-mcp is a data-neutral framework for turning technical documents into a structured intermediate representation (SpecIR) and querying it through six stable MCP tools.

The repository contains no standards PDFs, extracted specification text, knowledge-base databases, model weights, or vendor-specific protocol tables. All bundled demo content is fictional.

Features

  • Document, section, table, figure, entity, passage, provenance, and edge IR.

  • Extensible domain plugin manifests with dependency-aware loading.

  • PDF outline-based section extraction and reusable structure parsers.

  • Multi-engine PDF table candidates with deterministic arbitration, geometry, non-table rejection, cross-page matching, and auditable review decisions.

  • SQLite-backed exact lookup, fetch, explanation, search, and status APIs.

  • A six-tool FastMCP surface: specir_resolve, specir_fetch, specir_explain, specir_search, specir_status, and specir_validate.

  • Product-ranked related_entities plus evidence-complete xrefs_raw.

  • Data-neutral typed edges for definitions, listings, field membership, and named status mentions.

  • Explicit coverage metadata so missing extraction is not confused with absence from a source document.

Related MCP server: literature-agent-mcp

Quick start

python -m venv .venv
. .venv/bin/activate
pip install -e ".[test]"

# Generate a small database from the fictional Acme Device Interface fixture.
specir-demo --output data/demo.db

export SPEC_IR_DB="$PWD/data/demo.db"
specir-mcp-server

The same server may be launched from a source checkout:

fastmcp run src/specir/query/server.py

Example MCP calls:

specir_resolve(kind="command", id="A1h", spec="acme-device")
specir_fetch(uid="acme-device:2.1", include_xrefs=true,
             xref_profile="test_points")
specir_explain(name="Read Telemetry", kind="command", spec="acme-device")
specir_search(query="telemetry", spec="acme-device")
specir_status()
specir_validate(mode="summary")

test_points is the default fetch profile: weak or boilerplate edges remain auditable under xrefs_raw.suppressed_references but do not enter the ranked related_entities list. Request xref_profile="generic" for an unfiltered debug view.

When a database contains one document, spec="auto" selects it. With multiple documents, exact lookups return candidates and request an explicit spec.

Using your own data

Create a database with specir.query.schema.create_database, then insert documents and entities using the schema documented by the Python dataclasses. Set SPEC_IR_DB to that database before starting the server. The framework never downloads or bundles source documents.

The optional PDF extractor can build coordinate-clipped section records:

from specir.extractors.pdf import build_section_tree

sections = build_section_tree("my-spec", "path/to/your-document.pdf")

You are responsible for having permission to process and store the documents you supply.

Optional table extraction

Install only the engines you need. PyMuPDF is included in the core package; the other engines are optional and unavailable engines are skipped safely.

pip install -e ".[tables]"          # pdfplumber
pip install -e ".[table-camelot]"  # Camelot; may need system libraries
pip install -e ".[table-docling]"  # neural candidate adapter
from specir.extractors import arbitrate_candidates, generate_candidates

candidates = generate_candidates(
    "path/to/your-document.pdf",
    pages=[10, 11],
    engines=("pymupdf", "pdfplumber"),
)
results = arbitrate_candidates(candidates)

Every candidate retains its engine, strategy, bounding box, cell geometry, quality metrics, and deterministic ID. Arbitration never treats the first engine result as authoritative. It reports TRUSTED_AUTOMATIC, NEEDS_REVIEW, CONFLICTING_CANDIDATES, or REJECTED_NON_TABLE and preserves alternatives as evidence.

table_continuations.assess_continuation scores adjacent-page fragments and keeps disagreements in a review state. recover_outer_fragment repairs nested fragments only when the smallest enclosing candidate passes semantic, geometric, caption-boundary, and unrelated-table checks. Neural extraction is configured with explicit DoclingTableProfile values; no document names or vendor rules are built into the framework.

Use build_review_queue and apply_review_decisions to bind a human decision to the exact candidate state. Stale decisions, duplicate decisions, and unknown replacement candidates fail closed.

Development

pytest
python -m build

The tests create temporary synthetic databases and do not require external specifications or network access.

License

Apache License 2.0. See LICENSE.

Available Tools

5 tools
specir_explainD

Combine a named entity with its defining section.

ParametersJSON Schema
NameRequiredDescriptionDefault
kindNocommand
nameYes
specNoauto

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

D1.7/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must disclose behavior, but it only states a vague operation. It does not mention whether the operation is read-only, what output to expect, or any side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single short sentence, which is concise, but it is under-specified and lacks front-loaded informative content. It uses words vaguely without explaining the tool's behavior.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has 3 parameters and no annotations, and the description does not cover the semantics of parameters or the output format. It is inadequate for an agent to understand when and how to invoke the tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has no descriptions, and the description only maps 'named entity' to 'name' and 'defining section' to 'spec' implicitly. It does not clarify the meaning of 'kind' or the defaults for 'kind' and 'spec'.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description says 'Combine a named entity with its defining section,' but does not use the verb 'explain' and fails to specify what the tool actually produces. This is vague and does not distinguish from sibling tools like specir_fetch or specir_search.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is given on when to use this tool versus alternatives such as specir_resolve or specir_status. There is no mention of use cases, prerequisites, or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

specir_fetchB

Fetch an entity by canonical UID, optionally with graph edges.

ParametersJSON Schema
NameRequiredDescriptionDefault
uidYes
include_xrefsNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full transparency burden. It only says 'Fetch' (a read-like verb) and mentions output aspects like graph edges, but does not disclose behavior such as error handling, authentication requirements, rate limits, or any potential side effects. The minimal detail goes little beyond the action itself.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, focused sentence: 'Fetch an entity by canonical UID, optionally with graph edges.' Every word contributes to conveying the core purpose and key optional behavior. It is neither verbose nor under-specified in structure.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the presence of an output schema, return values are covered elsewhere. However, the description lacks usage guidance relative to siblings and leaves one parameter (include_xrefs) unexplained. It provides adequate context for the primary use case but has notable gaps for a complete understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description must compensate. It adds meaning to 'uid' as 'canonical UID', which is useful, but it does not explain 'include_xrefs'. The phrase 'graph edges' might loosely relate to xrefs, but the connection is not explicit, leaving the boolean parameter's semantics unclear.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Fetch an entity by canonical UID, optionally with graph edges' clearly states the action (fetch), the resource (entity), and the key distinction (by canonical UID, optional graph edges). It differentiates from siblings like specir_search (query-based) and specir_resolve (likely URL/id resolution) by emphasizing canonical UID fetch.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when you have a canonical UID, but it does not explicitly state when not to use it or mention alternatives among siblings. There is no direct comparison such as 'use specir_search instead when you lack a UID'. This is implied context rather than explicit guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

specir_resolveC

Resolve an exact domain entity, section, table, or figure.

ParametersJSON Schema
NameRequiredDescriptionDefault
idYes
kindYes
specNoauto

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full responsibility for disclosing behavior. It does not state whether the operation is read-only, what happens on lookup failure, whether it is idempotent, or any error behavior. The brief phrasing leaves too much implicit for a tool with no annotation safety net.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence that is easy to parse. It avoids fluff, though it may be too terse for the tool's complexity. Still, it earns high marks for conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has three parameters, zero schema descriptions, no annotations, and only a minimal description, it is inadequate. The output schema helps with return values, but parameter usage, edge cases, and selection criteria are missing, making this incomplete for an agent to reliably invoke.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the description adds almost no parameter detail. It mentions kinds of entities but does not explain the 'kind' and 'id' parameters or the 'spec' parameter's role. With three parameters and no schema descriptions, this is a critical gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific action ('Resolve') and the target resource types ('exact domain entity, section, table, or figure'). This gives a clear sense of the tool's purpose and distinguishes it somewhat from siblings like 'search' by emphasizing exactness, though 'resolve' vs 'fetch' remains ambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The word 'exact' implies this tool should be used when you have a precise identifier rather than when you need exploratory search, but it does not explicitly mention alternatives or conditions. There is no when-not guidance or reference to sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

specir_statusB

Report plugin state and database coverage.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description bears the burden of disclosing behavioral traits. 'Report plugin state and database coverage' implies a read-only operation but does not mention potential side effects, required permissions, or output format. It adds minimal context beyond the function name.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence, front-loaded with the verb 'Report' and the key resources. Every word contributes to the meaning, with no redundant or filler content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with no parameters and an existing output schema, the description is minimally adequate. However, 'plugin state' and 'database coverage' are vague phrases; giving examples of what these entail would improve completeness. The ambiguity may leave an agent unsure about the exact scope of the report.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, and the schema shows an empty object with 100% coverage, so there are no parameter semantics to explain. The baseline for 0 params is 4, and the description correctly avoids adding unnecessary parameter details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses the verb 'Report' and identifies the resources 'plugin state' and 'database coverage', clearly indicating the tool's purpose. It is distinct from sibling tools (resolve, fetch, explain, search) by focusing on status reporting, though it lacks explicit differentiation language.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like specir_resolve or specir_search. It simply states what the tool does, leaving the agent to infer appropriate use cases from the name and sibling context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

B3.1/5.0
Disambiguation4/5

Each tool has a distinct primary purpose: resolve by name, fetch by UID, explain with context, search broadly, and status for system info. Resolve and fetch are similar but differentiated by input type (name vs UID), while explain is a composite of entity and section.

Naming Consistency5/5

All tools follow a consistent specir_ prefix followed by a clear action verb (resolve, fetch, explain, search, status). The pattern is uniform and predictable, making it easy to infer tool behavior from name alone.

Tool Count5/5

Five tools is ideal for a focused specification entity retrieval service. Each tool covers a distinct interaction mode without redundancy, and the count is well within the typical range for a useful MCP server.

Completeness5/5

The tool set covers the core needs for querying a spec database: search, targeted retrieval by name or UID, contextual explanation, and system status. No obvious lifecycle operations are missing because the domain is read-only retrieval, and the provided methods form a complete workflow.

Maintenance

ActivityMaintained
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that enables AI agents to search, discover, and retrieve technical specifications from a SpecLib instance. It provides tools for full-text search, scope listing, and reading specs as markdown content.
  • F
    license
    C
    quality
    D
    maintenance
    Exposes a local biomedical literature pipeline as MCP tools for automated research workflows. Enables literature search, open-access paper retrieval, and draft generation for biomedical and pathology domains through standard MCP clients.
    6
  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol (MCP) server for Specifai project integration and automation with any MCP-compatible AI tool. This server currently exposes tools to read all documents generated by the Specifai project.
    19
    13
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    Vendor-neutral MCP server for knowledge retrieval across repositories, offering stable tools for searching, getting, and listing documents with hybrid lexical and optional semantic search.
    3
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jietianliang/specir-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server