Skip to main content

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.

  1. Create a blank project in TakeShape.
  2. Connect the Rick & Morty API to your project. You can do this by clicking on Add Service, entering Rick as the name and https://rickandmortyapi.com/graphql as the URL. Then click Save.
  3. Click the Create button in the top right, and then select New AI Tool from the dropdown.
  1. Provide a unique name for your tool, listEpisodes works.
  2. Select episodes as a query from the Query or Mutation dropdown.
  3. The page argument will prepopulate. You can leave it as is.
  4. Add a selection set to the query. You can use the following:
{
info {
pages
}
results {
air_date
characters {
name
}
created
episode
id
name
}
}
  1. Deploy the schema changes.

Creating an API Key

  1. Click on the Settings tab, then API Keys and add an API key with the read role.
  2. Copy the new API key somewhere safe, you will need it later.

Using the Tool in Claude Desktop

  1. Follow the instruction to setup an MCP server in Claude.
  2. Edit the claude_desktop_config.json file to add a remote connection to your TakeShape project. Note that you will need to replace YOUR_PROJECT_ID with your TakeShape project ID and YOUR_API_KEY with the API key you created in the previous section. You will also need to be sure Claude has access to the npx executable, which may involve setting your PATH env 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"
}
}
}
}
  1. Restart Claude Desktop.
  2. Check your Claude tools, it should include the takeshape server and your listEpisodes tool under it.
  1. Ask Claude something that will make use of your listEpisodes tool. You can try the following prompt:
Get me some Rick and Morty episodes.