Skip to main content
Glama

civicgraph-mcp

A money-in-politics knowledge graph, as an MCP server. It links entities across federal campaign donations, lobbying disclosures, and government contracts — so an agent can trace a name from a donor record, to a lobbying client, to a federal contract, and surface the "follow the money" / revolving-door connections nobody else exposes as a tool.

Why this exists

The raw sources each already have MCP servers — FEC (donations), Senate LDA (lobbying), USASpending (contracts). But they're islands. The valuable, hard, unbuilt part isn't the rows; it's the joins: resolving that the "John A. Smith" in an FEC filing, the lobbyist in an LDA report, and the contractor contact in USASpending are (or aren't) the same entity, and letting you walk those connections. That linkage — explainable entity resolution — is the product.

Related MCP server: nexus-mcp

Quick start (offline, no API keys)

The whole pipeline runs on committed sample data, so a fresh checkout works with no network and no keys.

uv sync                          # create the env, install deps

uv run civicgraph ingest         # load the oklahoma-2024 slice from samples
uv run civicgraph build          # build the single-source graph (24 nodes, 22 edges)
uv run civicgraph resolve        # cross-source entity resolution (8 merges -> 17 entities)

uv run civicgraph eval           # measure resolution quality (P/R/F1 on a labeled set)

Then query it:

# Find an entity
uv run civicgraph search "Heartland"
#   -> HEARTLAND DEFENSE SYSTEMS, INC.  sources: [fec, usaspending]

# Resolve a name to a canonical entity, with confidence + the features behind it
uv run civicgraph resolve-name "James Carter" --state OK --employer "Carter & Lowe LLP" --kind person

# Follow the money: a PAC -> a defense agency, through a donor who is also a contractor
PAC=$(uv run civicgraph search "Oklahoma Prosperity PAC" | jq -r '.results[0].entity_id')
ARMY=$(uv run civicgraph search "Department of the Army" | jq -r '.results[0].entity_id')
uv run civicgraph path "$PAC" "$ARMY"
#   OKLAHOMA PROSPERITY PAC  <-donated_to (FEC, $7,500)-  HEARTLAND DEFENSE SYSTEMS
#                            -contracted_with (USASpending, $4.2M)->  Department of the Army

Every edge carries its source record URL + date; every resolution carries a confidence score and the features that drove it.

Use it as an MCP server

uv run civicgraph serve          # speaks MCP over stdio

Register it with an MCP host (e.g. Claude Desktop). Populate the store once (ingest / build / resolve), then point the host at the repo:

{
  "mcpServers": {
    "civicgraph": {
      "command": "uv",
      "args": ["run", "civicgraph", "serve"],
      "cwd": "/path/to/civicgraph-mcp"
    }
  }
}

Tools

Tool

What it does

resolve_entity(name, state?, employer?, kind?)

Fuzzy-match a name/org to a canonical entity, with confidence, the matching features, and runner-up alternatives.

entity_profile(entity_id)

Everything we know: donations, lobbying roles, contracts, aliases, sources — edges summarized by type, each with provenance.

connections(entity_id, hops=1, types?)

Neighbors in the graph, optionally filtered to specific edge types.

path_between(entity_a, entity_b, max_hops=4)

Shortest sourced path between two entities — how they're connected.

search(query, limit=10)

Full-text search across entity names and aliases.

(ping, graph_stats are also exposed.)

Live data

The offline demo uses synthetic samples. To ingest real federal data for the slice, get free keys (FEC, Senate LDA; USASpending needs none), copy .env.example to .env, fill them in, and:

uv run civicgraph ingest --live
uv run civicgraph build && uv run civicgraph resolve

FEC's 1,000 req/hr limit is respected via on-disk caching + backoff; raw snapshots are written under data/raw/ before normalization so runs are auditable.

How it works

FEC ─┐
LDA ─┼─▶ adapters (snapshot → normalize) ─▶ staging ─▶ graph (raw nodes + edges)
USAspending ─┘                                              │
                                       entity resolution (block → score → merge)
                                                            │
                              DuckDB store ◀── canonical entities + node_map
                                                            │
                                        FastMCP server / civicgraph CLI
  • Bounded slice. v1 is Oklahoma, 2024 cycle — see docs/slice.md. Scope discipline is a feature: a correct, explainable small graph first.

  • Explainable resolution. A strong name match alone never merges; identity needs corroboration (shared employer/firm, state, zip), and conflicting evidence is penalized. Auto-merge above a high threshold, surface a candidate in the middle band, never link below. See docs/resolution-eval.md for the measured precision/recall.

  • Non-destructive. Edges reference raw nodes; resolution only repoints a node_map, so it's re-runnable and merges are never destructive.

Development

uv run pytest        # full offline suite
uv run ruff check .  # lint

