Excel MCP Server: A Developer's Guide to Excel Calculations for AI Assistants

An Excel MCP server makes the calculations of an Excel workbook available to AI assistants as tools over the Model Context Protocol (MCP). With SpreadAPI you do not install or host one: every published service has its own MCP address, and Claude, ChatGPT or any other MCP client sends input values to it and gets back the results your formulas calculated.

This guide is for developers who want to know what really happens on that connection: what an assistant sees of a service, how to set it up, what the JSON-RPC messages look like, what tokens change, and where the limits are. Every statement follows the SpreadAPI help centre, and each section links to the article it comes from.

Why the spreadsheet should calculate, not the model

A language model is good at understanding a question and bad at exact arithmetic and business rules. A price list with editions, volume steps and discount rules is exactly the kind of thing it gets almost right. SpreadAPI splits the work:

  • The assistant understands the question and picks the input values.
  • Your workbook calculates on SpreadAPI's servers, with your formulas.
  • The assistant reports the outputs it got back.

Every service tells the assistant this in its instructions: each result is calculated by the owner's spreadsheet, and the assistant should call the service for every number it reports instead of working it out or estimating it. The rules stay where they already are, in the Excel file. When they change, you change the workbook and publish again.

More on this: AI safety and accuracy.

Two MCP addresses, and when to use which

SpreadAPI has two MCP addresses. They are for different owners of the AI.

The account address is for your own assistant:

https://spreadapi.io/mcp

You connect Claude or ChatGPT to your account once, by signing in. The assistant then reaches every service you allow, without a token, with tools such as list_services, describe_service and run_service. If you give it the right to, it can also build new services from a spreadsheet, test them and publish them.

The service address is for other people's assistants, for example a customer's:

https://spreadapi.io/api/mcp/service/{serviceId}

It is an MCP server for exactly one service. Whoever adds it gets tools to calculate with that service and nothing else: no other service, no workbook, no account.

An agent that cannot add an MCP server can use the discovery address https://spreadapi.io/d/{serviceId} instead. It describes the service in words and JSON and calculates over plain HTTP. And the normal REST API works for any code.

More on this: How AI assistants use a service.

What the assistant sees of a service

The rest of this guide looks at the service address, because that is where you can read every message yourself.

Three tools

  • spreadapi_calc: one calculation. Input values in, outputs back.
  • spreadapi_batch: 2 to 20 scenarios in one call, for comparing options.
  • spreadapi_get_details: the inputs and outputs in full, with examples and the rules for calling.

All three only read and calculate. They carry the hints readOnlyHint: true and destructiveHint: false, so an MCP client knows that a call changes nothing and can be repeated.

Inputs with types and allowed values

The input schema of spreadapi_calc lists every input with its type, its allowed values (enum), minimum, maximum, default and description, and it names the required ones. These facts come from the parameter settings of the service, not from a text you have to write. For a percentage input SpreadAPI adds the sentence "Send a decimal: 0.05 for 5%." by itself.

A value that is not allowed is refused, and the answer names the input and what is allowed. The assistant can then correct the call, or tell the user what is possible.

Results

A result holds three parts:

  • outputs: a list with name, title, value and, when the cell has a number format, formatString.
  • inputs: the values as the spreadsheet used them. This is the first place to look when a result seems off.
  • metadata: executionTime in milliseconds and cached.

The briefing

When the assistant connects, the answer to initialize carries a short briefing as server instructions. It contains:

  • the name and description of the service;
  • your notes on when the assistant should use it, marked as "Notes from the service owner";
  • the rules for calling: calculate every number with the service, a call changes nothing, percentages are sent as decimals, compare options in one batch, how to show results;
  • if you wrote one, your wish for how results should be presented;
  • the list of outputs.

You write these texts on the service's AI → Definition page: What the service does, When the AI should use it, How the AI should answer, Example questions, and one sentence per input and output. The presentation wish is an instruction to the model, not a layout. Assistants usually follow it, but it cannot be guaranteed.

What it does not see

Through the service address an assistant does not see the workbook, the formulas, other cells, other sheets or your other services. It gets the descriptions, the inputs with their limits, the outputs with an example value from publishing, and the results of its own calls.

One distinction matters here. An assistant connected to your own account sees more if you allow it: with the level Edit or Full access it can read sheets, cell values and formulas of the services it may reach, because it needs them to build services. With the level Use it only sees descriptions, inputs, outputs and results.

More on this: The MCP address of one service, Describe a service for AI, Write good descriptions.

Step-by-step setup

Step 1: Turn the workbook into a service

Sign in at spreadapi.io and click New Service. Choose Import an existing spreadsheet and drop your Excel file. On the Configuration tab, click a cell a caller should fill, click Add as Parameter, and repeat for every input. Add the result cells the same way: a cell with a formula is set up as an output.

Step 2: Describe it for assistants

Open AI → Definition and fill in what the service does, when an assistant should use it and a few example questions. Give every input and output one sentence that says what the value means: the unit, what it refers to. Do not repeat types, ranges or allowed values; those are served automatically. Suggest all drafts the empty fields for you; read the drafts before you accept them.

