Model Context Protocol (MCP)
This feature will continue to be developed and improved over time. Please contact Support if you have any questions or feedback.
Model Context Protocol (MCP) enables AI systems to securely connect to external tools and data. In the context of Coherent Spark, MCP allows AI agents to interact directly with Spark-generated APIs, unlocking agentic use cases that build on existing Excel logic. To support this, Coherent provides a remote MCP server that clients can use to integrate Spark into AI-driven workflows.
Prerequisites
Before connecting to the Coherent MCP server, make sure you have the following:
Access credentials to a Spark tenant.
Authorization token: This server uses OAuth 2.1 authentication with Keycloak, requiring a valid JWT token for all requests. This can be retrieved from the User menu. Currently for long running jobs, this will need to be refreshed manually and the MCP configuration updated. This will be enhanced in future updates.
MCP-compatible AI client: e.g. Claude Desktop, Cline for Visual Studio Code, Visual Studio, etc.
Connect to the Coherent MCP Server
This guide explains how to connect your AI client to the Coherent MCP server to access Coherent Spark tools and capabilities. The currently available tools allow for:
Calling of Spark services, reference Execute API (v3).
Retrieve a summary of information about the workbook.
Access detailed information about the details about the Spark service and also generate a code snippet for integration for the language of your choice.
Some detailed instructions are provided below for specific AI clients. If your client is not on the list, review the documentation for your AI client's MCP configuration and use the details below to configure the client.
Configure for Claude Desktop
This requires Node.js 22 to be installed.
The Claude desktop apps bring Claude's capabilities directly to your computer, allowing for seamless integration with your workflow.
Claude Desktop supports MCP servers via its configuration file.
Open the configuration file appropriate for your operating system.
macOS:
~/Library/Application Support/Claude/claude_desktop_config.json.Windows:
%APPDATA%\Claude\claude_desktop_config.json.Linux:
~/.config/Claude/claude_desktop_config.json.
If you do not have any MCP servers configured, add the following snippet into the document and save. If you already have other MCP servers defined, add
coherent-sparkintomcpServers.Update
myenvironmentand{token}.Save the file.
Restart Claude Desktop. Coherent Spark tools should appear in the available tools list.
Configure for Cline
Cline is an extension for Visual Studio Code that supports MCP servers.
Install the Cline VS Code extension.
Open Cline settings (Settings → Extensions → Cline).
In the MCP Servers, click Edit in settings.json.
If you do not have any MCP servers configured, add the following snippet into the document and save. If you already have other MCP servers defined, add
coherent-sparkintocline.mcpServers.Update
myenvironmentand{token}.Save the file.
Restart Visual Studio Code.
Configure for Cursor
Cursor is an AI-assisted integrated development environment for Windows, macOS, and Linux. It is a fork of Visual Studio Code with additional AI features.
Open Cursor Settings, Tools & MCP.
Click New MCP Server.
If you do not have any MCP servers configured, add the following snippet into the document and save. If you already have other MCP servers defined, add
coherent-sparkintomcpServers.Update
myenvironmentand{token}.Save the file.
Restart Cursor.
Configure for Visual Studio Code
Visual Studio Code (commonly referred to as VS Code) is an integrated development environment developed by Microsoft for Windows, Linux, macOS and web browsers.
Open the Command Palette (
F1).Select the command MCP: Open User Configuration.
If you do not have any MCP servers configured, add the following snippet into the document and save. If you already have other MCP servers defined, add
coherent-sparkintoservers.Update
myenvironmentand{token}.Save the file.
Restart Visual Studio Code.
Configure for other MCP Clients
For other MCP-compatible clients, use the following connection details:
Transport
http
Server URL
https://mcp.{environment}.coherent.global/mcp
The {environment} is part of your Log in to Spark URL.
Example: https://mcp.myenvironment.coherent.global/mcp
Protocol Version
2024-11-05 or later
Authentication
This should be a Bearer token in the Authorization request header.
Example: Authorization: Bearer eyJhbGciO...
Use Coherent MCP tools
Once connected to the MCP server, your AI client will have access to the following tools. The documentation describes the technical details related to the tool call, however these can also be invoked through conversation with a LLM.
Call Execute API (v3) with spark_execute_v3
spark_execute_v3Execute Coherent Spark services using Execute API (v3) with enhanced folder support.
folder
(required) Service folder name.
service
(required) Service name.
inputs
(required) Input data, reference the request_data.
version_id
(optional) Reference to the service version.
subservices
(opotional) Subservices to call.
call_purpose
(optional) Call purpose metadata.
Sample request
Fetch workbook information
Retrieve comprehensive workbook information by SHA-256 hash or workbook ID.
sha256
(optional) SHA-256 hash of the workbook.
workbook_id
(optional) ID of the workbook.
Sample request
Troubleshoot issues
Error: "Bad Request: Server not initialized"
The server requires initialization before handling requests.
This should be handled automatically by the MCP client. If you see this error:
1. Ensure you're using an MCP-compatible client.
2. Verify the client sends an initialize request first.
3. Check that the server URL is correct.
Error: "No authorization token available"
Missing or invalid authorization token.
1. Verify your token is included in the Authorization header
2. Ensure the format is Bearer YOUR_TOKEN (with Bearer prefix).
3. Check that your token has not expired.
4. Obtain a fresh token if needed.
Error: "Invalid or expired token"
The JWT token has expired or is invalid.
1. Obtain a new token. 2. Update your client configuration with the new token. 3. Restart your AI client.
Error: "Tenant is not available"
The token doesn't contain tenant information.
1. Verify your user account has proper tenant assignment.
2. Check with your administrator to ensure proper claims in the JWT
3. Ensure the token contains the required tenant claim.
Tools not appearing in AI client
Possible causes: 1. Server connection failed. 2. Token authentication failed. 3. Client not properly configured.
1. Check the client's console/logs for connection errors. 2. Verify the server URL is correct. 3. Ensure Authorization header is properly formatted. 4. Test the token with a direct API call.
CORS errors in browser-based clients
Browser security restrictions.
The server has CORS enabled. If you still see errors:
1. Ensure you're using HTTPS (not HTTP).
2. Check that your client properly sends the Origin header.
3. Verify the server allows your origin.
If you encounter issues not covered in this guide:
Confirm the server status to verify the server is operational.
Review logs and check your AI client's console/logs for detailed errors.
Contact Support.
MCP server direct API call sample request
This can be used to test the token and access to the MCP server. Remember to update myenvironment and {{BEARER_TOKEN}}.
Security best practices
Never commit tokens to version control
Add config files to
.gitignore.Use environment variables or secure vaults.
Rotate tokens regularly
Obtain fresh tokens periodically.
Use token refresh mechanisms when available.
Use HTTPS only
Never send tokens over unencrypted connections.
Verify the server URL uses
https://.
Limit token scope
Request only the scopes you need.
Follow principle of least privilege.
Monitor token usage
Review your authentication logs.
Report suspicious activity immediately.
Resources
Last updated
