Skip to main content

Remote MCP

The remote MCP integration connects any MCP server reachable over HTTP as a tool, so an agent can call the server's actions.

Asset path: aixplain/mcp-server · Marketplace card

The examples use the public DeepWiki MCP server, which answers questions about GitHub repositories and needs no credentials.

Try it​

from aixplain import Aixplain

aix = Aixplain(api_key="YOUR_API_KEY")

mcp_tool = aix.Tool(
integration="aixplain/mcp-server",
name="DeepWiki MCP",
description="Reads the documentation wiki of a public GitHub repository.",
config={"url": "https://mcp.deepwiki.com/mcp"},
).save()
mcp_tool.allowed_actions = ["read_wiki_structure"]

agent = aix.Agent(
name="Repository guide",
description="Explains how GitHub repositories are organized.",
instructions="Use the DeepWiki MCP tool to read a repository's wiki before answering. Keep answers short.",
tools=[mcp_tool],
).save()

result = agent.run("What are the main topics in the aixplain/aiXplain repository wiki? Five bullets.")
print(result.data.output)
Show output

Configuration​

FieldParameterDefaultNotes
MCP server URLurlrequiredThe server's Streamable HTTP endpoint, usually ending in /mcp.

save() connects to the server and reads its actions, so the URL must be reachable from aixplain when you save.

Actions​

The actions are whatever the server exposes. List them, with their inputs, before you scope the tool:

print(mcp_tool.list_actions())
print(mcp_tool.actions["ask_wiki_question"].inputs.keys())
Show output

Set allowed_actions to the actions the agent needs. With allowed_actions empty, the agent sees every action, which adds parameters to its context and lets it call actions you have not reviewed.

Run the tool directly​

The result holds the server's MCP response, a content list of typed parts.

result = mcp_tool.run(action="read_wiki_structure", data={"repoName": "aixplain/aiXplain"})
text = result.data["content"][0]["text"]
print("\n".join(text.splitlines()[:8]))
Show output

Troubleshooting​

SymptomCauseFix
save() fails with fetch failedaixplain cannot reach the URL.Check the URL, DNS and any firewall in front of the server.
save() fails with Method Not AllowedThe URL points at an SSE endpoint.Use the server's Streamable HTTP endpoint (/mcp).
Action '...' not foundThe action name does not match the server's.Copy the name from mcp_tool.list_actions().
The agent does not call the toolThe instructions do not say when to use it.Name the tool and the task in instructions.
mcp_tool.delete() raises Asset is not a utilityThe SDK cannot delete MCP tools.Send DELETE https://platform-api.aixplain.com/sdk/models/<tool id> with an x-api-key header.

Clean up​

agent.delete()

Next steps​