Step 3: Save and publish

Click Save, then Publish. This step is not optional: the MCP address of a draft does not answer.

Step 4: Connect your own assistant

For Claude:

  1. In SpreadAPI, open the AI agents page from the service list and click Connect an AI.
  2. Under With sign-in · no key choose Claude and copy the address https://spreadapi.io/mcp.
  3. In Claude, go to Settings → Connectors → Add → Custom connector, give it a name and paste the address. On the next step choose "Sign in when needed".
  4. Claude opens SpreadAPI in your browser. Check the account shown on the page, then confirm what Claude may do.
  5. Back in SpreadAPI, click Done.

The consent page starts on Full access for all services. If the assistant should only calculate, click Change and pick Use, and limit it to the services it needs.

For ChatGPT the steps are the same, except that you add a custom MCP server in ChatGPT, paste the address and choose OAuth as authentication.

For Claude Code it is one command, followed by /mcp, spreadapi and "Authenticate":

claude mcp add --transport http spreadapi https://spreadapi.io/mcp

Other clients connect with a key instead of a sign-in. You create one on the same page under With a key (Cursor, your own code, another AI) and send it as the header Authorization: Bearer followed by the key.

To try the connection, ask: "Which services do I have at SpreadAPI?"

Step 5: Or hand one service to someone else

Open the service, select AI → Connect and copy the address under Someone else's AI: the MCP address of this service. The other person adds it to their assistant as a custom connector. For a public service no sign-in is asked for.

More on this: Your first service, Connect Claude, Connect ChatGPT, The AI agents page.

A worked example: the quote calculator

Take a small pricing workbook published as the service "Quote calculator". It has three inputs and one output:

  • licenses: a number from 1 to 500, required.
  • edition: one of Basic, Pro, Enterprise, required.
  • discount: a percentage from 0 to 50%, optional, default 0.
  • total: the output, titled "Total per month".

The prices are an assumption of this example: in our sample workbook a Pro licence costs 30 per month. Your numbers come from your own formulas.

Listing the tools

The service address speaks JSON-RPC 2.0 over HTTP POST with the methods initialize, tools/list and tools/call. For a public service you can ask it yourself:

curl -s -X POST \
  "https://spreadapi.io/api/mcp/service/{serviceId}" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

The answer, shortened to the first tool and without its output schema:

{
  "jsonrpc": "2.0",
  "result": {
    "tools": [
      {
        "name": "spreadapi_calc",
        "description": "Use this when the user wants a single calculated result from \"Quote calculator\" — Calculates the monthly price of a subscription from the number of licences, the edition and the discount. …",
        "inputSchema": {
          "type": "object",
          "properties": {
            "inputs": {
              "type": "object",
              "properties": {
                "licenses": {
                  "type": "number",
                  "description": "Number of people who get a licence, including admins.",
                  "minimum": 1,
                  "maximum": 500
                },
                "edition": {
                  "type": "string",
                  "description": "Edition of the product.",
                  "enum": ["Basic", "Pro", "Enterprise"]
                },
                "discount": {
                  "type": "number",
                  "description": "Discount on the list price agreed with the customer. Send a decimal: 0.05 for 5%.",
                  "minimum": 0,
                  "maximum": 0.5,
                  "default": 0
                }
              },
              "required": ["licenses", "edition"]
            }
          },
          "required": ["inputs"]
        },
        "annotations": {
          "readOnlyHint": true,
          "destructiveHint": false,
          "openWorldHint": false
        }
      }
    ]
  },
  "id": 1
}

The first part of the description is generated, the sentence after the dash is the text from What the service does. The descriptions of the inputs are the sentences from AI → Definition; the decimal hint on discount was added by SpreadAPI.

Calculating

A user asks: "What do 25 Pro licences cost with a 10% discount?" The assistant has every required input, so it calls right away:

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "spreadapi_calc",
    "arguments": {
      "inputs": {
        "licenses": 25,
        "edition": "Pro",
        "discount": 0.1
      }
    }
  }
}

The result comes back twice: as JSON text in content and as an object in structuredContent. Shortened to the object, and without executionTime:

{
  "jsonrpc": "2.0",
  "result": {
    "structuredContent": {
      "outputs": [
        {
          "name": "total",
          "title": "Total per month",
          "value": 675,
          "formatString": "€#,##0.00"
        }
      ],
      "inputs": [
        { "name": "licenses", "title": "Licenses", "value": 25 },
        { "name": "edition", "title": "Edition", "value": "Pro" },
        { "name": "discount", "title": "Discount", "value": 0.1 }
      ],
      "metadata": { "cached": false }
    }
  },
  "id": 2
}

The value is the raw number. formatString is the Excel format of the cell, so the assistant can show 675 as €675.00. Input names are not case-sensitive.

A refused value

If the user asks for 25 "Platinum" licences, the call is refused. It is not a protocol error but a normal tool result with isError: true, and its text names the input and what is allowed:

Parameter validation failed: edition: Value "Platinum" is not allowed. Allowed values: Basic, Pro, Enterprise