If uv run civicgraph ... ever reports No module named 'civicgraph' (a known editable-install quirk on some setups, e.g. project paths containing spaces), run with PYTHONPATH=src uv run civicgraph ... — the test suite is unaffected.

See SPEC.md, BUILD_PLAN.md, and CLAUDE.md for the design.

License

MIT.

Available Tools

7 tools
connectionsB

Neighboring entities within hops, optionally filtered to edge types (donated_to, lobbied_for, contracted_with, employed_by, affiliated_with).

ParametersJSON Schema
NameRequiredDescriptionDefault
entity_idYes
hopsNo
typesNo

TDQS

B3.3/5.0
Behavior3/5

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

With no annotations, the description must disclose behavior. It reveals hop distance and filtering by types, but does not specify whether all neighbors are returned at once, ordering, or performance characteristics. The behavior is partially transparent but not fully detailed.

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?

A single, concise sentence of 19 words that efficiently conveys the core functionality. No unnecessary words, and the main action is front-loaded.

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 tool has 3 parameters and no output schema or annotations, the description provides a reasonable overview but lacks details on output and parameter descriptions for entity_id. It is somewhat incomplete for a graph traversal 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?

Schema coverage is 0%, so the description must explain parameters. It explains 'hops' and 'types' (listing allowed values), but does not describe 'entity_id' at all. The explanation of 'types' is basic and doesn't clarify array format.

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 clearly indicates the tool retrieves neighboring entities within a given number of hops, optionally filtered by edge types. However, it does not explicitly state the output format or use a strong verb like 'get' or 'retrieve'.

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 for exploring connections, but provides no explicit guidance on when to use this tool versus siblings like path_between or entity_profile. No exclusion criteria or alternatives are mentioned.

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

entity_profileA

Everything we know about an entity: aliases, sources, and its edges (donations, lobbying, contracts) summarized by type, each with provenance.

ParametersJSON Schema
NameRequiredDescriptionDefault
entity_idYes

TDQS

A3.5/5.0
Behavior2/5

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

No annotations provided, so the description must carry the behavioral disclosure burden. It does not mention whether the operation is read-only, if it requires special permissions, or any performance implications. The focus is on content, not behavior.

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?

A single, well-structured sentence that front-loads the purpose ('Everything we know about an entity') and follows with specific contents. No wasted words.

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?

The description outlines the tool's output (aliases, sources, edges) but lacks specifics on return format, pagination, or limits. Without an output schema, more details would help, though the summary is adequate for basic use.

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

Parameters3/5

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

The only parameter 'entity_id' is not described in the tool description. With 0% schema description coverage, the description should compensate but it does not. However, the parameter name and required nature make its purpose somewhat clear, meriting a score of 3.

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 clearly states it provides 'everything we know about an entity' including aliases, sources, and edges summarized by type with provenance. This is a specific verb-resource combination that distinguishes it from siblings like 'connections' or 'resolve_entity'.

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?

Implied usage: use when you need a comprehensive profile of an entity. However, it does not explicitly state when not to use it or provide comparisons to sibling tools, leaving some ambiguity.

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

graph_statsA

Row counts for the current graph store (nodes, edges, entities, ...).

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.7/5.0
Behavior3/5

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

Without annotations, the description implies a read-only operation ('Row counts'). However, it does not disclose potential performance impact, whether counts are cached, or if any side effects exist. The description is minimal but adequate for a simple stat tool.

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 that efficiently communicates the tool's purpose. No extraneous information or repetition.

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?

The description does not specify the output format or structure (e.g., JSON object with keys). Given no output schema, a more detailed explanation of the return value would enhance completeness. Current description is functional but leaves ambiguity.

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?

No parameters exist, and the input schema is empty. The description adds no extra meaning since there are no parameters. Baseline 4 applies due to zero parameters and full schema coverage.

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 clearly states the tool provides row counts for the graph store, listing specific categories (nodes, edges, entities). It distinguishes from sibling tools which perform different operations like path finding or entity resolution.

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 on when to use this tool versus its siblings. The description lacks context on use cases, prerequisites, or scenarios where alternatives like 'connections' or 'entity_profile' are more appropriate.

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

path_betweenB

Shortest sourced path between two entities — how the money/influence connects them across donations, lobbying, and contracts.

ParametersJSON Schema
NameRequiredDescriptionDefault
entity_aYes
entity_bYes
max_hopsNo

TDQS

B3.1/5.0
Behavior2/5

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

No annotations provided, so description bears full burden. Only states 'shortest sourced path' without disclosing behavior like cost, limits, or whether it's read-only. Lacks important context for agent decision-making.

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?

Single sentence that is front-loaded with verb and core purpose. No wasted words; every part adds value.

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 no output schema and no annotations, the description is incomplete. It lacks parameter explanations, output format, and any constraints or nuances (e.g., what 'sourced' means, types of connections). Minimal context for a tool with 3 parameters.

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 description adds no explanation for any of the 3 parameters (entity_a, entity_b, max_hops). The default for max_hops (4) is not explained. Agent receives no help understanding parameter semantics.

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?

