mcp-server-notion

mcp-server-notion

3.5

mcp-server-notion is an MCP server that uses the Notion API to search for articles on Notion and retrieve their contents.

mcp-server-notion is a Model Context Protocol (MCP) server designed to interface with the Notion API, enabling users to search and retrieve articles stored within Notion databases. This server acts as a bridge between your application and Notion, allowing for seamless access to content stored in Notion. By leveraging the Notion API, mcp-server-notion provides a programmatic way to search for articles using specific keywords and retrieve either full or partial content of the articles. This is particularly useful for applications that require dynamic content retrieval from Notion, such as content management systems, knowledge bases, or personal productivity tools.

Features

  • Search for articles within Notion databases
  • Retrieve full article content or partial content

MCP Tools

  • notion_search: Allows searching for articles using a query keyword and limits the number of results.
  • notion_get_article: Retrieves an article by its ID and allows specifying the output format (json, markdown, text).

Usage with Different Platforms

python_script

python
import requests

NOTION_API_TOKEN = 'your_notion_integration_token'

headers = {
    'Authorization': f'Bearer {NOTION_API_TOKEN}',
    'Content-Type': 'application/json',
    'Notion-Version': '2021-05-13'
}

def search_articles(query, limit=10):
    url = 'https://api.notion.com/v1/search'
    data = {
        'query': query,
        'page_size': limit
    }
    response = requests.post(url, headers=headers, json=data)
    return response.json()

def get_article(article_id, format='json'):
    url = f'https://api.notion.com/v1/pages/{article_id}'
    response = requests.get(url, headers=headers)
    if format == 'json':
        return response.json()
    elif format == 'markdown':
        # Convert to markdown
        pass
    elif format == 'text':
        # Convert to text
        pass
    return response.content