FusionAuth API MCP Server

FusionAuth API MCP Server

This server provides a Model Context Protocol interface for the FusionAuth API, enabling users to manage users, applications, and authentication configurations through natural language. It supports over 300 tools for various operations, including creating, searching, and retrieving data from a FusionAuth instance.

Category
访问服务器

README

Preview FusionAuth API MCP Server (fusionauth-mcp-api)

npm version License: Apache GitHub repository

A preview release of an MCP server for the FusionAuth API. Built with the excellent github.com/harsha-iiiv/openapi-mcp-generator

⚠️ Not for Production Use!

Using this MCP server requires providing the MCP client with a FusionAuth API key. Only use this for dev and test instances. FusionAuth is not responsible for potentially leaking sensitive information.

<!-- tag::forDocSite[] -->

Prerequisites

  • A running FusionAuth instance
  • Node.js

Configuration

First, set up a limited API key in the FusionAuth instance. Here's documentation on creating an API key and configuring the correct permissions for an API key.

Next, configure your MCP client to use the FusionAuth API MCP server.

For example, to add to Claude Desktop, edit ~/Library/Application Support/Claude/claude_desktop_config.json to include the fusionauth-mcp-api key below.

If you don't have any previous MCP servers installed, it would look like this:

{
  "mcpServers": {
      "fusionauth-mcp-api": {
      "command": "npx",
      "args": [
        "@fusionauth/mcp-api"
      ],
      "env": {
        "API_KEY_APIKEYAUTH": "<your fusionauth api key>",
        "API_BASE_URL": "http://localhost:9011",
        "USE_TOOLS": "retrieve,search"
      }
    }
  }
}

The USE_TOOLS env variable above essentially restricts the available tools to read-only operations. You can omit this variable to allow full access, but you will need a model that can handle about 200k tokens.

Consult your MCP client's documentation to determine exactly how to add an MCP server to your client.

Example Prompts

  • "which tools do you have access to?" should show you all the FusionAuth API tools
  • "how many fusionauth applications do I have?"
  • "how many users do I have in my fusionauth instance?"
  • "add a user with an email address of test@example.com and a password of 'password'" (requires less restricted tools)

Restricting Tools

The default MCP Server has a tool for every API endpoint of FusionAuth. Over 300 of them! However, the tools, descriptions, requests, and responses combine to nearly 200k tokens, which can exceed the context window of many MCP clients.

You can restrict which tools this MCP server makes available by setting the USE_TOOLS env variable as shown above.

Each tool is defined by its prefix. The default prefixes are:

  • create
  • delete
  • patch
  • update
  • retrieve
  • search

There is also an other tool bucket that contains every tool with another prefix. The all tool bucket includes all tools and is the default value.

For example, if you don't need to use any delete or patch methods, the following setting reduces the tool list by 20%.

USE_TOOLS="create,update,retrieve,search,other"

If you only want to allow read-only operations, use the following configuration:

USE_TOOLS="retrieve,search"

This also reduces the tool list size by 66%.

Securing Your MCP Server

There are three different approaches to secure your MCP server and you should combine them to enable secure access to your FusionAuth instance while still meeting your functionality needs. In order of granularity (from coarse to fine-grained):

  • Point to the correct instance. This tool is in preview and we suggest you only point it at a local, dev instance.
  • Enable the correct type of tools. In addition to reducing context window usage, limiting the type of requests your LLM can make can increase security. For instance, if you don't enable the delete set of tools, you don't have to worry about the LLM "helping" you by deleting FusionAuth configuration.
  • Lock down your API key. This allows fine-grained control beyond the tool choice. The MCP server communicates to FusionAuth using an API key. You can limit that API key to only allow it to act on tenants, applications and users by choosing the appropriate set of permissions.

Troubleshooting

Verify your API key has the correct permissions for the operation the MCP client is taking.

Check your MCP client logs; these vary by MCP client and platform. For example, $HOME/Library/Logs/Claude/mcp-server-fusionauth-api-server.log is the location for Claude Desktop on macOS. Consult your client's documentation for the precise location.

Use the modelcontextprotocol inspector to help determine if the issue is with the MCP server or with your MCP client: npx @modelcontextprotocol/inspector. If you want to change the USE_TOOLS variable, you cannot dynamically change it and must pass it on the command line. npx @modelcontextprotocol/inspector npx @fusionauth/mcp-api -e API_KEY_APIKEYAUTH=... -e USE_TOOLS=create

<!-- end::forDocSite[] -->

Building Locally

You can also build and run this locally.

git clone https://github.com/FusionAuth/fusionauth-mcp-api.git
cd fusionauth-mcp-api
cd packages/mcp-api
npm install
npm run build

# optional step to store config information in .env file
cp .env.example .env
# optionally edit .env to set API_BASE_URL and API_KEY_APIKEYAUTH

Then, similar to the instructions above, configure your MCP client to use the FusionAuth API MCP server.

For example, to add to Claude Desktop, edit ~/Library/Application Support/Claude/claude_desktop_config.json to include the fusionauth-mcp-api key below. If you don't have any previous MCP servers installed, it would look like this:

{
  "mcpServers": {
    "fusionauth-mcp-api": {
      "command": "npm",
      "args": [
        "run",
        "--silent",
        "--prefix",
        "<path to local git repo>/fusionauth-mcp-api/packages/mcp-api",
        "start"
      ],
      "env": {
        "API_KEY_APIKEYAUTH": "<your fusionauth api key>",
        "API_BASE_URL": "http://localhost:9011",
        "USE_TOOLS": "retrieve,search"
      }
    }
  }
}

You can omit the env section above if you have configured an .env file.

Publishing

bin/updatemcp.sh git commit <changed files> git tag <tag> git push origin main --tags npm publish --access public --workspace=packages/mcp-api

Feedback

Please share feature requests and bugs in this repo.

If you want to share interesting use cases or ask how to use functionality, please post in the FusionAuth forum.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选