Description clearly states verb (finds), resource (shortest sourced path between two entities), and scope (money/influence connections). Distinguishes from siblings like 'entity_profile' which focuses on a single entity.

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?

Implies usage for finding shortest path in network, but no explicit guidance on when to use this vs siblings like 'connections' or 'graph_stats'. No contraindications provided.

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

pingA

Health check. Returns 'pong' if the server is alive.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations, the description carries full burden. It accurately discloses the return value ('pong' if alive) and implies a non-destructive, read-only operation. No side effects are mentioned, but the behavior is straightforward and transparent.

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, efficient sentence with no superfluous words. It front-loads the key purpose ('Health check.') and immediately follows with the expected output.

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

Completeness5/5

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

Given the tool's simplicity, zero parameters, and presence of an output schema (which covers return values), the description is fully sufficient. No additional context is needed.

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?

No parameters exist; schema coverage is 100%. The description adds no additional parameter meaning, but this is appropriate as there are none to describe. Baseline scoring for zero parameters is satisfied.

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 clearly identifies the tool as a health check that returns 'pong' if the server is alive. It uses a specific verb ('Health check') and resource (server status), and easily distinguishes from sibling tools like 'connections' or 'search'.

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

Usage Guidelines4/5

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

The description implicitly indicates use for verifying server liveness but does not explicitly state when to prefer ping over alternatives. Given the context of simple health checks, the purpose is clear, but no alternatives or exclusions are mentioned.

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

resolve_entityA

Resolve a name/organization to a canonical entity.

Optional hints (state, employer, kind) disambiguate. Returns the best match with a confidence score, the features that drove it, and runner-up alternatives — never a silent merge.

ParametersJSON Schema
NameRequiredDescriptionDefault
nameYes
stateNo
employerNo
kindNo

TDQS

A3.9/5.0
Behavior4/5

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

With no annotations, the description discloses key behaviors: returns best match with confidence score, driving features, runner-up alternatives, and promises no silent merge. This is transparent for a read-like resolution tool, though no side-effect details are needed.

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?

Two sentences, front-loaded with the core action. Every part adds value: the verb, resource, hint role, and return structure. No fluff.

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

Completeness4/5

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

For a resolution tool with 4 parameters and no output schema, the description covers purpose, parameter roles, and return structure (confidence, features, alternatives). Lacks error handling or edge cases, but overall adequate.

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?

Schema coverage is 0%. The description mentions optional hints (state, employer, kind) disambiguate but provides no constraints, valid values, or examples. The 'name' parameter gets minimal context. This adds little beyond parameter names.

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 uses a specific verb 'Resolve' and resource 'name/organization to a canonical entity', making the tool's purpose clear. It distinguishes from siblings like search and entity_profile by focusing on disambiguation to a canonical entity.

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 use when disambiguating a name to a known entity via optional hints, but does not explicitly state when to use or avoid this tool compared to siblings like entity_profile or search. No when-not or alternative references.

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

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 7 tool updatesv0.1.0
    • First observedconnections
    • First observedentity_profile
    • First observedgraph_stats
    • First observedpath_between
    • First observedping
    • First observedresolve_entity
    • First observedsearch

TDQS

A3.9/5.0
Disambiguation5/5

Each tool targets a distinct operation on the graph: querying connections, entity details, paths, stats, health, resolution, and search. No overlapping purposes.

Naming Consistency5/5

All tool names follow a consistent lower_snake_case pattern (e.g., entity_profile, resolve_entity, path_between). No mixing of styles.

Tool Count5/5

Seven tools is appropriate for a graph querying server, covering search, resolution, profiling, connection traversal, path finding, stats, and health checks without being excessive.

Completeness4/5

The tool set covers core graph exploration needs, but lacks direct listing of all entities or raw edge retrieval. Minor gaps, but main workflows are supported.

Maintenance

ActivityStale
ResponsivenessNo issues

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

  • A
    license
    A
    quality
    B
    maintenance
    MCP server providing access to U.S. government primary-source records, fact-checks, news search, and trackers, with cross-referenced entity data and source links.
    4
    66
    MIT
  • F
    license
    Not graded
    quality
    B
    maintenance
    An MCP server that searches official FEC PDF rulebooks for compliance and contribution limits, and provides real-time lookups against the OpenFEC API for candidates, committees, filings, and financial data.
    -
  • A
    license
    Not graded
    quality
    A
    maintenance
    An MCP server that gives investment teams an entity-resolved knowledge graph of people and organizations, enabling graph-based retrieval like warm introductions and relationship analysis from scattered data sources.
    1
    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/cstillick/civicgraph-mcp'

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