forked from mcp-use/mcp-use
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoauth_dynamic_client_registration.py
More file actions
46 lines (35 loc) · 1.09 KB
/
oauth_dynamic_client_registration.py
File metadata and controls
46 lines (35 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""
Test OAuth with Dynamic Client Registration (DCR) using Linear.
Linear supports DCR, so no manual OAuth app setup is required.
Just run this script and it will:
1. Discover OAuth metadata from Linear
2. Dynamically register a client
3. Open your browser to authorize
4. Connect to the MCP server
"""
import asyncio
from mcp_use import MCPClient
config = {
"mcpServers": {
"linear": {
"url": "https://mcp.linear.app/sse"
# No auth config needed - DCR handles everything
}
}
}
async def main():
client = MCPClient(config=config)
try:
session = await client.create_session("linear")
print("Connected to Linear MCP server!")
# List available tools
tools = await session.connector.list_tools()
print(f"\nAvailable tools ({len(tools)}):")
for tool in tools[:5]: # Show first 5
print(f" - {tool.name}")
if len(tools) > 5:
print(f" ... and {len(tools) - 5} more")
finally:
await client.close_all_sessions()
if __name__ == "__main__":
asyncio.run(main())