Make Any API MCP Ready with TakeShape
warning
TakeShape's AI-related features are considered experimental. Use in production with the knowledge that these features may change.
Introduction
Model Context Protocol (MCP) is an open protocol that allows AI models to generate context in a standardized way. You can read more about MPC here.
This article will walk you through exposing a query in TakeShape with MCP, and then using that query as a tool in Claude Desktop.
Exposing a Query with MCP
You can expose any query in a TakeShape project, but for the sake of this guide we will start by creating a new project and connecting an external API which we then expose as an MCP tool.
- Create a blank project in TakeShape.
- Connect the Rick & Morty API to your project. You can do this by clicking on
Add Service, enteringRickas the name andhttps://rickandmortyapi.com/graphqlas the URL. Then clickSave. - Click the
Createbutton in the top right, and then selectNew AI Toolfrom the dropdown.
- Provide a unique name for your tool,
listEpisodesworks. - Select
episodesas a query from theQuery or Mutationdropdown. - The
pageargument will prepopulate. You can leave it as is. - Add a selection set to the query. You can use the following:
{
info {
pages
}
results {
air_date
characters {
name
}
created
episode
id
name
}
}
- Deploy the schema changes.
Creating an API Key
- Click on the
Settingstab, thenAPI Keysand add an API key with thereadrole. - Copy the new API key somewhere safe, you will need it later.
Using the Tool in Claude Desktop
- Follow the instruction to setup an MCP server in Claude.
- Edit the
claude_desktop_config.jsonfile to add a remote connection to your TakeShape project. Note that you will need to replaceYOUR_PROJECT_IDwith your TakeShape project ID andYOUR_API_KEYwith the API key you created in the previous section. You will also need to be sure Claude has access to thenpxexecutable, which may involve setting yourPATHenv var.
The claude_desktop_config.json file should look like this:
{
"mcpServers": {
"takeshape": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://api.takeshape.io/project/YOUR_PROJECT_ID/mcp",
"--header",
"Authorization: Bearer ${AUTH_TOKEN}"
],
"env": {
"PATH": "/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",
"AUTH_TOKEN": "YOUR_API_KEY"
}
}
}
}
- Restart Claude Desktop.
- Check your Claude tools, it should include the
takeshapeserver and yourlistEpisodestool under it.
- Ask Claude something that will make use of your
listEpisodestool. You can try the following prompt:
Get me some Rick and Morty episodes.