Sponsored by Deepsite.site

North MCP Python SDK

Created By
cohere-ai7 months ago
An sdk for creating MCP Servers with north
Content

North MCP Python SDK

This SDK builds on top of the original SDK. Please refer to the original repository's README for general information. This README focuses on North-specific details.

Installation

uv pip install git+ssh://git@github.com/cohere-ai/north-mcp-python-sdk.git

Why this repository

This repository provides code to enable your server to use authentication with North, a custom extension to the original specification. Other than that, no changes are made to the SDK; this builds on top of it.

Main differences

  • North only supports the StreamableHTTP transport. The sse transport is deprecated, it will work for backwards compatibility, but you shouldn't use it if you are creating new servers
  • You can protect all requests to your server with a secret.
  • You can access the user's OAuth token to interact with third-party services on their behalf.
  • You can access the user's identity (from the identity provider used with North).

Examples

This repository contains example servers that you can use as a quickstart. You can find them in the examples directory.

There are 2 examples, one that uses the auth to get the user making the tool call, and the other one shows how to send the right metadata so that the North UI can display the tool call results correctly.

Authentication

This SDK offers several strategies for authenticating users and authorizing their requests.

I only want north to be able to send requests to my server

mcp = NorthMCPServer(name="Demo", port=5222, server_secret="secret")

I want to get the identity of the north user that is calling my server

Refer to examples/server_with_auth.py. During your request call the following:

user = get_authenticated_user()
print(user.email)

I need access to a third party service via oauth (e.g.: google drive, slack, etc...)

Similar as above:

user = get_authenticated_user()
print(user.connector_access_tokens)

Local Development without North

This guide describes how to test your MCP server locally without connecting it to North. For this, we will use the MCP Inspector. You can run it with:

npx @modelcontextprotocol/inspector

If authentication is not required and you just want to run it locally, you can choose the stdio transport. Navigate to the MCP Inspector and configure it as follows:

  • Transport Type: stdio
  • Command: uv
  • Arguments: run examples/server_with_auth.py --transport stdio

From here:

  • Click "Connect"
  • Select "Tools" on the top of the screen.
  • Click "List Tools" -> "add"
  • Add the numbers and click "Run". You should see the sum.

Adding authentication

If you want to test the authentication mechanism locally you can do the following. First start the server with the streamable http transport:

uv run examples/server_with_auth.py --transport streamable-http

Next, create a bearer token. You can generate one using examples/create_bearer_token.py or use a pre-made one.

Navigate to the MCP Inspector and configure it like this:

  • Transport Type: Streamable HTTP
  • URL: http://localhost:5222/mcp
  • Authentication -> Bearer token: eyJzZXJ2ZXJfc2VjcmV0IjogInNlcnZlcl9zZWNyZXQiLCAidXNlcl9pZF90b2tlbiI6ICJleUpoYkdjaU9pSklVekkxTmlJc0luUjVjQ0k2SWtwWFZDSjkuZXlKbGJXRnBiQ0k2SW5SbGMzUkFZMjl0Y0dGdWVTNWpiMjBpZlEuV0pjckVUUi1MZnFtX2xrdE9vdjd0Q1ktTmZYR2JuYTVUMjhaeFhTaEZ4SSIsICJjb25uZWN0b3JfYWNjZXNzX3Rva2VucyI6IHsiZ29vZ2xlIjogImFiYyJ9fQ==

Follow the same process as before. When you call the tool, you should see the following log in the terminal where you started the server:

This tool was called by: test@company.com
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
WindsurfThe new purpose-built IDE to harness magic
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
CursorThe AI Code Editor
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Tavily Mcp
Serper MCP ServerA Serper MCP Server
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Playwright McpPlaywright MCP server
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Amap Maps高德地图官方 MCP Server
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
ChatWiseThe second fastest AI chatbot™
DeepChatYour AI Partner on Desktop
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.