The briefing tells the assistant what to do with that: tell the user what is allowed instead of picking another value for them.

Comparing options

For "Pro or Enterprise?" the assistant sends one spreadapi_batch call instead of two single ones. The arguments:

{
  "scenarios": [
    {
      "label": "Pro",
      "inputs": { "licenses": 25, "edition": "Pro" }
    },
    {
      "label": "Enterprise",
      "inputs": { "licenses": 25, "edition": "Enterprise" }
    }
  ]
}

The result holds scenarios, each with its label and outputs or an error, and metadata with scenarioCount and successCount.

The same calculation over REST

The service is the same for every caller. Your own code reaches it without MCP:

curl -X POST \
  "https://spreadapi.io/api/v1/services/{serviceId}/execute" \
  -H "Content-Type: application/json" \
  -d '{"inputs": {"licenses": 25, "edition": "Pro", "discount": 0.1}}'

More on this: Call a service over the API, The API response.

Protecting a service with tokens

A published service is either public or token-protected. There is no separate switch: a service with at least one token is protected, a service without tokens is public. You create tokens under API → Access with Create Token. The first token protects the service at once, without publishing again. A token is shown once and belongs to exactly one service.

What that means for assistants depends on the address:

  • Your own assistant on the account address needs no service token, also for protected services. The connection is the access. You control it on the AI agents page: level, services, expiry date, revoke.
  • Someone else's assistant on the service address gets HTTP 401 "Authentication required" from a protected service. A client that can set headers sends the token as Authorization: Bearer followed by the token. Otherwise the client starts a sign-in, and the person pastes a token you created. That sign-in is valid for this one service and lasts 12 hours.
  • The sign-in at a protected service address is built for ChatGPT. For Claude, use an account connection instead.
  • The discovery address takes the token as ?token=…, as a Bearer header or in the POST body.

Two practical rules from the help centre. Give each customer their own token, so that you can revoke one without affecting the others and see on the Usage tab who calls. And remember that revoking the last token makes the service public again immediately; to replace a token, create the new one first.

One difference for your own code: the REST execute address answers token problems with HTTP 400 and a text in error, not with 401.

More on this: Tokens and access.

Honest limits

  • Calls count. A calculation made by an assistant counts like any other call of the service, and in a batch every scenario counts. When the month's calls are used up, the tools answer "Monthly call limit reached" and tell the assistant not to retry.
  • A batch holds 2 to 20 scenarios.
  • A call has up to 30 seconds to answer.
  • Rate limits. An account connection makes at most 120 calls per minute; a service takes at most 1,000 calls per minute from all callers together.
  • Formulas only. VBA macros do not run, and links to other workbooks are not followed. Logic that lives in macros has to be rebuilt with formulas.
  • Changes need a new publish. Callers get the published version until you publish again. An assistant that read the tools earlier may need a reconnect or a new conversation to see new texts.
  • The service address only calculates. It cannot change the service, and it offers one service only.
  • A connected agent cannot do everything either. It cannot unpublish or delete a service, change single cells of an existing workbook, or create and revoke service tokens.
  • Sign-in is offered for Claude, ChatGPT and Claude Code. Any other client connects with a key. An account can have up to 25 connections.
  • SpreadAPI cannot make the assistant call. A good description and example questions make it reliable; you can also say "Use the SpreadAPI service for this."
  • SpreadAPI cannot stop the assistant from misquoting a result. Ask it to show the values as returned if you need to be sure.
  • SpreadAPI calculates what your formulas say. If the model is wrong, the answer is wrong. Test the service with values you know before you publish.

More on this: AI troubleshooting.

FAQ

Do I have to install or host an MCP server for Excel?

No. With SpreadAPI the MCP server is an address. Your own assistant uses https://spreadapi.io/mcp, and every published service has its own address of the form https://spreadapi.io/api/mcp/service/{serviceId}. You add the address to your AI client as a custom connector.

Can the assistant see my formulas?

Not through the MCP address of a service, the discovery address or the API: callers get inputs and outputs only. An assistant connected to your own account with the level Edit or Full access can read cells and formulas of the services it may reach. Choose the level Use if it should only calculate.

Which AI assistants can connect?

Claude and ChatGPT connect by signing in, and Claude Code with one command. Any other AI client that supports MCP servers can connect with a key. An agent without MCP can use the discovery address, which works over plain HTTP.

Do I need a token to connect Claude?

No. Claude signs in through your browser, and the connection itself is the access. Services that are protected by a token can be called through the connection without a token.

How does a customer use my protected service in ChatGPT?

Give them the MCP address of the service and a token you created under API → Access. ChatGPT asks for a sign-in, they paste the token and authorize. The sign-in lasts 12 hours; after that ChatGPT asks again. The customer does not need a SpreadAPI account.

Can an assistant change or break my workbook by calling the service?

No. A calculation is read-only: it sets the input values for this one call, reads the outputs and leaves the workbook and the service as they were. Only an assistant connected to your account with the right to edit can change a service.

Where to go next