Getting Started¶
This page takes you from zero to a working GPT6-SOL tool-calling request in about five minutes.
1. Requirements¶
| Requirement | Version |
|---|---|
| Python | 3.10 or newer |
| OpenAI API key | with access to the GPT-6 family |
| An MCP server | optional — only needed for tool calling |
2. Install¶
3. Configure¶
The gateway reads configuration from environment variables, and falls back to a .env file in the
current working directory. Real environment variables always win over .env values.
Then set at minimum:
See Configuration for the full list.
4. First request¶
As a library¶
import asyncio
from mcp_for_copilot import Gateway
async def main() -> None:
async with Gateway(connect_mcp=False) as gateway:
result = await gateway.chat([{"role": "user", "content": "What is the Model Context Protocol?"}])
print(result.content)
asyncio.run(main())
As a server¶
curl -s http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6-sol",
"messages": [{"role": "user", "content": "What is MCP?"}]
}' | jq -r '.choices[0].message.content'
5. Add tools¶
Point the gateway at any MCP server. The command below assumes a stdio server that speaks MCP:
import asyncio
from mcp_for_copilot import Gateway, allow_all_approver
async def main() -> None:
async with Gateway(approver=allow_all_approver()) as gateway:
result = await gateway.chat([{"role": "user", "content": "What files are in this directory?"}])
print(result.content)
asyncio.run(main())
The MCP endpoint and allowlist come from MCP_SERVER_URL, MCP_TRANSPORT, and MCP_ALLOWED_TOOLS.
Approval is fail-closed
If you do not pass an approver, every risky tool call is denied. That is intentional.
Use allow_all_approver() only in trusted, non-interactive environments.
6. Verify your setup¶
{
"llm": {"provider": "openai", "api_key_configured": true, "default_model": "gpt-6-sol"},
"mcp": {"transport": "stdio", "url_configured": false, "allowed_tools": ["read_file", "..."]}
}
status never prints credential values — only booleans.
Next steps¶
- Architecture — how the pieces fit together
- Library Usage — custom approvers, tool routing, streaming
- Server Usage — Docker, compose, reverse proxies
- Security — threat model and hardening checklist