MetorialDocs

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 five subcommands map to five objects:

SubcommandWhat it manages
serversOne MCP entry point backed by one integration
endpointsOne URL that routes to several servers
groupsLabels for servers, used to scope tokens
tokensSecrets that authorize a client to connect
sessionsConnections 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.

metorial-admin integrations instances list --search github

Create the server

metorial-admin magic-mcp servers create \
  --name "GitHub" \
  --description "Issues and pull requests" \
  --integration-instance-id <integration-instance-id>

The response contains the server ID and an endpoints list with the server's URL.

Check the tools

metorial-admin magic-mcp servers tools <server-id>

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.

metorial-admin magic-mcp servers list --search github
metorial-admin magic-mcp servers list --ownership all --status active
metorial-admin magic-mcp servers update <server-id> --name "GitHub (read-only)"
metorial-admin magic-mcp servers delete <server-id>

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.

metorial-admin magic-mcp endpoints create \
  --name "Engineering tools" \
  --magic-mcp-servers '[{"magic_mcp_server_id":"<server-id-1>"},{"magic_mcp_server_id":"<server-id-2>"}]'

The response includes the endpoint's url. To change the set of servers later:

metorial-admin magic-mcp endpoints add-servers <magic-mcp-endpoint-id> \
  --magic-mcp-servers '[{"magic_mcp_server_id":"<server-id-3>"}]'
metorial-admin magic-mcp endpoints list --magic-mcp-server-id <server-id>

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.

# For one server
metorial-admin magic-mcp tokens create --name "CI agent" --magic-mcp-server-id <server-id>

# For one endpoint
metorial-admin magic-mcp tokens create --name "Support bot" --magic-mcp-endpoint-id <magic-mcp-endpoint-id>

The response includes the token's secret. Give it to the client as part of the URL:

https://<endpoint-url>?key=<secret>

Treat that URL as a password. Create one token per client or per job, so you can remove one without breaking the others.

metorial-admin magic-mcp tokens list --magic-mcp-server-id <server-id>
metorial-admin magic-mcp tokens delete <magic-mcp-token-id>

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.

metorial-admin magic-mcp groups create --name "Read-only tools"
metorial-admin magic-mcp groups add-servers <magic-mcp-group-id> --magic-mcp-server-ids <server-id-1>,<server-id-2>
metorial-admin magic-mcp tokens create --name "Analyst agent" --magic-mcp-group-ids <magic-mcp-group-id>

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

metorial-admin magic-mcp sessions list --magic-mcp-server-id <server-id>
metorial-admin magic-mcp sessions get <magic-mcp-session-id>

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.

Next steps