MADATA / DEV developer docs Français madata.africa

The MCP server

MADATA speaks the Model Context Protocol. An AI assistant connects to the single address https://mcp.madata.africa/mcp, your code to the address of your workspace, and both call the same business tools.

01What it is

The MCP server is the second façade over the tool engine of Mia, the built-in assistant. Where Mia runs its loop internally, the MCP server publishes its tools to an external client: Claude, ChatGPT, Gemini, Mistral Le Chat, or your code.

The client receives a tool catalog (tools/list), calls tools (tools/call), and reads read-only resources. Every call runs with the permissions of the connected user.

02Two addresses, one server

AddressForAuthentication
https://mcp.madata.africa/mcpClaude, ChatGPT, Mistral Le Chat, Claude Code.OAuth 2.1. You pick the workspace when signing in.
https://<workspace>.madata.app/mia/mcpScripts, Gemini CLI, Cursor, VS Code, a GPT Action.Bearer mia_… key. The workspace OAuth stays available.

mcp.madata.africa is a gateway: it hosts the OAuth authorization server, then relays each request to the server of the chosen workspace. Tools, permissions, limits and errors are therefore those of the workspace.

A key does not open the gateway

The gateway only accepts the tokens it issued: a key created in the portal gets 401 there. With a key, always call the workspace address.

03Endpoint & transport

Method
POST: JSON-RPC 2.0 body, one request per call
Auth
Authorization: Bearer … header
Content-Type
application/json
Body
8 MB at most

The transport is plain HTTP, compatible with modern "Streamable HTTP" clients. There is no server→client SSE stream, and the server is stateless:

HTTP methodResponseRole
POST200 + JSON-RPC bodyMain channel: all protocol methods. A notification gets 202 with no body.
GET405Would open a notification stream; the server has none.
DELETE204End of session; stateless server, no effect.
OPTIONS204 + CORSPreflight (extensions, web clients). Access-Control-Allow-Origin: *.

04Handshake (initialize)

The first call of any session. The server returns the requested protocol version if it is supported (2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05), otherwise 2025-06-18. Every response repeats the version in the MCP-Protocol-Version header.

jsoninitialize request → response
{"jsonrpc":"2.0","id":1,"method":"initialize",
 "params":{"protocolVersion":"2025-06-18","capabilities":{},
           "clientInfo":{"name":"my-app","version":"1.0"}}}

{"jsonrpc":"2.0","id":1,"result":{
  "protocolVersion":"2025-06-18",
  "capabilities":{"tools":{},"resources":{},"prompts":{}},
  "serverInfo":{"name":"madata-mia","version":"1.2.0","title":"Madata",
                "websiteUrl":"https://<workspace>.madata.app","icons":[…]},
  "instructions":"Cette plateforme de gestion d'entreprise s'appelle Madata…"
}}

The instructions field reminds the client to call the platform "MADATA", to act through the tools rather than sending the user to the UI, and to suggest "Read + Write" if no write tool shows up.

05Protocol methods

MethodRole
initializeVersion negotiation, capabilities, serverInfo.
notifications/*Acknowledgement: 202 with no body.
tools/listTool catalog, filtered by the scope of the connection, with a readable title and annotations.
tools/callRuns a tool.
resources/list · resources/read4 read-only resources (see Resources).
resources/templates/listReturns an empty list (no URI templates).
prompts/list · prompts/get8 ready-to-use prompts.
pingReturns {}.

Any other method (logging/setLevel, completion/complete, roots/list…) returns the JSON-RPC error -32601 "method not found" with HTTP 200: this is normal discovery, not a failure. JSON-RPC batches (arrays) are not supported.

06Calling a tool (tools/call)

jsontools/call
{"jsonrpc":"2.0","id":2,"method":"tools/call",
 "params":{"name":"get_kpi","arguments":{"period":"month"}}}

{"jsonrpc":"2.0","id":2,"result":{
  "content":[{"type":"text","text":"{\"ca_ttc\":4210000,…}"}],
  "isError":false
}}

The result comes back in content: a text block in compact JSON, and a resource block for a generated file. When the user has access to several companies, write tools also declare a company_name parameter.

Shortened responses

A tool response is 96 KB at most. Beyond that, its longest list is shortened and a _tronque field says how many items are kept out of the total: narrow the filter, request fewer fields or paginate.

Soft results

When a call succeeds but the answer is "not found", "argument to fix", "empty target" or "forbidden", isError stays false: the response carries usable information (near matches, the field name to correct, where to widen the connection). The client uses it instead of replaying the same call verbatim.

07Error codes & status contract

The distinction matters for an AI connector: a 401 makes it drop its token and restart an OAuth consent; a 403 keeps it connected and it retries.

SituationHTTPJSON-RPCHeaders / detail
Key missing / invalid / expired / revoked401-32001WWW-Authenticate: Bearer resource_metadata="…"
Mia disabled on the workspace403-32001Retry-After: 300
Mia subscription inactive403-32001Retry-After: 300
Billed resource touched403-32003Business message: "manage this in the portal".
Rate limit exceeded429-32029Retry-After: 60
Body over 8 MB413-32600
Unknown protocol method200-32601Normal discovery.
Unknown tool or prompt, wrongly typed parameter200-32602
Unknown or unauthorized resource200-32002
Tool execution error200result with isError:true
Internal failure500-32603Generic message, details in the log.
Unparseable JSON400-32700
Batch, missing method, workspace not found400-32600

The gateway adds its own responses, in the {"error":"…","error_description":"…"} format:

SituationHTTPDetail
Token missing, expired, revoked or unknown401WWW-Authenticate: Bearer resource_metadata="https://mcp.madata.africa/.well-known/oauth-protected-resource"
Access removed in the workspace401The workspace answered 401: the link is cut, sign in again.
Body over 20 MB413payload_too_large
Workspace unreachable502espace_injoignable: retry.
Workspace unavailable503espace_indisponible

08Rate limit

120 requests / minute per user and per workspace, sliding window. Handshake and catalog methods (initialize, tools/list, prompts/list, resources/list, resources/templates/list, ping) do not count; calls (tools/call, resources/read, prompts/get and the REST route) are capped. Over the limit → 429 + Retry-After: 60.

09Scope & permissions

Three levels combine:

  1. Connection scope: read_only, full_access (read + write) or custom (an allow-list of tools). It can be changed at any time in the portal, Mia page, MCP tab.
  2. The user's access mode, set in the portal ("Read only" or "Read and write"): a "Read only" user never writes, whatever the scope.
  3. The user's permissions in the workspace: a tool the user is not allowed to use, or whose module is hidden from them, does not appear in tools/list.
Invariant

Whatever the scope, a connection can never create or modify billed resources: users, companies, points of sale, apps. Any attempt returns -32003. No point asking to raise permissions: that is not where the refusal comes from.

10Availability

MCP access requires an active Mia subscription on the workspace. Without one, the MADATA page refuses the authorization. If the subscription stops later, the server replies 403 + Retry-After: the connection stays and access comes back as soon as it is reactivated, with nothing to redo.