Skip to main content
Glama
field-service-mcp

field-service-mcp

field-service-mcp

Agents that help run a service business need to read and write the system the business actually lives in: customers, jobs, visits, quotes and the schedule. Every field service product has a different API, so tool code written against one vendor is thrown away when the vendor changes.

This is an MCP server that exposes those operations as tools, built on a vendor adapter interface, with a bundled mock vendor API so the whole thing runs offline.

What it does

  • 15 MCP tools over the official MCP Python SDK (version 2, MCPServer), with typed inputs and structured outputs:

    Area

    Read

    Write

    Customers

    list_customers, get_customer

    create_customer

    Jobs

    list_jobs, get_job

    create_job

    Visits

    list_visits

    create_visit

    Quotes

    list_quotes, get_quote

    create_quote

    Schedule

    list_technicians, get_schedule, find_open_slots

    Meta

    server_info

  • An adapter interface (FieldServiceAdapter). The tools only know vendor-neutral models. One class per vendor does the translation.

  • A mock vendor REST API (FastAPI, seeded with invented data) that deliberately speaks a different dialect: clients, work orders, appointments and estimates, camelCase keys, money in cents, page-number paging, an API key header, and business rule errors such as double booking. The mock adapter therefore does the same translation work a real one would.

  • Schedule lookups computed above the adapter. get_schedule and find_open_slots are derived from calls every adapter already has, so a new vendor gets them without extra code.

  • Errors an agent can act on. Vendor failures are sorted into not found, invalid request, conflict, auth and upstream, and each reaches the model as a tool error that says what happened and whether retrying can help.

  • Guard rails for writes. FSM_READ_ONLY=true removes the create tools entirely. Reads are retried on transient failures. Writes are never retried, because a repeated POST can create a duplicate job.

Related MCP server: mcp-erp-bridge

Architecture

flowchart LR
    agent["Agent / MCP client"] -- "stdio or streamable HTTP" --> server

    subgraph pkg["field_service_mcp"]
        server["server.py<br/>MCPServer, 15 tools,<br/>error translation"]
        schedule["schedule.py<br/>schedule view,<br/>open slot search"]
        iface{{"FieldServiceAdapter<br/>adapters/base.py"}}
        mockad["MockRestAdapter<br/>adapters/mock_rest.py"]
        yours["Your vendor adapter<br/>(see docs)"]
        server --> schedule
        server --> iface
        schedule --> iface
        iface -.-> mockad
        iface -.-> yours
    end

    mockad -- "httpx, in process (ASGI)<br/>or real HTTP" --> mockapi["Mock vendor API<br/>FastAPI, seeded fake data"]
    yours -- "HTTPS" --> vendor["Real vendor API"]

Source layout:

src/field_service_mcp/
  server.py            MCP tools and the entry point
  schedule.py          schedule and open slot logic, adapter independent
  models.py            vendor-neutral domain models (pydantic)
  errors.py            adapter error taxonomy
  config.py            settings from environment variables
  adapters/base.py     the adapter interface
  adapters/mock_rest.py  reference adapter for the mock API
  mock_api/            the fake vendor: FastAPI app and seeded store
tests/                 78 tests, all offline
demo/run_demo.py       scripted agent session, output in demo/output.txt
docs/adding-an-adapter.md

Run it

Python 3.11 or newer.

python -m venv .venv && source .venv/bin/activate    # Windows: .venv\Scripts\activate
pip install -e ".[dev]"
python demo/run_demo.py

To serve MCP over stdio, run field-service-mcp. With no environment set it uses the mock API mounted in process: no port is opened and nothing leaves the machine.

Registering it with an MCP client that launches stdio servers:

{
  "mcpServers": {
    "field-service": {
      "command": "/path/to/.venv/bin/field-service-mcp",
      "env": { "FSM_READ_ONLY": "true" }
    }
  }
}

Other ways to run:

# MCP over streamable HTTP at http://127.0.0.1:8000/mcp
MCP_TRANSPORT=streamable-http field-service-mcp

# The mock vendor API as a real HTTP server, and the MCP server pointed at it
field-service-mock-api                                   # http://127.0.0.1:8765, docs at /docs
FSM_BASE_URL=http://127.0.0.1:8765 field-service-mcp

# Seed the mock schedule around today instead of the fixed demo week
MOCK_ANCHOR_DATE=today field-service-mcp

All settings are environment variables, listed in .env.example. None are required.

Tests

pytest

