Skip to content

Export MCP server configuration

Gram provides an API endpoint to export MCP server configuration as JSON. This is useful for:

  • Documentation: Generate up-to-date API documentation for an MCP server
  • Integration: Share configuration with external systems or tools
  • Backup: Keep a record of server configuration
  • Automation: Programmatically access server details for CI/CD pipelines

The export endpoint supports two authentication methods:

Section titled “API key authentication (recommended for automation)”

Use a Gram API key with consumer scope. This method is ideal for CI/CD pipelines and programmatic access.

Required headers:

  • Gram-Key: The API key
  • Gram-Project: The project slug

For browser-based access, the endpoint also accepts session cookies. This is used automatically when accessing from the Gram dashboard.

POST https://app.getgram.ai/rpc/mcpMetadata.export
Content-Type: application/json
Gram-Key: YOUR_API_KEY
Gram-Project: YOUR_PROJECT_SLUG
{
"mcp_slug": "my-mcp-server"
}
FieldTypeDescription
mcp_slugstringThe MCP server slug from the install URL (e.g., for https://mcp.getgram.ai/my-mcp-server, use my-mcp-server)

The endpoint returns a comprehensive JSON object containing all server configuration details:

{
"name": "My API Server",
"slug": "my-api-server",
"server_url": "https://mcp.getgram.ai/mcp/org-123-my-api-server",
"description": "A description of the MCP server",
"documentation_url": "https://docs.example.com",
"instructions": "Instructions for using this server",
"tools": [
{
"name": "get_users",
"description": "Retrieve a list of users",
"input_schema": {
"type": "object",
"properties": {
"limit": {
"type": "integer",
"description": "Maximum number of users to return"
}
}
}
}
],
"authentication": {
"required": true,
"headers": [
{
"name": "Mcp-Speakeasy-Api-Key",
"display_name": "API Key"
}
]
}
}
FieldTypeDescription
namestringDisplay name of the MCP server
slugstringURL-friendly identifier
server_urlstringFull URL of the MCP server endpoint
descriptionstringServer description (optional)
documentation_urlstringExternal documentation URL (optional)
instructionsstringUsage instructions for AI assistants (optional)
toolsarrayList of available tools with their schemas
authenticationobjectAuthentication requirements
Terminal window
curl -X POST https://app.getgram.ai/rpc/mcpMetadata.export \
-H "Content-Type: application/json" \
-H "Gram-Key: YOUR_API_KEY" \
-H "Gram-Project: YOUR_PROJECT_SLUG" \
-d '{"mcp_slug": "my-mcp-server"}'
import requests
response = requests.post(
"https://app.getgram.ai/rpc/mcpMetadata.export",
headers={
"Content-Type": "application/json",
"Gram-Key": "YOUR_API_KEY",
"Gram-Project": "YOUR_PROJECT_SLUG",
},
json={"mcp_slug": "my-mcp-server"}
)
config = response.json()
print(f"Server: {config['name']}")
print(f"Tools: {len(config['tools'])}")
const response = await fetch('https://app.getgram.ai/rpc/mcpMetadata.export', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Gram-Key': 'YOUR_API_KEY',
'Gram-Project': 'YOUR_PROJECT_SLUG',
},
body: JSON.stringify({ mcp_slug: 'my-mcp-server' })
});
const config = await response.json();
console.log(`Server: ${config.name}`);
console.log(`Tools: ${config.tools.length}`);

Export server configuration directly from the Gram dashboard:

  • Navigate to the MCP server in the dashboard
  • Click the Export JSON button in the header
  • Copy the JSON to clipboard or download as a file
Status CodeDescription
401Unauthorized - Invalid or missing API key
404MCP server not found or MCP is not enabled

Use the exported configuration to automatically generate documentation:

config = export_mcp_config("my-mcp-server")
# Generate markdown documentation
doc = f"# {config['name']}\n\n"
doc += f"{config.get('description', '')}\n\n"
doc += "## Available Tools\n\n"
for tool in config['tools']:
doc += f"### {tool['name']}\n"
doc += f"{tool.get('description', '')}\n\n"

Validate MCP server configuration in a deployment pipeline:

# GitHub Actions example
- name: Export MCP Config
run: |
curl -X POST https://app.getgram.ai/rpc/mcpMetadata.export \
-H "Content-Type: application/json" \
-H "Gram-Key: ${{ secrets.GRAM_API_KEY }}" \
-H "Gram-Project: ${{ vars.GRAM_PROJECT_SLUG }}" \
-d '{"mcp_slug": "my-mcp-server"}' \
-o mcp-config.json
# Validate tool count
TOOL_COUNT=$(jq '.tools | length' mcp-config.json)
if [ "$TOOL_COUNT" -lt 1 ]; then
echo "Error: No tools found in MCP server"
exit 1
fi