Register Your Server with ContextForgeΒΆ
Workshop progress
You should now have:
- β Run and tested sample MCP servers
- β Built your own server
- β Launched the Gateway
Final step: register your server so it's accessible through the Gateway!
0. Before you startΒΆ
- Gateway running on
http://localhost:4444 - FastMCP server running on
http://localhost:8000/mcp MCPGATEWAY_BEARER_TOKENexported in your shell
export MCPGATEWAY_BEARER_TOKEN=$(uv run python -m mcpgateway.tokens issue --subject echo-dev | jq -r '.token')
1. API workflowΒΆ
curl -X POST http://127.0.0.1:4444/servers \
-H "Authorization: Bearer $MCPGATEWAY_BEARER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "echo-server",
"url": "http://127.0.0.1:8000/mcp",
"transport": "streamablehttp"
}'
Verify:
Expected snippet:
{
"servers": [
{
"name": "echo-server",
"url": "http://127.0.0.1:8000/mcp",
"transport": "streamablehttp",
"status": "active"
}
]
}
2. Admin UI workflowΒΆ
- Visit
http://localhost:4444/adminand sign in with your basic-auth credentials. - Go to Servers β Add Server.
- Enter the HTTP URL exposed by FastMCP (e.g.,
http://localhost:8000/mcp). - Pick the transport that matches your server (
streamablehttpis recommended for new projects; STDIO-only servers can be proxied viamcpgateway.wrapper). - Save and confirm the status flips to Active.
Use the Tools and Resources tabs to make sure your FastMCP metadata propagated. If the server does not appear, double-check that it is reachable via curl http://localhost:8000/mcp and that the bearer token you provided is valid.
3. Validate through the gatewayΒΆ
from fastmcp import Client
from fastmcp.client.auth import BearerAuth
async with Client(
"http://localhost:4444/mcp",
auth=BearerAuth(token=os.environ["MCPGATEWAY_BEARER_TOKEN"]),
) as client:
await client.ping()
result = await client.call_tool("echo-server-echo", {"text": "Gateway Success"})
print(result.content[0].text)
If the tool name includes the namespace (e.g., echo-server-echo), that means the Gateway successfully namespaced and exposed it.
4. TroubleshootingΒΆ
409 server already existsβ delete the entry viaDELETE /servers/{name}or remove it from the Admin UI before re-registering.404 server not foundβ double-check thenamevalue; it must match exactly when issuingPUT/DELETEcalls.- Server stuck in
inactiveβ ensure the FastMCP process is still running and reachable from the gateway container/host. Usedocker execorpodman execto curl from inside the container if needed. - Auth header missing β verify your shell exported
MCPGATEWAY_BEARER_TOKEN(runenv | grep MCPGATEWAY) and that your HTTP client isn't stripping it.
For more help, see the Debugging Guide.
5. Next StepsΒΆ
π Congratulations! You now have a working MCP server connected to ContextForge Gateway.
Explore More Sample ServersΒΆ
You've already run a few servers in the Running MCP Servers section. Now try registering them with the Gateway or explore others:
- csv_pandas_chat_server - Natural language CSV analysis (you may have run this!)
- data_analysis_server - Statistical analysis and visualization
- plotly_server - Interactive data visualization
- xlsx_server - Excel file manipulation
- synthetic_data_server - Generate test datasets (you may have run this!)
- mermaid_server - Create diagrams from text (you may have run this!)
- python_sandbox_server - Safe Python code execution
View all 20+ sample servers β
Try registering multiple servers with the Gateway and accessing them all through a single endpoint!
Learn Advanced FeaturesΒΆ
- Advanced Topics - Prompts, resources, middleware, authentication, storage
- Debugging - Troubleshooting tips and common issues
- FastMCP Documentation - Official FastMCP guides
- ContextForge Docs - Gateway configuration and deployment
- Enterprise MCP Guide - Production architecture, security, and best practices
Build SomethingΒΆ
Ideas for your next MCP server:
- Integrate with your favorite API (GitHub, Slack, Jira, etc.)
- Create domain-specific analysis tools
- Build data transformation pipelines
- Add LLM-powered features to existing applications
- Expose internal tools to AI assistants
Happy building! π