78 tests, no network, no keys, about 15 seconds. They cover:

  • the mock API itself (auth, paging, filters, booking rules, totals in cents)

  • the adapter (vocabulary and money mapping, offset to page translation, error translation, retry on reads and no retry on writes, using scripted HTTP transports)

  • schedule and open slot logic

  • the MCP surface through a real MCP client connected in process (tool listing, schemas, structured output, tool errors, read-only mode)

  • one end to end test that launches the server as a subprocess and talks to it over stdio

  • a contract suite (tests/test_adapter_contract.py) that runs the same assertions against two different adapters

CI (.github/workflows/ci.yml) runs the tests on Python 3.11, 3.12 and 3.13, then runs the demo and diffs it against demo/output.txt.

Demo

python demo/run_demo.py plays a scripted agent session with no model involved: a real MCP client connects to the server in process and makes the calls an agent would make for this request:

Taylor Mockwell called. The water heater still is not fixed. Get someone back out there Tuesday morning and send a quote for a new heating element.

The full transcript is in demo/output.txt. An excerpt:

== Step 3: Look at Tuesday ==
  > find_open_slots(day="2030-01-08", duration_minutes=120, technician_id="T-01")
    open: Sam Example 08:00 to 17:00 (540 min)

== Step 4: A careless booking is refused by the vendor and explained to the agent ==
  > create_visit(job_id="WO-2004", technician_id="T-01", start="2030-01-07T14:00:00", end="2030-01-07T16:00:00")
    TOOL ERROR: Error executing tool create_visit: Tech T-01 is already booked 2030-01-07T13:00:00 to 2030-01-07T15:00:00 (appointment AP-3002). Look up the schedule or the current record, then pick different values.

== Step 5: Book the return visit in an open slot ==
  > create_visit(job_id="WO-2004", technician_id="T-01", start="2030-01-08T09:00:00", end="2030-01-08T11:00:00", notes="Return visit. Bring a replacement heating element.")
    booked AP-3008: 2030-01-08 09:00 to 11:00 tech=T-01 status=booked

The seed data is invented (names such as "Alex Sample", 555-01xx phone numbers, example.com emails, a made-up town) and the dates are fixed in January 2030, so the output is identical on every run.

Adding a real vendor

Write one class that implements FieldServiceAdapter, select it with FSM_ADAPTER=package.module:ClassName, and run the contract tests against the vendor's sandbox. The full guide, with a skeleton and the list of rules an adapter must honour, is in docs/adding-an-adapter.md.

Where this pattern runs

This is drawn from systems that run two small service companies day to day, where agents look up customers, check the calendar, and draft jobs and quotes against the companies' field service software. The parts kept here are the ones that earned their place in that use: a thin vendor-neutral tool surface, an adapter per vendor, a read-only switch for new deployments, and error messages written for the model that has to recover from them. This repository is a clean rewrite with invented data. It contains no code, configuration or records from those systems.

Limitations

  • Only the mock adapter ships. No real vendor has been integrated in this repository. The adapter guide describes how, but OAuth refresh, rate limit handling and vendor quirks are work you would still have to do.

  • Create and read only. There are no update, cancel, reschedule or delete tools, and no invoices, payments or line item catalogs.

  • No idempotency on writes. Writes are not retried, but if an agent calls create_job twice you get two jobs. A real deployment should add idempotency keys or a duplicate check.

  • No approval step. FSM_READ_ONLY is all or nothing. Tool annotations mark the create tools as writes, but whether a person confirms each write is up to the MCP client.

  • Naive local datetimes. There is no time zone handling. A business that spans time zones needs more than this.

  • find_open_slots is simple. It finds gaps inside fixed working hours. It ignores travel time, skills, breaks, days off and anything that is not a booked visit.

  • get_schedule makes one lookup per distinct job and customer in the window. Fine for a small shop's week, slow for a large fleet without caching or a vendor batch endpoint.

  • The MCP server has no authentication of its own. stdio inherits the trust of whoever launched it. If you expose the streamable HTTP transport beyond localhost, put authentication in front of it.

  • The mock keeps state in memory. It resets on restart, and its double booking check is not safe across multiple worker processes.

  • Windows path length. One transitive dependency ships deeply nested data files. If the project sits in a very long directory path on Windows without long path support enabled, imports can fail. Use a short path or enable long paths.

License: MIT, see the LICENSE file.

Available Tools

15 tools
create_customerB

Create a customer. Search with list_customers first to avoid duplicates.

Inputs: name (required), email, phone, address. Returns: id, name, email, phone, +2 more

