Skip to content

Connecting the Claude API

Use this path when you call Anthropic’s Messages API directly and want Claude to reach Bridge Town through the hosted MCP connector. Claude.ai users should use the OAuth guide instead; Claude Code and Claude Desktop have their own setup guides.

Bridge Town is bring-your-own-agent and bring-your-own-key. The Claude model runs in your Anthropic account, using your Anthropic API key. Bridge Town never invokes server-side language models, never proxies your open-ended prompts, and receives only structured MCP tool calls from the connector.

  • An Anthropic API key
  • A Bridge Town API token from Connect AI
  • A Messages API model that supports the MCP connector beta

Bridge Town exposes 75 MCP tools. For the Claude API connector, defer all tools by default, then keep only these 14 hot tools non-deferred:

search_tools
get_tool
list_projects
create_project
list_files
read_file
describe_model
commit_files
patch_file
run
get_run
list_runs
list_data_sources
query_data

All other tools stay enabled but deferred. Claude discovers them through Anthropic Tool Search or Bridge Town’s search_tools and get_tool fallback.

Keep tokens out of URLs. Pass the Bridge Town API token through authorization_token; Anthropic forwards it as an Authorization: Bearer ... header to Bridge Town.

import anthropic
client = anthropic.Anthropic()
response = client.beta.messages.create(
model="claude-opus-4-7",
max_tokens=4096,
messages=[
{
"role": "user",
"content": "Create a Bridge Town project and build a first revenue model.",
}
],
mcp_servers=[
{
"type": "url",
"name": "bridge-town",
"url": "https://api.bridgetown.builders/mcp",
"authorization_token": "btk_YOUR_TOKEN",
}
],
tools=[
{
"type": "tool_search_tool_regex_20251119",
"name": "tool_search_tool_regex",
},
{
"type": "mcp_toolset",
"mcp_server_name": "bridge-town",
"default_config": {
"defer_loading": True,
},
"configs": {
"search_tools": {"defer_loading": False},
"get_tool": {"defer_loading": False},
"list_projects": {"defer_loading": False},
"create_project": {"defer_loading": False},
"list_files": {"defer_loading": False},
"read_file": {"defer_loading": False},
"describe_model": {"defer_loading": False},
"commit_files": {"defer_loading": False},
"patch_file": {"defer_loading": False},
"run": {"defer_loading": False},
"get_run": {"defer_loading": False},
"list_runs": {"defer_loading": False},
"list_data_sources": {"defer_loading": False},
"query_data": {"defer_loading": False},
},
},
],
betas=["mcp-client-2025-11-20"],
)

Anthropic’s Messages API MCP connector currently supports MCP tool calls. Use this path for Bridge Town’s modelling workflow: create projects, edit files, run models, query data, create dashboards, and discover deferred tools.

Bridge Town also exposes MCP resources and prompts, but those require a full MCP client integration, such as Claude Code, Claude Desktop, or a custom client using the MCP SDK. Use a full client path when you need resource attachment (health://status, scaffold://default, skills://, templates://) or MCP workflow prompts.

If you build your own MCP client, keep the same hot/cold split:

  • Load the 14 hot tools at startup.
  • Keep every other Bridge Town tool discoverable on demand.
  • Call search_tools(query=...) when the model describes an intent but does not know the exact tool name.
  • Call get_tool(name=...) before invoking a deferred tool so the model can see the current schema.

Do not put bearer tokens in query strings, deep links, or shareable config URLs. Use headers or the connector’s authorization_token field.