Create Magic MCP servers, endpoints and tokens from the terminal
Use metorial-admin magic-mcp to create a server from an integration, combine servers behind one endpoint, issue a token for it and list the sessions it served.
A Magic MCP server is a stable MCP URL for one integration. metorial-admin magic-mcp creates servers, combines several behind one endpoint, issues the tokens that let a client connect, and lists the sessions each server has handled. Use it to script what the dashboard does under Integrations, Magic MCP.
What you'll learn
- How to create a Magic MCP server and see its tools
- How to put several servers behind one endpoint
- How to issue, scope and delete tokens
Before you start
- The
metorial-adminCLI, signed in (install and sign in) - An integration that is already configured (create an integration)
The five subcommands map to five objects:
| Subcommand | What it manages |
|---|---|
servers | One MCP entry point backed by one integration |
endpoints | One URL that routes to several servers |
groups | Labels for servers, used to scope tokens |
tokens | Secrets that authorize a client to connect |
sessions | Connections a server has handled |
Add --format json to any command to get full objects with their IDs.
Create a server
Find the integration instance
A server is created from an integration instance, which is an integration with its configuration and authentication filled in.
Create the server
The response contains the server ID and an endpoints list with the server's URL.
Check the tools
This returns the tools a client will see through the server, after the integration's tool filters.
To find servers later, filter the list. By default, list can leave out servers that belong to one person. Pass --ownership all to include everything you are allowed to see.
delete archives the server. Its URL stops working.
Put several servers behind one endpoint
An endpoint gives a client a single URL for several servers, so one entry in the client's config covers all of them.
The response includes the endpoint's url. To change the set of servers later:
Each entry in --magic-mcp-servers can also carry a tool_filters field to narrow that server's tools on this endpoint only.
Issue a token
A token is bound to one of three things: a server, an endpoint, or one or more groups.
The response includes the token's secret. Give it to the client as part of the URL:
Treat that URL as a password. Create one token per client or per job, so you can remove one without breaking the others.
Scope a token with groups
Groups let one token reach a named set of servers. Add a server to the group and every token bound to that group can use it.
tokens add-groups and tokens remove-groups change a token's groups later. groups delete fails while the group is the only group of an active token, so deleting a group can never widen what a token reaches.
See the sessions a server handled
For the tool calls inside a session, see See what happened from the terminal.
Check it worked
Run metorial-admin magic-mcp servers tools <server-id>. If it lists tools, the server is live. Then add the URL with the token to an MCP client and call one tool. A new row appears in metorial-admin magic-mcp sessions list.