create_jobB

Create a job (a piece of work) for an existing customer. It starts in status open.

Inputs: title (required), customer_id (required), priority, description. Returns: id, title, status, priority, +3 more

create_quoteB

Create a draft quote for a customer. The total is computed by the field service system.

Inputs: line_items (required), customer_id (required), job_id. Returns: id, total, job_id, status, +3 more

create_visitB

Book a technician on a job for a time window. Fails if the technician is already booked then.

Inputs: end (required), start (required), job_id (required), technician_id (required), +1 more. Returns: id, end, notes, start, +3 more

find_open_slotsB
Read-onlyIdempotent

Find free windows inside working hours that can fit a visit of the given length.

Inputs: day (required), technician_id, duration_minutes. Returns: day, slots, workday_end, workday_start, +1 more

get_customerC
Read-onlyIdempotent

Fetch one customer by id.

Inputs: customer_id (required). Returns: id, name, email, phone, +2 more

get_jobC
Read-onlyIdempotent

Fetch one job by id.

Inputs: job_id (required). Returns: id, title, status, priority, +3 more

get_quoteB
Read-onlyIdempotent

Fetch one quote with its line items and total.

Inputs: quote_id (required). Returns: id, total, job_id, status, +3 more

get_scheduleA
Read-onlyIdempotent

Show who is booked where: visits grouped by technician and day, with job and customer names.

Inputs: date_from (required), date_to, technician_id. Returns: days, date_to, date_from

list_customersA
Read-onlyIdempotent

List customers, optionally filtered by a free text search.

Inputs: limit, offset, search. Returns: items, limit, total, offset

list_jobsA
Read-onlyIdempotent

List jobs, newest first. Filter by customer and by status.

Inputs: limit, offset, status, customer_id. Returns: items, limit, total, offset

list_quotesB
Read-onlyIdempotent

List quotes, newest first. Filter by customer and by status.

Inputs: limit, offset, status, customer_id. Returns: items, limit, total, offset

list_techniciansA
Read-onlyIdempotent

List the technicians who can be assigned to visits.

Inputs: no named parameters. Returns: result

list_visitsA
Read-onlyIdempotent

List visits, earliest first. Filter by job, technician and an inclusive date range.

Inputs: limit, job_id, offset, date_to, +2 more. Returns: items, limit, total, offset

server_infoA
Read-onlyIdempotent

Describe this server: which adapter is active, whether writes are enabled, and working hours.

Inputs: no named parameters. Returns: object

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 15 tools

    Disambiguation4/5

    Most tools target clearly distinct resources and actions, with list/get/create variants easy to tell apart. The only mild overlap is between list_visits and get_schedule, since both expose visit scheduling information, though their descriptions distinguish filtered listing from grouped daily views.

    Naming Consistency4/5

    The set overwhelmingly follows a clear verb_noun convention: list_*, get_*, create_*, and find_open_slots. The only minor deviation is server_info, which is noun-based rather than verb-based, but it remains readable and predictable.

    Tool Count5/5

    With 15 tools, the server is well-scoped for a field service domain covering customers, jobs, visits, quotes, scheduling, and technicians. Each tool appears to earn its place without excessive surface area.

    Completeness3/5

    The server covers read and create operations across the main entities, plus scheduling helpers, but lacks update, delete, cancel, reschedule, and status-transition operations. These are notable lifecycle gaps for field service workflows, where changing jobs, visits, and quotes is common.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides comprehensive access to the FieldEdge field service management platform through over 87 tools and 16 React applications. It enables users to manage customers, jobs, scheduling, and invoicing through natural language or integrated UI components.
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables Claude and other MCP clients to read and update an internal, session-cookie-authenticated enterprise web app that has no API, exposing work-order lookup, pending-work listing, and close-out note creation as typed tools. Endpoints, form fields, and selectors are configurable so it can be repointed at any similar HTML-based system.
      3
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Exposes a fictional small business as 46 MCP tools spanning CRM, inbox, calendar, invoicing and phone, letting agents read and modify customers, deals, messages and payments with validated, audited writes that stay inside the process.
      Apache 2.0
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to read and change jobs, job status, customers, quotes with line items, invoices, quote and invoice email, payments, and Scheduler bookings in an account by reusing the user's own signed-in Chrome session, with no official API keys needed. Ships read-only hints and confirmation prompts for tools that reach other people, and can be run over stdio or streamable HTTP.
      2
      22
      55 PyPI
      6
      Elastic 2.0