Skip to main content

Connecting Claude and Other MCP Clients

flAPI serves MCP over HTTP at POST http://<host>:<port>/mcp/jsonrpc, on the same port as the REST API. Any client that speaks MCP's HTTP transport connects directly; a client that can only start local (stdio) processes needs a bridge.

If you have not yet added an mcp-tool: block to an endpoint, start with the MCP Overview.

Which Client, Which Setup​

ClientHow to connectAuthProtocol eraTested
Claude Codeclaude mcp add --transport http (below)--header "Authorization: ..."legacy (initialize)yes: Status: ✔ Connected
Python MCP SDK (mcp 2.3)streamable_http_client (below)headers on the HTTP clientlegacy, 2025-11-25yes
Claude Desktopthe mcp-remote bridge (below)--header argument to mcp-remotelegacythe bridge was tested against flAPI; Claude Desktop itself was not
Cursor, VS Codetheir HTTP MCP server config (URL plus headers)Authorization headerdepends on the clientno

Every client authenticates on every request: flAPI checks credentials per request, not per session. The credentials are those of mcp.auth, which is separate from REST auth:.

Claude Code​

Use the flAPI plugin

The flAPI Claude Code plugin registers the MCP server for you and adds ten flAPI skills, seven slash commands and a hook that validates and hot-reloads your edits.

Claude Code speaks HTTP MCP natively. No bridge is needed:

# No mcp.auth
claude mcp add --transport http flapi http://localhost:8080/mcp/jsonrpc

# mcp.auth type: basic
claude mcp add --transport http flapi http://localhost:8080/mcp/jsonrpc \
--header "Authorization: Basic $(printf 'analyst:s3cret' | base64)"

# mcp.auth type: bearer
claude mcp add --transport http flapi http://localhost:8080/mcp/jsonrpc \
--header "Authorization: Bearer $FLAPI_MCP_TOKEN"

claude mcp get flapi # Status: ✔ Connected

--scope project writes the entry to .mcp.json, so the team shares it. Keep tokens out of that file.

If the server runs with --config-service, Claude Code also sees the flapi_* config tools and can create, update and reload endpoints during a coding session. Each of those calls needs the config-service token in an X-Config-Token header.

Python MCP SDK​

import asyncio, base64
from mcp import ClientSession
from mcp.client.streamable_http import streamable_http_client
from mcp.shared._httpx_utils import create_mcp_http_client

URL = "http://localhost:8080/mcp/jsonrpc"
HEADERS = {} # with mcp.auth: {"Authorization": "Basic " + base64.b64encode(b"analyst:s3cret").decode()}

async def main():
async with create_mcp_http_client(headers=HEADERS) as http, \
streamable_http_client(URL, http_client=http) as (read, write, *_), \
ClientSession(read, write) as session:
await session.initialize()
print([t.name for t in (await session.list_tools()).tools])
result = await session.call_tool("find_customers", {"id": 3})
print(result.is_error, result.structured_content)

asyncio.run(main())

Run it with uvx --with mcp python client.py.

Claude Desktop and Other stdio-only Clients​

Claude Desktop's mcpServers config starts each server as a local stdio process. To reach flAPI over HTTP it needs a bridge such as mcp-remote.

OSConfig file
macOS~/Library/Application Support/Claude/claude_desktop_config.json
Windows%APPDATA%\Claude\claude_desktop_config.json
Linux~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"flapi": {
"command": "npx",
"args": ["-y", "mcp-remote", "http://localhost:8080/mcp/jsonrpc",
"--header", "Authorization: Basic YW5hbHlzdDpzM2NyZXQ="]
}
}
}

Leave out the two --header arguments for a server without mcp.auth. Quit Claude Desktop fully and reopen it; your tools appear in the tools indicator.

Not "command": "curl"

Claude Desktop expects a long-lived stdio MCP process, not a one-shot HTTP request. Use a stdio-to-HTTP bridge such as mcp-remote.

In production, put TLS in front of flAPI: Basic credentials and tokens travel with every request.

Direct API Use (Anthropic SDK)​

When you call Claude through the Anthropic API, you can expose flAPI tools through tool use without an MCP client:

  1. Call flAPI's tools/list once and translate each tool (the typed inputSchema maps directly to Anthropic's input_schema).
  2. When Claude returns a tool_use block, call tools/call with name and arguments.
  3. Return the result's content to Claude as a tool_result.
import requests
import anthropic

FLAPI = "http://localhost:8080/mcp/jsonrpc"
HEADERS = {} # with mcp.auth: {"Authorization": "Bearer ..."} on every request
client = anthropic.Anthropic()

def jsonrpc(method, params=None, _id=1):
r = requests.post(FLAPI, headers=HEADERS, json={
"jsonrpc": "2.0", "id": _id, "method": method, "params": params or {},
})
return r.json()["result"]

mcp_tools = jsonrpc("tools/list")["tools"]
anthropic_tools = [
{"name": t["name"], "description": t["description"], "input_schema": t["inputSchema"]}
for t in mcp_tools
]

response = client.messages.create(
model="claude-opus-4-7",
max_tokens=1024,
tools=anthropic_tools,
messages=[{"role": "user", "content": "Which BUILDING customers have the highest balance?"}],
)

for block in response.content:
if block.type == "tool_use":
result = jsonrpc("tools/call", {"name": block.name, "arguments": block.input})
# result["content"] is ready to send back as a tool_result

No initialize is needed for this pattern: flAPI keeps no state that a call depends on.

Troubleshooting​

SymptomLikely causeFix
No tools appearThe client cannot reach flAPIcurl http://localhost:8080/mcp/health and check tools_count
A tool you just added is missingflAPI reads sqls/ at startupRestart the server, or flapii endpoints reload --file sqls/<file>.yaml against a server with --config-service; then have the client list tools again (flAPI sends no list_changed)
Every call fails with -32000, HTTP 401mcp.auth is on and no or wrong credentials were sentAdd the Authorization header to the client config
-32000, HTTP 403 Permission deniedThe caller holds none of the tool's allowed-roles, or the tool has no allowed-rolesGive the tool allowed-roles, or the user the role
-32001 on a flapi_* toolMissing or wrong config-service tokenSend X-Config-Token: $FLAPI_CONFIG_SERVICE_TOKEN
-32601 Method not foundTypo, or a method of the other protocol eraSee the method table
isError result with Unknown parameterAn argument the tool does not declareFix the argument name; inputs go under arguments

More Information​

Need help wiring Claude into your data stack? Contact our team.

🍪 Cookie Settings